We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone, basically i have a main menu which has 3 buttons to open new window working differently. So far i can add buttons to the created window but these buttons do not response on the click anymore. I am not sure is my way the correct way to do things or anything wrong on the handleButtonEvents method. Can somebody please read my code and tell me what goes wrong?
I cant get the code function working please use this link (http://paste.ofcode.org/uHeGmzY35YvVW25UmeJKF7).
Answers
The first thing to realise is that for a GWindow the draw handler is the equivalent of Processing's
draw()
method. In other words it is executed ~60 times a second and is responsible for creating the display.In you code you are creating btnGrasp and btnRelease 60 times a second :(
Ok the solution is to remove the lines creating these buttons from the draw handler so you have
and create the buttons when you create the window like this
I know these changes because I have tested them. :D
Thanks Quark, it works now.