Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!rutgers!ucsd!ucbvax!decwrl!asente From: asente@decwrl.dec.com (Paul Asente) Newsgroups: comp.windows.x Subject: Re: Clarification of "passing widget args to subwidgets" Message-ID: <785@bacchus.dec.com> Date: 17 Sep 88 00:56:48 GMT References: <5681@pasteur.Berkeley.EDU> Organization: DEC Western Software Lab Lines: 29 In article <5681@pasteur.Berkeley.EDU> dheller@cory.Berkeley.EDU (Dan Heller) writes: >The question at hand is: how do you call XtCreate[..]Widget() and >pass XtN... parameters that are intended for "sub"-widgets within >the widget, not intended for the widget itself that you're creating. Well, this is going to be complicated, so have your toolkit manual ready... First, the parent widget must be prepared for this; i.e. it must be written to expect it. The subwidgets don't have to do anything. One sentence answer: use Xt{Get,Set}Subresources in the parent widget's initialize_hook, set_values_hook, and get_values_hook procedures. More verbose answer: the toolkit will happily allow resources in the arg list that do not apply to the widget you're creating/set valuesing/get valuesing. It just ignores them. So, you can specify resources for any of the subwidgets that are not the same as resources for the parent widget, and the parent widget never notices the difference. The intrinsics will call the initialize_hook procedure after it calls the initialize procedure, and will pass the initialize_hook procedure the args that were passed in. You then call XtSetSubresources with these args, passing the subwidget as the base parameter and the subwidget's resource list as the resources. You do set_values and get_values analagously. The key is that all the widgets must have separately named resources; otherwise you can't tell just what widget the resource is specified for. -paul asente asente@decwrl.dec.com decwrl!asente