home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.windows.x:21602 comp.windows.x.intrinsics:802
- Path: sparky!uunet!ulowell!m2c!bu.edu!decwrl!csus.edu!netcom.com!richm
- From: richm@netcom.com (Richard Mauri)
- Newsgroups: comp.windows.x,comp.windows.x.intrinsics
- Subject: Using Xrm routines in widget code to provide persistence
- Message-ID: <1993Jan26.190404.6803@netcom.com>
- Date: 26 Jan 93 19:04:04 GMT
- Followup-To: poster
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Lines: 46
-
-
- The XJournal issue Jan-Feb 1993 has an article titled
- "Modifying user preferences". It deals with using the Xrm
- Xlib resource management routines to provide a facility
- for loading/saving resources to a user resource database.
-
- This seems like a good way for a custom widget of mine
- to be able to acquire persistence-like functionality.
- I'd like each instance of the widget to read/write a resource
- file and merge the results with those loaded by Xt.
- Maybe I could have a resource file named XtName(my_widget)
- and each time an instance of that name is created I could
- read this resource file and then merge the databases.
-
- Unfortunately I am having some dificulty , i.e, bus errors
- down under XrmPutFileDatabase(). It seems straight forward
- enough, but I am at a loss... Here's what I'm trying
-
- To read the resource file is: (No problems)
- a) db = XrmGetFileDatabase()
- b) iterate over all my resources using XrmGetResource()
- c) override the resources set by Xt in my Initialize()
- (This is a manual merge, I know.)
-
- To save the resource file: (Problems in XrmPutFileDatabase)
- a) db2 = XrmGetStringdatabase("")
- b) iterate over all my resources using XrmPutLineStringResource() into db2
- c) Use XrmPutFileDatabase(dp2, path_to_my_resource_file)
- d) Should I XrmDestroyDatabase(db2)
-
- Does anyone know:
- 1. Where the source to this Xjournal article is.
- I've checkes export and uunet and only jan 92 is available.
- 2. Where I could get some examples of this
- 3. Better way to provide persistence using the resource mechanism
- with respect to having a widget be able to get/save it's
- custom resources.
- 4. If I'm totally clueless
-
- Thanks, Rich
- --
- Richard Mauri
- Software Engineer/Boardhead
- Trimble Navigation Ltd.
- email: richard_mauri@Trimble.com
- email: richm@netcom.com
-