Re: wxEuphoria - set_event_handler
- Posted by Mario Steele <eumario at trilake.net> Apr 25, 2005
- 458 views
Hey Jim, sixs wrote: > > Hi. I'm having some trouble with clicking on a wxlistbox and I am > confused about the event handler. I am thinking that within set event > handler that the "this" is the wxFrame name, "id" is thename of the > listbox, the "event" is ?, " rid" is the name of the procedure. I can > get the buttons to work. > Thanks for any help > Jim Okay, I know this can be a bit confusing at first, but it's actually quite simple. With wxEuphoria, most controls, can have a ID assigned to it, but the thing to note about wxEuphoria, is that it's an Object Oriented library. In the set_event_handler() routine, this refers to the instance of the control you created, for example: constant MyFrame = create(wxWindow,{0,-1,"Hello World",-1,-1,-1,-1}) set_event_handler(MyFrame,-1,wxEVT_PAINT,routine_id("myPaintRoutine")) Notice, that the 'this' is being passed as MyFrame. the 'id' is -1. The 'event' is wxEVT_PAINT, and the 'rid' is "routine_id("myPaintRoutine")" Another way this can work, is through this method: set_event_handler(MyFrame,get_id(MyFrame),wxEVT_PAINT,routine_id("myPaintRoutine")) Most generally, the ID that you pass in a set_event_handler() can be a -1, so that the wxEuphoria library can grab the 'id' associated with the instance given. Hope this helps. Mario Steele http://enchantedblade.trilake.net Attaining World Dominiation, one byte at a time...