Newsgroups: comp.windows.x.motif Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!rochester!kodak!ispd-newsserver!ism.isc.com!emisle!dvb From: dvb@emisle.uucp (David Van Beveren) Subject: Re: Updating MessageDialog when something happen in other widgets Message-ID: <1991May2.044837.7776@emisle.uucp> Reply-To: dvb@emisle.UUCP (David Van Beveren) Organization: Emerald Isle Systems, Ltd. Agoura Hills, CA References: <1991Apr29.161723.15414@msuinfo.cl.msu.edu> Date: Thu, 2 May 91 04:48:37 GMT Lines: 38 In article <1991Apr29.161723.15414@msuinfo.cl.msu.edu> leekin@kira.msu.edu (Edwin Lee) writes: >I am using MessageDialog to display help messages, I like to make the >content sensitive to the buttons selected in other widgets within the >same application. What is the best way of doing it? My solution to this exact problem was as follows: 1. A 'Screen Object' is a widget plus a few other things. It has methods for initializing its instances and its class. It has resources above and beyond the resources stored in the widget. (The widget ID is a resource) A resource of every object is its name. There is a corresponding function, NameToObject to get the object handle given the name. 2. One of the objects is the form. This is a bulletin board widget plus. One of its resources is its help object, which is the name of the object that gets the help message displayed (it is a label object). A function exists that, passed two objects, one a form and the other a primitive ( i.e. a text field, a button, etc), displays the help message for the primitive in the help object of the form. The help message is a resource for the primitive object. 3. Every primitive object has an event handler for its focusin. Widget. This handler calls the help-update function defined above, passing its form-parent and itself as parameters. When focusIn is generated for this object, the help message is displayed in the help object, if that resource is defined. If not, blank is displayed. This may or may not help you. I admit it may seem too complicated, but this is just one part of a larger application, all designed around this idea of objects. It looks much like Xt, which is where many of the ideas came from. Instead of windows, we have widgets. 2. -- David Van Beveren INTERNET: emisle!dvb@ism.isc.com EIS ltd. Professional Software Services UUCP: ..uunet!emisle!dvb voice: (818) 587-1247