First off, thank you @quark for the great libraries and gui building tools. They have been really helpful recently!
I am working on a project that involves several windows, all of which I need to be reusable while the program is running. On a few of the windows which involve user input I have added a button that can be clicked to “close” (hide) the window. One of the windows that I am using is meant to display an image and just an image, but needs to be able to be hidden and reused in the future.
Below is a simplified code snippet that I generated with the G4P builder tool.
synchronized public void win_draw1(PApplet appc, GWinData data) { //_CODE_:window1:920231:
appc.background(230);
} //_CODE_:window1:920231:
public void window1OnClose(GWindow window) { //_CODE_:window1:910966:
println("window1 - window closed at " + millis());
window1.setVisible(false);
} //_CODE_:window1:910966:
// Create all the GUI controls.
// autogenerated do not edit
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setMouseOverEnabled(false);
surface.setTitle("Sketch Window");
window1 = GWindow.getWindow(this, "Window title", 0, 0, 240, 120, JAVA2D);
window1.noLoop();
window1.setActionOnClose(G4P.KEEP_OPEN);
window1.addDrawHandler(this, "win_draw1");
window1.addOnCloseHandler(this, "window1OnClose");
window1.loop();
}
// Variable declarations
// autogenerated do not edit
GWindow window1;
I would like to be able to hide the window by pressing the built-in exit/close button, but haven’t found a way to do that yet. If it’s not possible, then I will probably resort to adding a button on the window I want to hide.
Am I missing something obvious here about how G4P windows work? Is there a way to detect if the operating system exit button has been clicked?
Thank you,
Grayson