ISSLCK@NUSVM.BITNET (Law Chee Keong) (05/04/88)
I have a question regarding the X Toolkit. Let's say I want to make a group of widgets share some common resources, like Fonts and Colors and so forth. The Toolkit's Resource Manager takes care of that with the XtC resource classes. Now, suppose I do not know which resources a group of widgets will share until run-time, how can I dynamically specify widget resource sharing through the Toolkit, or is such a facility supplied? This problem crops up when I allow users to interactively group widgets together, and then allow the user to key in the resources the widgets are to share. Right now, it seems the X Toolkit does not cater for this. Anyone has suggestions?? -C.K. Law ISS-NUS Singapore
haynes@WSL.DEC.COM (05/05/88)
Actually resource sharing is done on a much broader basis than simply the XtC resource classes. All resources are cached and shared if possible. This means you do not need to do anything special to get dynamic resource sharing, as long as you are using the resource manager to obtain your resources. -- Charles
diamant@hpfclp.SDE.HP.COM (John Diamant) (05/08/88)
> From: ISSLCK@NUSVM.BITNET (Law Chee Keong) > > Now, suppose I do not know which resources a group of widgets will > share until run-time, how can I dynamically specify widget resource > sharing through the Toolkit, or is such a facility supplied? > > From: haynes@WSL.DEC.COM > > This means you do not need to do anything special to get > dynamic resource sharing, as long as you are using the resource manager > to obtain your resources. Charles, I think he was asking a slightly different question than you answered. I believe the problem is that he wants the user to be able to specify what widget resources have particular names so that they may be shared (if they use the same name). I may be wrong about this interpration, but it is what I think is being asked. If my assessment of the question is correct, then it is a property of the specific widgets being used. There is no reason that widgets could not look up their resources strings dynamically from some global data structure if that is what were desired, rather than using hard-coded strings as they normally are (XtN and XtC). However, that means the widget initialization procedure would require some global variables to be around in which to find the resource names and classes. This would be a great burden to place on the programmers using the widgets, and it also breaks the object oriented model (not that it would be the first time), but it is possible. John Diamant Software Development Environments Hewlett-Packard Co. ARPA Internet: diamant@hpfclp.sde.hp.com Fort Collins, CO UUCP: {hplabs,hpfcla}!hpfclp!diamant