[comp.windows.x.motif] Question about using UIL and resources in .Xdefaults file.

cpetterb@glacier.sim.es.com (Cary Petterborg) (05/15/91)

This is probably a stupid, over-asked question, but...

We are using UIL to create applications.  Is there a way to get the
.Xdefaults resources to be used in the application instead of the
UIL hardcoded stuff?  We are unable to get the application to use
the resources to override the UIL values.

Thanks in advance,

Cary
--
_______________
Cary Petterborg					   (801)582-5847 x6446
Evans & Sutherland Computer Corp.  Simulation Division   SLC, UT 84108
UUCP: ...!uunet!sim.es.com!cpetterb  *NET: cpetterb@glacier.sim.es.com
_______________
   "A heart is not judged by how much you love, but by how much you
   are loved by others."  -Wizard of Oz

meeks@osf.org (W. Scott Meeks) (05/16/91)

>Date: 15 May 91 18:57:59 GMT
>From: orca!javelin.sim.es.com!glacier!cpetterb@uunet.uu.net  (Cary Petterborg)
>
>This is probably a stupid, over-asked question, but...

Actually, it's neither; this is the first time I've seen it asked in quite
a while (of course, now that you've pointed it out, everyone will want one)
and it's definitely a potential problem when using UIL.

>We are using UIL to create applications.  Is there a way to get the
>.Xdefaults resources to be used in the application instead of the
>UIL hardcoded stuff?  We are unable to get the application to use
>the resources to override the UIL values.

In general, the way UIL works is to take the resources specified in the
arguments list as the args to the create function, overriding the values
specified for these resources in the defaults file.  There are a few ways
to work around this, only one of which is somewhat satisfactory. 

 First, your could access the defaults file yourself, using the existing
Xrm functions and then using either XtSetValues or MrmFetchWidgetOverride
to override the values set in UIL.  This, of course, is an awful lot of
work and probably not something you really want to do.

The somewhat satisfactory answer is, for those resources you want the user
to be able to set in a defaults file, don't set them in the Uil file.  If
you want your own defaults in case the user doesn't specify some of the
resources, then set those defaults in an app-defaults file.

Having Uil interoperate with defaults files has been on the wishlist for a
while, but it just hasn't made the cut yet.  If a lot of people think this
is absolutely vital, let us (OSF) know.

BTW, to save net bandwidth, Martin Brunecky 
(auto-trol!server_1!marbru@sunpeaks.Central.Sun.COM) would usually respond
to a message of this sort with a message bashing UIL and describing how
great WCL (Widget Creation Library, let's you specify widget hierarchies in
defaults files) is.  Actually, this is one particular case where WCL does
do a better job.  If you want hear why WCL is so much better than UIL, send
mail to Martin.  If you want to hear how UIL is better than WCL, send mail
to me.

Hope this helps.

W. Scott Meeks           | We must live with the fact, true throughout recorded
Open Software Foundation | history, that our artifacts are sometimes flawed and
meeks@osf.org            | cause us to die in novel and unexpected ways, and we
(617) 621-7229           | can only do our human best to minimize the problems.
 

marbru@auto-trol.com (Martin Brunecky) (05/21/91)

In article <CPETTERB.91May15145759@mickey.glacier.sim.es.com> cpetterb@glacier.sim.es.com (Cary Petterborg) writes:
>
>We are using UIL to create applications.  Is there a way to get the
>.Xdefaults resources to be used in the application instead of the
>UIL hardcoded stuff?  We are unable to get the application to use
>the resources to override the UIL values.
>
    First if all, don't munge your application resources into .Xdefaults.
    Not that it won't work, but it's just a bad practice - everybody
    dumping everything into .XDefaults. Plus, your application is most
    likely getting .Xdefaults as a server RESOURCES property - probbably
    the least efficient way to get it.
    So, keep your .Xdefaults small, and use app-defaults, application class
    specific resource files.

    Next. Sure you can use resources with UIL. However, you can NOT override
    resource values in UIL/UID file with resources in resource file.
    In resource files, you can only specify what is NOT in UIL, because the
    resource fetch order / override is as follows:
    - widget class default
    - resources from Xrm resource databse ( tight bindings first, loose next)
    - arguments to widget creation, in UIL case values specified in UIL/UID fil

   So, whatever you define in your UIL file wins.



-- 
=*= Opinions presented here are solely of my own and not those of Auto-trol =*=
Martin Brunecky                      marbru%auto-trol@sunpeaks.central.sun.com
(303) 252-2499                       (better avoid:  marbru@auto-trol.COM )
Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404