Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!rpi!ispd-newsserver!ism.isc.com!ico!attc!marbru From: marbru@attc.UUCP (Martin Brunecky) Newsgroups: comp.windows.x Subject: Re: A question on Form widgets ... on motif. Message-ID: <1035@attc.UUCP> Date: 3 Feb 91 16:17:25 GMT References: <1991Feb1.235040.14018@msuinfo.cl.msu.edu> <1991Feb02.183100.8367@convex.com> Reply-To: marbru@auto-trol.UUCP (Martin Brunecky) Distribution: usa Organization: Auto-trol Technology, Denver Lines: 45 In article <1991Feb02.183100.8367@convex.com> gstiehl@convex.com writes: >In article <1991Feb1.235040.14018@msuinfo.cl.msu.edu>, veerabad@buster.cps.msu.edu (Vibhu Veerabadrappa) writes: >> >> I had a problem using the form widget class: >> >> I created a form widget as a child of the root widget. Under this >> form widget, I created some pushbutton widgets as children, and I >> tried to space them using the resource file. Specifically, I tried... >> >> But if I try to specify the position wrt a widget, like: >> >> *sep1.topAttachment: attach_widget <--- to attach to a widget >> *sep1.topWidget: quit_button <--- name of the already created widget, > >the topWidget resource is expecting a widget ID. So, if you wanted to >set it in a resource file, you would have to convert the string >"quit_button" to a widget ID. You could do this in a converter >routine, provided you have created the "quit_button" widget before >you created the "sep1" widget. And you have kept track all possible widgets >names and IDs. It is unfortunate (but understandable) that the form widget >doesn't attach to widgets by name. Understandable ??? - just a design flaw to be corrected during widget evolution .... The Wcl library included a StringToWidget resource converter, designed exactly for what you want to do, with the Only limitation that the widget must exist (i.e. be created before). There are some situations where you seem to need to reference a widget BEFORE it has been created. You can't do it. The ONLY solution in situations like that is to postpone initialization of such a resource UNTIL a particular widget is created. Using Wcl (again), uou can attach (a set of) callbacks to the creation callback, and let those callbacks set the widget ID into appropriate resources of OTHER widgets. -- =*= Opinions presented here are solely of my own and not those of Auto-trol =*= Martin Brunecky {...}sunpeaks!auto-trol!marbru (303) 252-2499 (sometimes also: marbru@auto-trol.COM ) Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404