CW_PDMENU enhancement [message #2818] |
Mon, 03 October 1994 08:12  |
meinel
Messages: 14 Registered: February 1994
|
Junior Member |
|
|
I have added a button sensitivity switch to CW_PDMENU. I use it for
putting menu item separators in pull-down menus.
NAME:
MY_PDMENU
PURPOSE:
MY_PDMENU is a compound widget that simplifies creating pull-down
menus. It has a simpler interface than the XPDMENU procedure, and
includes a button sensitivity feature not found in CW_PDMENU.
CALLING SEQUENCE:
widget = MY_PDMENU(Parent, Desc)
INPUTS:
Parent: The ID of the parent widget
Desc: An array of structures, each of which has the following
definition:
{MY_PDMENU_S, flags:0, name:'', sense:0}
"flags" and "name" are the same as used in CW_PDMENU.
The "sense" tag specifies the sensitivity of the button.
EXAMPLE:
The following is the description of a menu bar with one button.
"File" is a pull-down menu containing "Open...", "New" and "Quit".
"--------" is a desensitized item used as a separator.
;make sure MY_PDMENU_S is defined
junk = {MY_PDMENU_S, flags:0, name:'', sense:0}
;The description
desc = [{MY_PDMENU_S, 3, 'File', 1}, $
{MY_PDMENU_S, 0, 'Open...', 1}, $
{MY_PDMENU_S, 0, 'New', 1}, $
{MY_PDMENU_S, 0, '--------', 0}, $
{MY_PDMENU_S, 2, 'Quit', 1}]
;Create the widget
base = widget_base()
menu = MY_PDMENU(base, desc, /RETURN_FULL_NAME)
WIDGET_CONTROL, /REALIZE, base
repeat begin
ev = WIDGET_EVENT(base)
print, ev.value
end until ev.value eq 'File.Quit'
WIDGET_CONTROL, /DESTROY, base
end
The modifications that are made to CW_PDMENU are:
Globally replace CW_PDMENU with MY_PDMENU
In PRO MY_PDMENU_BUILD add the line
sensitive = desc(cur).sense
after the line "dname = desc(cur).name"
Change
WIDGET_CONTROL, new, SET_UVALUE=uvalue
to
WIDGET_CONTROL, new, SET_UVALUE=uvalue, SENSITIVE=sensitive
Ed
meinel@aero.org
|
|
|
|