Extending Events

Lee McColl-Sylvester lee.mccoll at lyons-group.co.uk
Fri Aug 4 03:15:20 PDT 2006


Right, here it is then.  Technically, the following scenario should be
sufficient

 

void MyClass ::EventBind( scriptValue ctrl, scriptValue evt, scriptValue
func )

{

            // deal with storing function mapping to event here

}

 

BEGIN_EVENT_TABLE( MyClass, wxEvtHandler )

            EVT_MENU_RANGE( -1, -1, MyClass::EventHandler )

END_EVENT_TABLE()

 

void MyClass::EventHandler( wxEvent &event )

{

            wxMyCustomEvent* ce =
(wxMyCustomEvent*)event.m_callbackUserData;

            scriptValue = ce->m_Func;

            scriptValue = ce->m_evt;

            scriptValue = ce->m_ctrl;

 

            // ... fire event back to script language

}

 

This should get what I need, but how do I bind my values to the event
for when it's fired?  That's the part I can't fathom.

 

Regards,

Lee

 

 

 

________________________________

From: Lee McColl-Sylvester [mailto:lee.mccoll at lyons-group.co.uk] 
Sent: 04 August 2006 11:03
To: wx-users at lists.wxwidgets.org
Subject: RE: Extending Events

 

Okay, apparently, the wxPython classes create a new callback class that
contains the extra data required by the event to proxy.  But how does
that data get entered into the callback instance when the event is
fired?

 

Lee

 

 

 

________________________________

From: Lee McColl-Sylvester [mailto:lee.mccoll at lyons-group.co.uk] 
Sent: 04 August 2006 10:07
To: wx-users at lists.wxwidgets.org
Subject: Extending Events

 

Hi List,

 

I'm intending on using wxWidgets to provide GUI support for a scripting
language, but I'm having trouble working out how best to support events.
I know that wxPython extends the event objects, but how do they then get
the widgets to send the events with the extended data?

 

For example, normally one would register an event and supply a function
pointer using the event table macros, but this won't be possible in my
cercumstance.  I'm gonna need to register the event dynamically, passing
not only a function call but also various parameters that the function
will need to be able to proxy the event back to the scripting language.

 

Does anyone on this list have experience with this?  Do you know of any
examples I can look at?

 

Regards,

Lee

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20060804/edab4876/attachment.htm


More information about the wx-users mailing list