Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!amdcad!dgcad!dg-rtp!wgate!lanzo From: lanzo@wgate.UUCP (Mark Lanzo) Newsgroups: comp.windows.x.motif Subject: Re: Can I disable buttons on an XmMessageBox widget? Summary: Yes, very easily. Message-ID: <194@atesysv.UUCP> Date: 13 Jun 91 13:14:09 GMT References: <500@tymix.Tymnet.COM> Reply-To: lanzo@atesysv.UUCP (Mark Lanzo) Organization: Wandel & Goltermann Technologies, Inc. Lines: 51 In a prior article steve@gabriela.Tymnet.COM (Steve Sandke) wrote: SS> I'd like to "turn off" some of the buttons (Help, for example) SS> on an XmMessageBox widget. Simply greying them out would be enough. SS> I know how to do this for a widget, but I don't have an actual widget SS> for the buttons. XmMessageBoxGetChild() will return the actual widgets for the buttons. For instance, to get rid of the help button: XtUnmanageChild(XmMessageBoxGetChild(msgbox,XmDIALOG_HELP_BUTTON)); The components you can request are: XmDIALOG_CANCEL_BUTTON XmDIALOG_DEFAULT_BUTTON XmDIALOG_HELP_BUTTON XmDIALOG_MESSAGE_LABEL XmDIALOG_OK_BUTTON XmDIALOG_SEPARATOR XmDIALOG_SYMBOL_LABEL CAUTION: I believe that some of these components are actually implemented as gadgets rather than widgets. Some operations you may want to do may be illegal. For example, you may not be able to specify a background color for the label. -- Mark -- -------------------------------------------------------------------------- ASIDE: This isn't really related to the subject thread, but my warning above reminds me of a quibble I have with Motif - It seems to me that certain logical operations should transparently work on either widgets or gadgets, without the programmer having to know which class of object he is dealing with. For example, if you want to know the state of a toggle button widget, you need to use the function XmToggleButttonGetState(). If on the other hand you have a toggle button *gadget*, you must call XmToggleButtonGadgetGetState(). It seems to me that XmToggleButtonGetState should work for both the widget and the gadget. I got bitten by this one a while back when I modified a lot of code to use gadgets instead of widgets. I spent a lot of time scratching my head wondering why things didn't work until I discovered that I was still using the widget "GetState" routine. It hadn't even occurred to me that the gadget was not an essentially transparent replacement for the widget. So what's everyone else's opinion on this?