Re: desensitizing selected elements of CW_BGROUP [message #12548] |
Wed, 19 August 1998 00:00 |
mgs
Messages: 144 Registered: March 1995
|
Senior Member |
|
|
In article <35DACF94.91798260@wellesley.edu>, rfrench@mediaone.net wrote:
> I would like to display a set of non-exclusive buttons in a group,
> but to be able to apply a 'sensitivity mask' to the group which
> would sensitize only those buttons that have a 1 in the mask,
> desensitizing the ones with a 0. WIDGET_CONTROL lets you
> desensitize and ENTIRE compound widget - what I want to do is
> to desensitize only selected buttons in the button group. I've
> looked at the CW_BGROUP and WIDGET_CONTROL documentation and
> don't see a way to do this. Presumably, one could monkey with
> the CW_BGROUP code and implement a SENSITIVE=[0,1,0,1,1] kind
> of keyword, but I am not eager to do that. Suggestions welcome!
> The workaround I have so far is to apply this mask in
> my event handler and simply ignore events that are insensitive.
> The down side of this is that the labels for those buttons are
> not dimmed, so the user does not have a visual indication that
> those buttons are inactive.
Use the "IDS" keyword to CW_BGroup to return the widget IDs of the
individual buttons in your group.
Here's a small chunk of code from the widget definition module of a recent
application:
asLabel = ['Display Current', 'Output Display', 'Display Mosaic', $
'Output All', 'Color ...', 'Output ...']
; button group for Display and Color selection
wBGCommand = CW_BGroup(wBaseL, asLabel, Row=3, /Frame, $
UValue=asLabel, IDs=awBGCommand)
; desensitize all but the Color and Output buttons.
FOR i = 0, 3 DO $
Widget_Control, awBGCommand(i), Sensitive=0
And here's the corresponding portion in the event handler:
; sensitize the appropriate command buttons
aPos = [0, 2, 3]
FOR i = 0, (N_Elements(aPos) - 1) DO $
Widget_Control, mInfo.awBGCommand(aPos(i)), Sensitive=1
--
Mike Schienle Interactive Visuals
mgs@la.znet.com http://la.znet.com/~mgs/
|
|
|
|