G4P and P3D - can not input text into text field

Hello, I can not input text into text field on GUI window created by G4P in case if the main (sketch) window uses P3D. Please help to solve this issue.

Example code: `

    // Need G4P library
    import g4p_controls.*;

    public void setup(){
      size(480, 320, P3D);
      // Place your setup code here


    public void draw(){


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



gui `

synchronized public void win_draw1(GWinApplet appc, GWinData data) { //_CODE_:window1:248571:
} //_CODE_:window1:248571:

public void textfield2_change1(GTextField source, GEvent event) { //_CODE_:textfield2:400022:
  println("textfield2 - GTextField >> GEvent." + event + " @ " + millis());
} //_CODE_:textfield2:400022:

// Create all the GUI controls. 
// autogenerated do not edit
public void createGUI(){
  if(frame != null)
    frame.setTitle("Sketch Window");
  window1 = new GWindow(this, "Window title", 0, 0, 240, 120, false, JAVA2D);
  window1.addDrawHandler(this, "win_draw1");
  textfield2 = new GTextField(window1.papplet, 40, 45, 160, 30, G4P.SCROLLBARS_NONE);
  textfield2.addEventHandler(this, "textfield2_change1");

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



  • The code you posted here worked for me.

    What version of Processing and G4P are you using?

  • Processing 2.2.1 G4P V2.5

  • edited March 2016

    You should be using G4P 3.5.4

    In the PDE go to Sketch > Import Library > Add Library find G4P click on remove then once removed click on install for the latest compatible version for PS 2.2.1

  • updated G4P library - same result.

    I think it has to do with GUI Builder tool for G4P. I used tool V2.5 to create GUI. Now I updated to V2.6 - it is not compatible with my GUI built with V2.5.

    How to change gui script to make it compatible?

  • Actually updating G4P GUI Builder tool does not solve the problem. GUI created with newer version behaves the same.

  • OK you are getting confused between G4P and GUI Builder. I was asking which version of G4P you used and you told me the version of GUI Builder.

    I think it has to do with GUI Builder tool for G4P

    This has NOTHING to do with the problem you reported in your first post above. GUI Builder has no influence on how G4P works it is simply a tool to simplify the creation and layout of G4P components.

    I used tool V2.5 to create GUI. Now I updated to V2.6 - it is not compatible with my GUI built with V2.5.

    How to change gui script to make it compatible?

    In most cases GUI Builder is not backwardly compatible so GUIs created with 2.5 cannot be updated with 2.6

    You must delete the GUI Builder tool and reinstall the earlier version 2.5

    You can download V2.5 of GUI Builder from Sourceforge. Then unzip the download and install it manually following the instructions on this webpage.

  • Thank you quark. I updated G4P library too - now it is 3.5.4 But the problem is still there.

  • This is how it looks on my computer: text field gets yellow cursor but keyboard is inactive - not letters or numbers appear typed in the text window. In the same time I can set text for the text filed in GUI builder and it appears in the GUI when I run the script. But this text is not editable.

    Screenshot from 2016-03-24 12:06:01

  • Is there a flashing cursor in the textfield? If not then the textfield will not respond to key strokes. Click inside the textfield first.

  • There is flashing black cursor on the right from yellow line - it did not show up in the screen shoot.

  • The black cursor is the text insertion point. I will send a PM with my email address. Archive (from the Tools menu) the sketch and send it to me as an attachment.

  • I clicked on the textfield so the cursor was flashing and then typed some characters that appeared in the textfield. In other words your sketch worked for me.

    I even recreated the sketch with GUI Builder 2.5 and it still worked.

    So I have no idea why it didn't work for you :(

  • edited March 2016

    When I start the sketch I get the following text in orange in the processing console:

    libEGL warning: DRI2: failed to authenticate

    When I close the script I get the following orange text:

    X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 1/1, reusable (open, marked uncloseable): 0, pending (open in creation order): 1) X11Util: Open X11 Display Connections: 1 X11Util: Open[0]: NamedX11Display[:0, 0x7f661c8cb9a0, refCount 1, unCloseable false]

    I have Linux Mint 17.3 64bit on my computer.

    java version "1.7.0_95" OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

  • Have you always got these messages?

    It could be to do with the GWindow rather than the GTextfield. Try the sketch again with a single window.

  • I have these messages only if I have window with P3D, P2D or OPENGL renderers. If rendered is default or JAVA2D everything works normal without warnings

  • JAVA2D is the default renderer. P2D, P3D and OPENGL all use OpenGL. I suggest you update the drivers for your Graphics card.

    These error messages have NOTHING to do with G4P or GUI Builder.

Sign In or Register to comment.