home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / x / 20659 < prev    next >
Encoding:
Internet Message Format  |  1992-12-31  |  2.3 KB

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