Re: mbar and event handlers [message #5352] |
Thu, 07 December 1995 00:00 |
Runar J|rgensen
Messages: 6 Registered: December 1995
|
Junior Member |
|
|
>> This is because you are telling xmanager to assign the event handler
>> to the menu bar base instead of the top level base.
Not quite. The menu bar base is the top (or main, root) base.
My point is that unless the event handler routine is named according
to the menu bar base it will not respond to events generated by any
item in the menu bar. But it is responding fine to events generated by e.g.
a button (child widget of top level base).
But if the event handler routine is named after the menu bar name, it will
respond to menu bar events but not to e.g. button widgets even if they are
child of the same base. BTW, the base of a button can not be the name of
the menu bar. I've tried.
Runar J�rgensen
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-
Runar Jorgensen ||
University of Oslo || Phone: +47 2285 5663
Department of Physics || Telefax: +47 2285 5671
P.O.Box 1048 Blindern || email: runar.jorgensen@fys.uio.no
0313 Oslo; Norway ||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-
|
|
|
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
|
|
|