# G4P GUI Builder 4.2.1: new window KEEP\_OPEN doesn't work

**URL:** <https://discourse.processing.org/t/g4p-gui-builder-4-2-1-new-window-keep-open-doesnt-work/5994>\
**Category:** Libraries\
**Created:** [November 27, 2018, 2:09pm UTC](https://discourse.processing.org/t/g4p-gui-builder-4-2-1-new-window-keep-open-doesnt-work/5994 "2018-11-27T14:09:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gyula](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gyula](https://discourse.processing.org/u/gyula)\
**Post date:** [November 27, 2018, 2:09pm UTC](https://discourse.processing.org/t/g4p-gui-builder-4-2-1-new-window-keep-open-doesnt-work/5994/1 "2018-11-27T14:09:10Z")

</div>

@quark, I really appreciate your G4P library and this is just a small issue I may have found in GUI Builder 4.2.1. on Windows.

When I set up a new window in G4P GUI Builder, selecting the **KEEP\_OPEN** parameter for _Action on close_ will not take effect and the new window **can be closed**.

Here’s a simple autogenerated code:

```auto
// Need G4P library
import g4p_controls.*;

public void setup(){
  size(480, 320, JAVA2D);
  createGUI();
  customGUI();
  // Place your setup code here  
}

public void draw(){
  background(230); 
}

// Use this method to add additional statements
// to customise the GUI controls
public void customGUI(){
}

synchronized public void win_draw1(PApplet appc, GWinData data) { //_CODE_:window1:799050:
  appc.background(230);
} //_CODE_:window1:799050:

// Create all the GUI controls. 
// autogenerated do not edit
public void createGUI(){
  G4P.messagesEnabled(false);
  G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
  G4P.setCursor(ARROW);
  surface.setTitle("Sketch Window");
  window1 = GWindow.getWindow(this, "Window title", 0, 0, 240, 120, JAVA2D);
  window1.noLoop();
  window1.addDrawHandler(this, "win_draw1");
  window1.loop();
}

// Variable declarations 
// autogenerated do not edit
GWindow window1;

```

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [November 27, 2018, 2:59pm UTC](https://discourse.processing.org/t/g4p-gui-builder-4-2-1-new-window-keep-open-doesnt-work/5994/2 "2018-11-27T14:59:04Z")

</div>

This is a bug in GUI Builder in that it doesn’t add the instruction to keep the window open. A simple fix would be to add the missing instruction in `customGUI` like this

```auto
public void customGUI() {
  window1.setActionOnClose(G4P.KEEP_OPEN);
}

```

Thanks for reporting it, please raise a ticket on [Sourceforge](https://sourceforge.net/p/guibuilder/tickets/)

---

<div class="post-metadata">

**Author:** ![gyula](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gyula](https://discourse.processing.org/u/gyula)\
**Post date:** [November 28, 2018, 9:44am UTC](https://discourse.processing.org/t/g4p-gui-builder-4-2-1-new-window-keep-open-doesnt-work/5994/3 "2018-11-28T09:44:47Z")

</div>

Thanks Peter, I’ve opened a ticket on [Sourceforge](https://sourceforge.net/p/guibuilder/tickets/11/).
