[comp.windows.x] Default init values of widgets

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (02/02/90)

> Is there a way  to setup the default font, cursor, foreground
> background,... that widgets will look for when they get created?

Yes, using one line in you app-defaults file for each resource.

e.g

Application*Foreground:		green

This will reset the default forground color to green.

> For example I would like all my widgets to have the same color
> background, or font,... which is not the one that is the
> current default ; Right now I have to specify quite a lot
> of things again and again...

If you are using XtSetValues(), or an argument list at creation time then
you are not setting new defaults, you are forcing the user to use the colors you
have specified.

> NOTE that I want to do this with a 'C' call or assignment
> within application and  not by specifying it at prompt level
> or by using the ressource manager.

Too bad.  The Xt Intrinsics provide no way to do this, and if I have a
my way they never will, this type of thing is handled just fine through the
resource manager.

> Also I having problem setting up the icon of my toplevel widget
> (i.e I don't get an icon or icon name) after doing:

> n=0;	XtSetArg(arg[n], XtNiconName, "HELLO"); n += 1;  
> 	XtSetArg(arg[n], XtNiconPixmap,icon); n += 1; 
> 	XtSetArg(arg[n], XtNoverrideRedirect, True); n += 1;
> 	XtSetValues(toplevel,arg,n);

Override redirect windows are ignored by the window manager, therefore will not
have an icon, are you sure you want an Override redirect window?  I suspect that
you don't.

						Chris D. Peterson     
						MIT X Consortium 

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

swick@ATHENA.MIT.EDU (Ralph R. Swick) (02/02/90)

> Is there a way  to setup the default font, cursor, foreground
> background,... that widgets will look for when they get created?
...
> NOTE that I want to do this with a 'C' call or assignment
> within application and  not by specifying it at prompt level
> or by using the ressource manager.

The words "default ... that widgets will look for" and "not by
using the resource manager" don't go together at all.  One way
or another, the resource database has to be involved.  If you
really want to make calls, you can use the Xrm routines in
Xlib to modify the resource database before loading "non-defaults"
and creating widgets.  In R4, the routine XtAppSetFallbackResources
might help you with whatever it is you're trying to do.

> Also I having problem setting up the icon of my toplevel widget
>	XtSetArg(arg[n], XtNoverrideRedirect, True); n += 1;

What window manager are you using?  Most will ignore properties
on override_redirect windows.

ben@hpcvlx.cv.hp.com (Benjamin Ellsworth) (02/02/90)

> Is there a way  to setup the default font, cursor, foreground
> background,... that widgets will look for when they get created?
> 
> ...
> NOTE that I want to do this with a 'C' call or assignment
> within application and  not by specifying it at prompt level
> or by using the ressource manager.

Well you can do it with C calls but probably not without using the 
resource manager.  You need to put the resources into the resource 
database that the widget initialization code looks at.  I don't have 
all of the particulars in front of me (and they just changed with R4), 
but if you'll dig around in the Xt sources it should be fairly easy (I 
did it in the R2 days).

If R4 Xt has squirreled that database away to the point that it is
inaccessible without changing the R4 Xt source, then I think that we
have a bug in the R4 Xt Intrinsics.  I think that the application ought
to be able to attach information directly to the resource database as
it sees fit.

-----------------------------------------------------------------------
Benjamin Ellsworth      | ben@cv.hp.com                | INTERNET
Hewlett-Packard Company | {backbone}!hplabs!hp-pcd!ben | UUCP
1000 N.E. Circle        | (USA) (503) 750-4980         | FAX
Corvallis, OR 97330     | (USA) (503) 757-2000         | VOICE
-----------------------------------------------------------------------
                     All relevant disclaimers apply.
-----------------------------------------------------------------------