[comp.windows.x] Restricting or "greying out" menu items

jmellby@m2.csc.ti.com (John Mellby) (01/05/91)

	We want to build a menu application in X11R4/Motif 1.0.3 (soon
to be Motif 1.1) that has the 'grey out' functionality in the menus.
I.E. We want to build a menu, and depending upon the state of the application,
prevent the user from selecting some of the menu items.
	Some of this could feasibly be done through mwm, but generally
we  can't use the f.nop of Mwm because these temporary windows aren't 
controlled by Mwm.
	I know how to do this through creating the menus using pushbuttons 
when selectable and labels (in a different font) when not.  However, I don't
want to create a new menu with different widgets each time the selectivity of
a command changes. Could I use the same menu widget switching sub-widgets
between displays?  How?
	Could I work within the pushbuttons, ie change the font of the label 
and change the callback function, then re-realize the menu on demand? This 
seems the best solution to me at present.
	Is there some easy way to do this I don't know about?

Dave Beck
beck@flopn2.ti.com
 or
John R. Mellby                       Texas Instruments
jmellby@skvax1.ti.com                P.O.Box 869305, MS 8513
                                     Plano,  Texas, 75086
(214)517-5370                       (214)575-6774 (work)

mschedlb@hawk.ulowell.edu (Martin J. Schedlbauer) (01/06/91)

In article <1991Jan4.193714.19947@csc.ti.com> jmellby@m2.csc.ti.com (John Mellby) writes:
>
>	We want to build a menu application in X11R4/Motif 1.0.3 (soon
>to be Motif 1.1) that has the 'grey out' functionality in the menus.
>I.E. We want to build a menu, and depending upon the state of the application,
>prevent the user from selecting some of the menu items.

The XmLabel widget has the XmNsensitive resource. If set to true it will
display the XmNlabeString "grayed out" and it won't activate the button.
To set the sensitivity via the application state, you should keep the
widget ID of the button around (ie. use MrmNcreateCallback if UIL) and
change the XmNsensitive resource using XtSetArg/XtSetValues.

	...Martin


Martin Schedlbauer				(mschedlb@ulowell.edu)
Institute for Visualization and Perception Research
Department of Computer Science
University of Lowell, Lowell, MA 01854		(Tel: (508) 934-3612)