| Re: mbar and event handlers [message #5355 is a reply to message #5352] |
Wed, 06 December 1995 00:00  |
Ken Knighton
Messages: 44 Registered: May 1995
|
Member |
|
|
runar.jorgensen@fys.uio.no wrote:
>
> I'm having some problems with eventhandlers and mbar. I'll illustrate
> with some sample code:
>
> First the event handler. Then the widget creating routine.
>
> PRO menu_base_Event, Event
Should be root_event, event
> widget_control,Event.Id,GET_UVALUE=Ev
> .
> .
> end
>
> PRO root
> ROOT = widget_base(mbar=menu_base,...)
> HelpMenuDesc = [...]
> HelpMenu = cw_pdmenu(menu_base, /mbar, HelpMenuDesc,...)
>
> widget_control,root,/realize
> xmanager,'menu_base',menu_base
^^^^^^^^^^^^^^^^^^^^
Should be xmanager, 'root', ROOT
> end
>
> This works fine, but then I want to add a couple of new buttons in a
> sub_base of ROOT. This is were everything goes wrong.
>
> sub_base = widget_base(ROOT)
> button=widget_button(sub_base,...)
>
This is because you are telling xmanager to assign the event handler to the
menubar base instead of the top level base. In essence, the top level base and
all of its sub-widgets except the menubar and its children are not being
managed. That means that you can click on the button all day long and nothing
is done with the event that is produced. You may want to go back and read the
documentation on xmanager and look at some of the examples that are provided
with the IDL distribution.
> The button does not recognize sub_base nor ROOT. Do I need an additional
> eventhandler for these buttons?
You have your terms confused. The button produces events which then must be
processed in order for them to do anything. Since the button's events are not
being intercepted by the xmanager (which uses widget_event), they simply head
to the bit bucket.
I hope this helps.
Ken Knighton
Fusion Division
General Atomics
San Diego
|
|
|
|