G4P Question - Create / hide second screen

@quark

I apologize in advance for my newbiness. I’m using Processing 3.5.3, G4P V4.2.1, and GUI Builder 4.3 in Windows 7 64 bit. I love your utility but in my newbiness I’m having a devil of a time trying to figure it out. I confess I can’t grasp how to find out how to do anything using the reference page at your link. I’m not new on how to program things in basic-like languages but I’m new to Java and confess most OOP policies just confuse me on what happens when.

Anyway, I’ve been playing around some and I wonder if you could give me an example using GUI builder. I’d like to create a main screen with a button on it that launches a second screen that covers/obscures the main screen completely. On the second screen is a button that hides/suspends/closes/obscures the second screen and returns the view and execution to the main screen. So I can switch back and forth. I can’t find an example to copy that from.

In the application I’m building the main screen runs a lot of display stuff and the second screen will be used to change a lot of settings.

Thanks in advance. I’m sorry to be reduced to asking like this but I’m stumped.

1 Like

My website www.lagers.org.uk has several videos showing GUI Builder in action and there are a lot more guides for G4P so have a look there first.

2 Likes

I saw all those, thanks for them.

I need to make a button that opens a second window (there are examples for that) and one to go on the second window to close it. Sorry to bother you. Or. Where can I find out if there is a secondwindow.close or something? Most answers that come up in search are for previous versions.

Thanks.

The website guide to G4P explains that is better not to open/close windows on need rather to create them in setup and make them visible / invisible as needed.

There are plenty of examples of creating windows and you can use

window.visible(false); // to hide the window and
window.visible(true); // to show the window  

you can add these statements to button event handlers.

3 Likes

Thank you! And thank you for this excellent library.

1 Like

I used the GUI builder from a fresh start.
I created a second window.
It got called “window1”.
I put a button on the second screen.
I edited the event handler for the button by adding the statement;
window1.visible(false);
and got
the function "visible(boolean)" does not exist.
I’m missing something basic here. And I’m reading all the documentation I can find. I’m learning lots of other stuff but not what I’m after. Please, I could use a clue.

I need to have one button on the main screen that shows a second window and a button on the second window that hides the second window and shows the main screen.

Thanks in advance for any more clues.

Try
window1.setVisible(false);

2 Likes

It worked! Thanks so much.