Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!ico!auto-trol!marbru From: marbru@auto-trol.UUCP (Martin Brunecky) Newsgroups: comp.windows.x.motif Subject: Re: User settable resources in UIL Message-ID: <871@auto-trol.UUCP> Date: 9 Oct 90 01:40:47 GMT References: <8768@milton.u.washington.edu> Reply-To: marbru@auto-trol.UUCP (Martin Brunecky) Organization: Auto-trol Technology, Denver Lines: 61 In article <8768@milton.u.washington.edu> mattf@milton.u.washington.edu (Matthew Freedman) writes: >Nobody has responded yet to my question on user-settable resources in UIL, >but I have made a little progress myself. If anybody knows if there is >a good way of doing this, would you *please* tell me. > >Originally I asked... >> Does anybody know how to create new, user-settable resources which can be >> referenced from a UIL module? In particular, I have several distinct fonts >> and colors which I use in different widgets in my application. Right now they >> are defined in UIL, i.e. >> text_font : font('Adobe-New Century Schoolbook-Medium-R-Normal--12-*-*-*-*-*-*-*'); >> >> and in various arguments sections of objects I will say >> XmNfontList = text_font; >> >> The problem is that I need to make the fonts (and colors) >> user-settable at run-time. The obvious choice is to do so in a >> resource file, but the only way I can see to do this is to individually >a stupid hack, and there *must* be a better way (UIL could not be *that* >lame, could it?) It sure can .... I'v given up on UIL just about a year ago ... so there might be a way with UIL. Now, your description is not quite clear. If you want to have those things settable at RUNTIME, dynamically, than with UIL you are totally out of luck. Similarly with resource database. The only way to CHANGE widget once it has been created is XtSetValues. Period. [yeeeh, I am just working on something to make it easier, but it's not quite there] If by USER SETTABLE you mean that somewhere AT THE BEGINNING, before widgets are created, the user can choose colors and/or fonts, BEFORE those widgets get created, you can do it with Xrm resource database. You can load resource definitions into your resource database at any time - it's just a database (though a silly one). You can do XrmDatabase db = XtDatabase(display) followed by: XrmPutStringResource( db, "*button.foreground", "red" ); Note that if you want to get really fancy, you may allocate a writeable color cell, and say XrmPutResource( db, "*button.foreground", XtRPixel, (XrmValue*) &color_cell); so that the user can update such color dynamically .... Also note that you can put a list of resources to define with the mechanism above into the database as well, as an application resource ..... Just keep in mind that Xrm database is a database (may be a silly one, yeeeh-), and it only happens to be loaded automatically by the XtIntrinsics. You can query it, populate it, even replace with an empty one, if you wish. [ born to bash UIL ] -- =*= Opinions presented here are solely of my own and not those of Auto-trol =*= Martin Brunecky marbru@auto-trol.COM (303) 252-2499 {...}ncar!ico!auto-trol!marbru Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404