[comp.windows.x] XtCrtAppShell and resources

ajk@goanna.oz (Dr Alan Kent) (10/04/89)

Disclaimer: This is my first serious X program

I have written a program using the HP widgets. It accepts database queries
in an initial window then creates a new subwindow to view the results of
the query. You can have multiple subwindows with concurrent queries.

I use XtCreateApplicationShell("Tql", topLevelShellWidgetClass, NULL, 0);
which creates the new window fine, but I am having problems with loading
resources for this subwindow. If I create a form widget under the shell
widget, say called "retrieve", then I can do the following in .Xdefaults

	*retrieve*quit.label: Done

However, the following alternatives I cannot get to work (I have tried
lots of other combinations too, but I cannot remember them all).

	Tql*retrieve*quit.label: Done
	*Tql*retrieve*quit.label: Done
	Tql*quit.label: Done

Now the top level shell created by XtInitialize() works perfectly in
the way expected. What am I doing wrong?

I am using the standard distriubtion tape with the client running on
an Encore and the server running on a Sun 3/60 if it makes any difference.

Alan Kent
Dept Comp Sci, RMIT, Melb, Australia
ajk@goanna.cs.rmit.oz.au

swick@ATHENA.MIT.EDU (Ralph R. Swick) (10/04/89)

> I use XtCreateApplicationShell("Tql", topLevelShellWidgetClass, NULL, 0);

I assume you have Release 3 installed.  If so, the first argument is
ignored and the instance name of the created shell is the application
instance name you originally passed to XtInitialize().

The reason for this obscure behaviour is that in prototype versions
of Xt (i.e. prior to the adoption of the standard) there was an
additional level of resource name qualification to the left of
all widgets.  This extra level was the application instance name
and class.  So a pre-R3 program would have expected the resource
names in your example to be:

	myapp.Tql.retrieve.quit.label

In the standard Xt, there is no such extra level and so
XtCreateApplicationShell had to be modified in the way least
likely to break older programs.  We based the decision on
the assumption that most older resource specifications were
of the form 'myapp*.quit.label'.  That's why this routine
is in the "Compatibility" appendix of the standard.

You should use XtAppCreateShell instead, which will give you
the control you want.