fsc_inputfield question re compound widgets [message #59332] |
Sat, 22 March 2008 14:14 |
markb77
Messages: 217 Registered: July 2006
|
Senior Member |
|
|
Hi,
I'm writing a compound widget that makes use of David's
FSC_Inputfield, which is itself a compound widget. I'm running into
some problems with the event handling...
Here's what's going on. My compound widget (let's call it cw_parent)
has its own event handler, cw_parent_event_handler. When I initialize
the FSC_Inputfield I specify the cw_parent_event_handler in the
EVENT_FUNC keyword of FSC_INPUTFIELD.
When I click on the FSC_inputfield widget in my cw_parent widget, it
generates an event that gets handled by cw_parent_event_handler. So
far so good. What cw_parent_event_handler does is return a different
type of event .. let's say a cw_parent_event structure. What I expect
to happen is for this event to bubble up the hierarchy to the next
level, and be handled by the event handler for the program that
created the cw_parent compound widget. Instead, what happens is that
the event that was returned by cw_parent_event_handler gets sent back
to cw_parent_event_handler again!
I think what's going on is that the initial event is generated by a
call_method call in FSC_Inputfield_Event_Handler(). After this event
is processed by the cw_parent_event_handler, it returns a
cw_parent_event, which bubbles up the hierarchy and is caught by the
event handler that is defined for the top level base of the
FSC_Inputfield compound widget, which is again
cw_parent_event_handler, and so the event gets sent back there
again.
I know this must be very confusing to read -- I'll try to put some
sort of example code together. My basic question is whether this is a
bug in FSC_Inputfield or whether I'm simply using it the wrong way?
The "event coming back twice" behaviour goes away if I remove the
assignment of the event_func keyword during the creation of the top
level base in the sourcecode of FSC_Inputfield, seemingly without
breaking any of its functionality..?
thanks,
Mark Bates
|
|
|