[comp.windows.x] Setting resources for appl_shell_widget via .Xdefaults

aw@macbeth.cs.duke.edu (Angus Wang) (04/21/89)

I am having a problem getting the resources specified in my
.Xdefaults to affect my programs.  Here's my situation....

I wrote an editor program called SigEd that is a simple text editor
and intantiated with :

    toplevel = XtInitialize("main", "vaedit", NULL, 0, &argc, argv);
    display_id = XOpenDisplay(NULL);

One of the callbacks from a command widget displays a dialog box to
ask for the file name. It's created as a topLevelShell widget as :

    XtSetArg(args[0], XtNx, 300);
    XtSetArg(args[1], XtNy, 200);
    XtSetArg(args[2], XtNwidth, 400);
    XtSetArg(args[3], XtNborderWidth, (XtArgVal) 8);
    XtSetArg(args[4], XtNheight, (XtArgVal) 150);
    topshell = XtCreateApplicationShell("topshell", topLevelShellWidgetClass,
                                        args, 5);

In my .Xdefaults file I have :

    SigEd*TopLevelShell*Geometry: 200x100+200+300
    SigEd*Geometry:         535x350+300+100

I have tried several differnt things but the dialog box(topLevelShell)
always comes up as big as the text editor window. I want to make it
pop up smaller.  I'v tried (in .Xdefaults) :

    SigEd.TopLevelShell*Geometry: 200x100+200+300

    SigEd*topshell*Geometry: 200x100+200+300

    SigEd*Topshell*Geometry: 200x100+200+300

but none seem to work.

From using xlswins, xdpyinfo, xwininfo & xprop it appears that since the
dialog box is a topLevelShell widget, it assumes the name of the
original application (in this case SigEd) and does not take on any
sub-names.  Is this deduction correct?

Is there any way to change the dialog appliocation shell to another
name so the it'll work?

Thanks for any advice.
   Angus
Department of Computer Science, Duke University, Durham, NC 27706
	UUCP :  decvax!duke!aw 	  CSNET:  aw@duke 
	ARPA :  aw@cs.duke.edu

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/25/89)

[ macbeth!aw@cs.duke.edu (Angus Wang) writes: ]

>     toplevel = XtInitialize("main", "vaedit", NULL, 0, &argc, argv);
>    display_id = XOpenDisplay(NULL);

This won't work correctly. Do this:

    toplevel = XtInitialize("main", "vaedit", NULL, 0, &argc, argv);
    display_id = XtDisplay(toplevel);

> I have tried several differnt things but the dialog box(topLevelShell)
> always comes up as big as the text editor window. I want to make it
> pop up smaller.  I'v tried (in .Xdefaults) :

If you specify an arguement list to a widget or use XtSetValues() these
values always override the resource values.  Thus you cannot set anything
from a resource file.  If you remove the arg list and give your default 
sizes from a app-defaults file you should be able to override them from
a personal resource file.  

This is why you should use an app-defaults file instead of hard coding
in values with arg lists.

                                                Chris D. Peterson
                                                MIT X Consortium