View Full Version : Pass additional arguments to set_event

12-18-2014, 01:41 PM
Is it possible to pass additional arguments to set_event? Right now I have individual set_event functions for each control but ideally I'd like to have just the one set_event function and pass arguments to it based on which ctl is calling is.

12-18-2014, 08:46 PM

CON_SETEVENT( ctl, eventFn, userdata )
Set the control's event function and CTL_USERDATA. Note: For some control types, calling this macro (or the control's set function with the CTL_USERDATA tag) has important side effects. Even if your userdata is NULL for those controls, you'll want to explicitly set it before opening the panel.

So, if userdata will be pointer to C++ class object, from event function you can call method of object, you might override it (virtual) (make couple objects one pointing to another). etc.
Might be challenge in Python though.

LWControlID is param to event call-back, so you could execute method with it as parameter..

typedef void (*LWCtlEventHook)(LWControlID, void *);

12-18-2014, 10:04 PM
Thanks Sensei. My experience with C is limited so understanding the sdk documentation is challenging.