Re: XResources and menu mnemonics [message #14579] |
Fri, 12 March 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Mathew Yeates (mathew@nospam-fugue.jpl.nasa.gov) writes:
> I have the following simple app
> which creates a menu.
>
> pro test2
> base = WIDGET_BASE(TITLE = 'Example', MBAR=bar,rname_mbar='test2')
> file_menu = WIDGET_BUTTON(bar, VALUE='File',
> MENU=2,Resource_name='filemenubut')
> file_bttn1=WIDGET_BUTTON(file_menu, VALUE='Item 1',$
> �������������������� ��� UVALUE='FILE1')
> file_bttn2=WIDGET_BUTTON(file_menu, VALUE='Item 2',$
> �������������������� ��� UVALUE='FILE2')
> WIDGET_CONTROL, /REALIZE, base
> XMANAGER, 'test2', base
> end
>
>
> and a resource file that says,
>
> Idl*test2*filemenubut*mnemonic: F
> Idl*test2*filemenubut*accelerator: Meta<key>F4
> Idl*test2*filemenubut*acceleratorText:Meta-F4
> Idl*test2*filemenubut*background: red
>
>
> The "File" button gets an underscore like its supposed to. But
> typing 'F' on the keyboard does nothing. The same thing, however,
> works for the other buttons (setting the mnemonic to I for instance).
>
> Questions:
> 1) Why doesnt it work for the button at the top which gets the /Menu
> keyword?
Buttons with the MENU keyword set for them (or, alternatively,
any button in the Menu Bar) do not generate events in IDL.
Or, rather, the events that they generate do not get sent to any
IDL event handler. Hence, you don't know about them. In this case,
you can assign an accelerator and the accelerator probably even
works, you just can't learn about it in your event handler.
> 2) What are the accelerators supposed to do? These entries seem to
> have no effect for any of the buttons.
Accelerators generate events, just as if the user had clicked
the buttons. What effect they have depends upon your event handler
code.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|