home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / fj / maillis / xwindow / 19020 < prev    next >
Encoding:
Internet Message Format  |  1992-12-31  |  2.4 KB

  1. Path: sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-tyo-news!scslwide!wsgw!wsservra!onoe
  2. From: rogerr@netcom.com (roger reynolds)
  3. Newsgroups: fj.mail-lists.x-window
  4. Subject: WCL/XRM question
  5. Message-ID: <1992Dec31.151411.18916@sm.sony.co.jp>
  6. Date: 31 Dec 92 15:14:11 GMT
  7. Sender: onoe@sm.sony.co.jp (Atsushi Onoe)
  8. Distribution: fj
  9. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  10. Lines: 60
  11. Approved: michael@sm.sony.co.jp
  12.  
  13. Date: 31 Dec 92 05:10:03 GMT
  14. Message-Id: <1992Dec31.051003.2980@netcom.com>
  15. Newsgroups: comp.windows.x,comp.windows.x.motif,comp.windows.x.intrinsics
  16. Sender: xpert-request@expo.lcs.mit.edu
  17.  
  18.  
  19.  
  20.     Ok, here's one for a true Xrm wizard...
  21.     
  22.     I would like to be able to use the X Resource Database to
  23.     store values for "objects" and "instances of objects" where
  24.     the objects are application defined things, i.e. not widgets.
  25.     (though they certainly contain widgets...)
  26.  
  27.     I have had a fair bit of success at the first part of this,
  28.     by defining a structure and then using XtGetApplicationResources
  29.     to fill in members of that structure.  This works swell for
  30.     an "instance" of an object, but I can't get my head around how
  31.     to define resources at the class level.
  32.  
  33.     For anybody who is still following this, perhaps a short example
  34.     to illustrate my question...
  35.  
  36.     Ok, lets say that I have defined a new Class called "Caption",
  37.     and have registered a constructor with WCL to be called when
  38.     an instance of a "Caption" is to be created. 
  39.     (Caption is a simple object which binds a label widget to some 
  40.     "work area" widget...)
  41.     In my constructor, I create a base widget manager of some type,
  42.     and a label and    a work area as its children, and return the base 
  43.     widget created.
  44.     Also in my constructor function, I use XtGetApplicationResources
  45.     to fetch the special resources that a Caption knows about.
  46.     Like I say, this all works fine.
  47.  
  48.     Using WCL, the resource file looks like this:
  49.  
  50.     foo.wcCreate: Caption
  51.     foo.labelString: My Caption Label
  52.     foo.workArea: form
  53.     form.wcCreate: XmForm
  54.     ...
  55.  
  56.  
  57.     Now what I'd like to be able to do, is create a class "Caption"
  58.     in the Resource Database that a user can use to set default 
  59.     Caption resources, but here I've had little luck.
  60.     The idea would be to be able to say things like :
  61.  
  62.     *Caption*XmLabel.alignment:XmALIGNMENT_CENTER
  63.  
  64.     and so on.
  65.  
  66.     
  67.     Any tips on how to attack this sort of thing, or ideas on what
  68.     to read or where to look for similar examples of Xrm usage
  69.     would be much appreciated...
  70.  
  71.     Thanks,
  72.     rogerr@netcom.com
  73.