About G4P GUI Builder

So here is the thing I want to combine both of the windows. Is there a way

/* =========================================================
 * ====                   WARNING                        ===
 * =========================================================
 * The code in this tab has been generated from the GUI form
 * designer and care should be taken when editing this file.
 * Only add/edit code inside the event handlers i.e. only
 * use lines between the matching comment tags. e.g.

 void myBtnEvents(GButton button) { //_CODE_:button1:12356:
     // It is safe to enter your event code here  
 } //_CODE_:button1:12356:
 * Do not rename this tab!
 * =========================================================

synchronized public void win_draw1(PApplet appc, GWinData data) { //_CODE_:Kontrol_Ekrani:882101:
} //_CODE_:Kontrol_Ekrani:882101:

public void password1_change1(GPassword source, GEvent event) { //_CODE_:password1:732091:
  GUIController.appendText("password1 - GPassword >> GEvent." + event + " @ " + millis());
} //_CODE_:password1:732091:

public void textarea1_change1(GTextArea source, GEvent event) { //_CODE_:GUIController:282202:
  GUIController.appendText("Designing - GTextArea >> GEvent." + event + " @ " + millis());
} //_CODE_:GUIController:282202:

public void button1_click1(GButton source, GEvent event) { //_CODE_:BaslatmaButonu:288369:
  GUIController.appendText("BaslatmaButonu - GButton >> GEvent." + event + " @ " + millis());
} //_CODE_:BaslatmaButonu:288369:

public void option1_clicked1(GOption source, GEvent event) { //_CODE_:BASLAT:629205:
  GUIController.appendText("BASLAT - GOption >> GEvent." + event + " @ " + millis());
} //_CODE_:BASLAT:629205:

public void option1_clicked2(GOption source, GEvent event) { //_CODE_:RESET:396165:
  GUIController.appendText("RESET - GOption >> GEvent." + event + " @ " + millis());
} //_CODE_:RESET:396165:

public void textfield1_change1(GTextField source, GEvent event) { //_CODE_:Designing:648988:
  GUIController.appendText("textfield1 - GTextField >> GEvent." + event + " @ " + millis());
} //_CODE_:Designing:648988:

public void timer1_Action1(GTimer source) { //_CODE_:Sayac:349675:
  GUIController.appendText("Sayac - GTimer >> an event occured @ " + millis());
} //_CODE_:Sayac:349675:

// Create all the GUI controls. 
// autogenerated do not edit
public void createGUI(){
  surface.setTitle("Sketch Window");
  Kontrol_Ekrani = GWindow.getWindow(this, "Baslatma Ekrani", 0, 0, 1920, 1080, JAVA2D);
  Kontrol_Ekrani.addDrawHandler(this, "win_draw1");
  password1 = new GPassword(Kontrol_Ekrani, 477, 169, 540, 36);
  password1.addEventHandler(this, "password1_change1");
  GUIController = new GTextArea(Kontrol_Ekrani, 482, 388, 545, 80, G4P.SCROLLBARS_NONE);
  GUIController.setPromptText("Designed By COFSAT Tekirdag");
  GUIController.addEventHandler(this, "textarea1_change1");
  BaslatmaButonu = new GButton(Kontrol_Ekrani, 659, 238, 209, 41);
  BaslatmaButonu.addEventHandler(this, "button1_click1");
  togGroup1 = new GToggleGroup();
  BASLAT = new GOption(Kontrol_Ekrani, 490, 248, 120, 20);
  BASLAT.setIconAlign(GAlign.LEFT, GAlign.MIDDLE);
  BASLAT.setText("option text");
  BASLAT.addEventHandler(this, "option1_clicked1");
  RESET = new GOption(Kontrol_Ekrani, 488, 302, 120, 20);
  RESET.setIconAlign(GAlign.LEFT, GAlign.MIDDLE);
  RESET.setText("option text");
  RESET.addEventHandler(this, "option1_clicked2");
  Designing = new GTextField(Kontrol_Ekrani, 477, 21, 539, 52, G4P.SCROLLBARS_NONE);
  Designing.setPromptText("Designed By COFSAT Tekirdag");
  Designing.addEventHandler(this, "textfield1_change1");
  Sayac = new GTimer(this, this, "timer1_Action1", 1000);

// Variable declarations 
// autogenerated do not edit
GWindow Kontrol_Ekrani;
GPassword password1; 
GTextArea GUIController; 
GButton BaslatmaButonu; 
GToggleGroup togGroup1; 
GOption BASLAT; 
GOption RESET; 
GTextField Designing; 
GTimer Sayac; 

Here is the custom GUI Codes

You need to explain what you mean by this.

I should point out that each GWindow has its own main-event-handling thread so combining the windows in any meaningful way is unlikely to be possible.

I made my own GUI With the serial port I want to use your tool’s GUI in my GUI.I want to add some ifs like If password is wrong delete the box from Kontrol_Ekrani things like that

Still not clear what you are trying to do.

Obviously you have been using GUI Builder to create some controls and these can be on the main window or the secondary window.

Yes ofc. Actually I can write down my code for you to understand but I’m afraid that my GUI would be stolen by other guys in the competition that I’m in. Anyways How can we use If’s in GUI Page

Anyways What I want to do is When I press the button I want the serial port to be opened

That’s not really a question for the G4P Library. In the button handler you need something like

    myPort = new Serial(this, "COM1", baudRate);

where you need to replace “COM1” with the name of your Serial port and baudRate is a variable previously declared as an int with the value of the baud rate you intend to use. For example:

int baudRate = 57600;

Add the code provided by @PhilHaw to the button’s event handler.

1 Like

Actually I kinda didnt understand this. Will it work even tho I can open a serial port just by running it. When I did what you wrote with quark and it didnt work. My Original GUI opens and when I click the button nothing happens except he GUIController.appendText event. @quark @PhilHaw.