Adding a button event handler to a child window in G4P

I've noticed that none of the examples with G4P feature working buttons in external windows (created using the GWindow factory methods). I've also noticed GWindow has no addButtonHandler() to go along with addMouseHandler() and addDrawHandler(). What I want to know is, how do I get a GWindow object to handle button events without making my own implementation of GWindow? Surely there is some simpler way that I am missing? The same goes for slider events and other such things, since I'm sure I'm not the first one to want functioning UI widgets in an external toolbar window.


  • Answer ✓

    I suggest that you add the GUI Builder tool which provides a visual editor for creating GUIs with G4P. This allows you to easily create multiple windows and add other UI controls such as buttons and sliders to them.

    By examining the source code created with GUI Builder it will help you understand how G4P works.

    More information and video tutorials for using GUI Builder and G4P can be found on my website,

  • Thanks, I didn't realize you had built a scene builder tool. It's very useful, but it should probably be mentioned in the about page for G4P so nobody misses it.

    That said, I have decided that fewer windows is probably better.

Sign In or Register to comment.