[comp.windows.x] widgets and their names

plunge@BULLWINKLE.UNM.EDU (stephanie hallett-U) (07/09/89)

Hello,

We are writing a large application which is using X11R3.  We are using
the Athena widgets and the Xtoolkit (Xaw and Xt).  The type of machines
we are writing under are PMAX, SUN3 and VAX.

We are trying to create a program which stores certain events for widgets
in a journal.  The journal can then be used by other users to see
what the "instructor" had done.  We would like to do this by storing
the widgets full name along with the event, and then retrieve the widget
from that name later on.

We know that there are proposals event playback, but we want to be
able to use the journal to perform the same process on different
data sets.

The two questions we have are:

1)   Given a widget, how do you get the full xrm resource name.

2)   Given the full xrm resource name, how do you get the widget.
NOTE:  We tried using XtNameToWidget(root,name), but during playback
we do not have access to all root (toplevel) widgets.

thanks in advance
stephanie

please respond directly to me at the following e-mail address
plunge@bullwinkle.unm.edu

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (07/26/89)

> We know that there are proposals event playback, but we want to be
> able to use the journal to perform the same process on different
> data sets.

> The two questions we have are:

> 1)   Given a widget, how do you get the full xrm resource name.

Make recursive calls to XtParent until it returns NULL.  This will give you
every widget parent of this widget.  Getting the names of each of these widgets
is tough, in R3 the only way to do it is to look at widget->core.name, in R4
there will be a public routine that will return the name of a widget.

> 2)   Given the full xrm resource name, how do you get the widget.
> NOTE:  We tried using XtNameToWidget(root,name), but during playback
> we do not have access to all root (toplevel) widgets.

Your idea is the right one, but you will need at least one widget in the tree,
since widget names need not be unique.  Think about multiple invocations of the
program on the same display, this is certainly allowed, and the widget names
are all the same.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213