Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!uwvax!rennet.cs.wisc.edu!stuart From: stuart@rennet.cs.wisc.edu (Stuart Friedberg) Newsgroups: comp.windows.x Subject: Dynamically Replacing Widget Translations Message-ID: <6892@spool.cs.wisc.edu> Date: 18 Dec 88 02:46:52 GMT Sender: news@spool.cs.wisc.edu Reply-To: stuart@rennet.cs.wisc.edu (Stuart Friedberg) Distribution: na Organization: U of Wisconsin CS Dept Lines: 47 I started to make a Toggle widget as a subclass of Command using state-sensitive translation tables, rather than state-sensitive actions. I intended to compile two translation tables during ClassInitialize, record them in the subclass's ToggleClassPart, and install them in the widget instance's CorePart on the fly. Then I discovered I didn't know how to completely replace a translation table. A CorePart TMRec is more than an XtTranslations, which is what the translation compiler returns. Question 1a: Am I attempting something against the spirit of X or the Athena Toolkit? Question 1b: If so, what is an approach in the approved spirit to provide state-sensitive behavior? Poking around the R3 Xt/TMstate.c, it seems that the common code to XtOverrideTranslations and XtAugmentTranslations does what I want, namely if (XtIsRealized(widget)) { XtUninstallTranslations(widget); ((WindowObj)widget)->win_obj.tm.translations = newTable; _XtBindActions(widget, &((WindowObj)widget)->win_obj.tm, 0); _XtInstallTranslations(widget, newTable); } else ((WindowObj)widget)->win_obj.tm.translations = newTable; Question 2a: Is there more to it than that? Question 2b: If not, wouldn't this be a good candidate for encapsulation as a new public function: _XtReplaceTranslations? Looking back into the R2 sources, which are what I am running now, XtUninstallTranslations doesn't exist, and _XtInstallTranslations is never used. Question 3a: Can Core be substituted safely for WindowObj? Question 3b: Can the R3 code for XtUninstallTranslations be used in R2? Question 3c: With those substitutions, will the R3 solution work in R2? Question 3d: If not, is it all practical to attempt tm table replacement in R2? Finally and somewhat peripherally, Question 4a: Is the Core => Object + RectObj + WindowObj split complete? Question 4b: Where can I find the documentation about it (purpose, proposed new subclasses of Object and RectObj, etc)? Stu Friedberg stuart@cs.wisc.edu