| Re: Button Events question [message #41046 is a reply to message #40860] |
Wed, 15 September 2004 10:55   |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
By the way, if you had any other event handler above your cw_bgroup in
the widget hierarchy (and you didn't specify event_func), your cw_bgroup
events would be caught by that event handler. You could then use
event.id, or the user value, or something else, to identify that the
event comes from the cw_bgroup and just do nothing. That would also
suppress the error message.
Benjamin Hornberger wrote:
> I had the same annoying problem. A solution is to set the event handler
> for cw_bgroup (event_func='widFileType_event') and to write a function
>
> FUNCTION widFileType_event, event
>
> return, 0
>
> END
>
> cw_bgroup will always create events, that's the way it is written. The
> reason why the above works is that if you specify an event *function*
> (as opposed to an event procedure), IDL will call that function and
> inspect the return value. If the return value is a valid event structure
> (a structure with the fields ID, TOP and HANDLER), it will take that
> return value and move up the widget hierarchy until it finds another
> event handler, to which it passes that structure. If the return value is
> not a valid event structure (like above, where we return zero), it is
> discarded and no further events are generated.
>
> This mechanism gets important when you want to write compound widgets
> for which you want to allow their own event procedures or functions. For
> further details, read "Widget Event Processing" in the IDL help.
>
> Good luck,
> Benjamin
>
>
>
> Jeff Patrick wrote:
>
>> I have a program that uses a number or radio buttons to get numeric
>> data. I don't need the buttons to respond to any events, but every
>> time I click on them an event error is generated in the IDL 5.3
>> programming environment. The event basically says that it could not
>> find the event handler. Everything works fine I just find these event
>> error annoying. Is there something I can set in the following line
>> that will suppress these errors or prevent the button group from
>> generating an event?
>>
>> widFileType = CW_BGROUP(widSetupDataTLB, ['Delta', 'dB'], UNAME =
>> 'widMapView', LABEL_LEFT = 'Input File Type :', /NO_RELEASE,
>> /EXCLUSIVE, /ROW )
>>
>> Thanks in advance,
>>
>> Jeff
|
|
|
|