comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Can I make entries in CW_PDMENU insensitive?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Can I make entries in CW_PDMENU insensitive? [message #14380] Thu, 25 February 1999 00:00 Go to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
Steffen Luesse wrote:
>
> Dear all,
>
> I am using IDL 5.2 on solaris 2.6. I want to use the CW_PDMENU routine
> to create a pull-down menu in my widget programs. In principle,
> everything works well. However, I am wondering if it is possible to make
> some menu entries insensitive like I can do it with buttons or sliders
> when they should not be used. I did not find any information about my
> problem in the IDL documentation and would appreciate if anybody could
> give me a hint.
>
> Thanks in advance,
>
> Steffen

Yes, they can be made insensitive just like any other widget. The trick
is to know the widget id to make insensitive.

There is a keyword IDS to the CW_PDMENU routine which will return the
ids of every menu button created. They are created in the order they are
specified in the menu description. All you then have to do is match the
id in the returned ids to the menu item you want to make insensitive.

Of course, if the menu description changes you need to alter the
indexing
into the returned ids to get the same button. A bug waiting to happen...

E.g given the following description :

menu_labels = [ {CW_PDMENU_S, 1, 'File'}, $
{CW_PDMENU_S, 0, 'New data...'}, $
{CW_PDMENU_S, 0, 'Data def...'}, $
{CW_PDMENU_S, 0, 'Properties...'}, $
{CW_PDMENU_S, 2, 'Exit'}, $
{CW_PDMENU_S, 1, 'Windows'}, $
{CW_PDMENU_S, 0, 'Load...'}, $
{CW_PDMENU_S, 0, 'Save...'}, $
{CW_PDMENU_S, 2, 'Edit...'}, $
{CW_PDMENU_S, 1, 'Find'}, $
{CW_PDMENU_S, 2, 'Time...'}, $
{CW_PDMENU_S, 1, 'Print'}, $
{CW_PDMENU_S, 1, 'File'}, $
{CW_PDMENU_S, 0, 'Laser...'}, $
{CW_PDMENU_S, 2, 'Colour...'}, $
{CW_PDMENU_S, 1, 'Device'},$
{CW_PDMENU_S, 0, 'Laser'}, $
{CW_PDMENU_S, 2, 'Colour'} ]

menu = CW_PDMENU(parent, menu_labels, IDS=menu_ids)

the variable menu_ids contains the widget ids of each menu item.

I can de-sensitize the Windows menu by :

WIDGET_CONTROL, menu_ids(5), SENSITIVE=0

There are ways to reduce the potential for getting the wrong widget id.
But I'll leave that as an exercise for the student... ;-).

--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: NaN in pv-wave
Next Topic: Re: Misc. Bugs & Problems

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:53:32 PDT 2025

Total time taken to generate the page: 0.00397 seconds