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

Home » Public Forums » archive » 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 #14465 is a reply to message #14397] Wed, 03 March 1999 00:00 Go to previous messageGo to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
David Fanning wrote:

> Adding a menu item as a button, assigning an event
> handler for it, and writing the new event handler
> can be done in a matter of minutes, as opposed to
> re-ordering my index numbers in a large event
> handler, making several mistakes that introduce
> other errors, etc.

I agree, David, that this is easily done in a few minutes -
although the situation might require a bit more than just an
event handler. You might want to (de)sensitize the button(s)
based on a number of different criteria, not just based on
events from the buttons themselves... So you'll probably
need to store the ID(s) in the info structure anyway.

Anyway, the ID extraction from the array would come directly
after the cw_pdmenu call using the IDS= keyword, so it isn't
that difficult to remember the update when you're changing
the cw_pdmenu call...

Given that button IDs for several buttons need to be stored
for later use, the difference isn't all that big... But
personally I agree that the direct method using /MENU in
widget_button is aesthetically more pleasing.

> When it comes to programming, I need all the help I can
> get.

Ok - you asked for it :-) In the case that one needs to
manipulate the status of several buttons on a pulldown menu,
the sensible thing is to write a pulldown menu *object*.

When this is done once and for all, you can forget all about
IDs and widget_control calls. Something like this (off the
top of my head, the specific mode of operation is at the
programmers discretion, of course):

menu = obj_new('mypdmenu',base,'Pull Down Menu')
menu->add,'Level 1a','LEVEL1A' ;; Second arg. is an optional
menu->add,'Level 1b','LEVEL1B' ;; identifier, [UVALUE]
menu->add,'Level 1c','LEVEL1C',/menu
menu->add,'Level 2a','LEVEL2A'
menu->add,'Level 2b','LEVEL2B'

We keep the object pointer in the info structure, and
later we use it like this:

;; No argument means desensitize whole menu
menu->desensitize

;; One argument means desensitize that button (or
;; submenu)
menu->sensitize,'LEVEL1A' ;; Single button
menu->desensitize,'LEVEL1C' ;; Submenu.

The rationale behind using identifiers like 'LEVEL1A' etc is
to be independent of the actual button text (like, if
somebody translates the text to serbocroatian... :-)

You may of course specify event handlers etc. in the "add"
method..

Regards,

Stein Vidar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: INSIGHT 3D Visualization ?
Next Topic: Map of the Moon's surface

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

Current Time: Fri Oct 10 12:48:25 PDT 2025

Total time taken to generate the page: 1.27873 seconds