[comp.windows.x.motif] Updating MessageDialog when something happen in other widgets

leekin@kira.msu.edu (Edwin Lee) (04/29/91)

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?

1. Use Global pointer point to the message to be displayed, then when
certain button is pressed, the pointer is updated, and the ExposeCallback
in MessageDialog would reset the MessageString and redisplay the new message.
< Not sure if reseting XmNmessageString would do it>

2. Use XtCallCallbacks in the activate callback of pushbuttons, to pass
the message and execute the  expose callback in MessageDialog, which 
produce a new message using the data passed.
< Not sure I can pass the message pointer in call_data, and I suppose
the MessageDialog should be made known to the pushbuttons somehow>

On top of this, if I extend the message display to dialog box in general
(e.g. one with Text, PushButton, List Wigets) and I like the same dialog
box to be sensitive to the state of applications, how is this done in
a nice and clean fashion?

May be too many questions in one shot, but there is a common point among
this questions - how one widget inform the others about its state and
the others can respond to this "message".

Thanks in advance,

================================================================================
         Imagine that Cray computer decides to make a personal computer.  It has
  O   O  a 150 MHz processor, 200 megabytes of RAM, 1500 megabytes of disk
    o    storage, a screen resolution of 1024 x 1024 pixels, relies entirely on
   ___   voice recognition for input, fits in your shirt pocket and costs $300.
    U    What's the first question that the computer community asks?
	 "Is it PC compatible?" - a clip from fortune

 leekin@egr.msu.edu |  uunet!frith!leekin  |  leekin@msuegr.bitnet
================================================================================

dvb@emisle.uucp (David Van Beveren) (05/02/91)

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