Path: utzoo!attcan!uunet!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!dali.cs.montana.edu!milton!mattf From: mattf@milton.u.washington.edu (Matthew Freedman) Newsgroups: comp.windows.x.motif Subject: User settable resources in UIL Message-ID: <8768@milton.u.washington.edu> Date: 8 Oct 90 16:58:02 GMT Organization: University of Washington, Seattle Lines: 56 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 > specify the fontList resource for each and every widget or widget-class > which used a certain font. I would much rather create a new resource > called textFont, and allow the user to specify a value for that, and > have my uil-defined widgets use it as needed. > > If I was building the interface directly in C without UIL, I know I could > use an XtResource array and XtGetApplicationResources to define new > resource names, but how can I export those to uil-defined widgets? > > This is very important, because the application needs to run well on a > variety of different displays, and some of them seem to have radically > different font sizes and names available. I also need to do the same > with colors so that the application will look decent in monochrome as > well as color. Upon further research, I discovered that the man page for MrmRegisterNames says that the names registered can not only refer to callback functions, but to "pointers to user-defined data, or any other values". That sounds like the perfect solution -- create new font and color resources normally, through Xt, then register them with UIL via MrmRegisterNames, right? Well I tried this in several variations, but I can not get UIL to find the value. The 'exported' declaration-modifier apparently causes UIL to look in the other UID files, but nowhere else. How do you get UIL to accept values other than callback names via MrmRegisterNames??? The only solution I have come up with would be to add a pair of new creation callbacks, called setFont() and setColor() to each widget which needs a user-settable font or color, and have those callbacks get the appropriate values as Xt resources, and use XtSetValues to change the widgets as they are created. This ought to work, but it is obviously a stupid hack, and there *must* be a better way (UIL could not be *that* lame, could it?) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- = Matthew M. Freedman = = U. of Washington Information Systems mattf@cac.washington.edu = = 4545 15th Ave. NE; 4th Floor (206) 543-5593 = = Seattle, WA 98105 = -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-