Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!noao!ncar!ico!attc!marbru From: marbru@attc.UUCP (Martin Brunecky) Newsgroups: comp.windows.x Subject: Re: Wcl conceptual trouble Message-ID: <1038@attc.UUCP> Date: 4 Feb 91 16:49:31 GMT References: Reply-To: marbru@auto-trol.UUCP (Martin Brunecky) Organization: Auto-trol Technology, Denver Lines: 62 In article jsparkes@bwdls49.bnr.ca (Jeff Sparkes) writes: > > I'm having a problem with Wcl thats a bit um, difficult to work around. > There are two instances of the problem; I'll start with the simpler > one first. > > Wcl programming is done on a callback basis, right? The problem is >that an Xaw dialog has no callback. What I really want to do is have a >callback in the OK button which says "call callback X with the value of the >text field". It would probably be useful in some cases to specify the >"src" widget for the callback. > This is more generally applicable too. I have a list widget in >which I select a field; then a command button is clicked which wants to call >a callback with the value of the list widget. > This seems to require a change in Wcl, to add a function to get the >value of a widget. This would be something like WcRegisterValueFunction(). > > Or have I missed something obvious? > May be. First of all, Wcl does NOT try to do EVERYTHING. It does provide lots of convenience callbacks for frequently used operations (in my opinion just one more would be too many). It does NOT intend to give you (and everyone else) everything. It DOES show you HOW to write your own, special callbacks and/or action routines. It does NOT write your application for you. So, in your particular case, when you can identify your button by the instance name ( *dialog_box.button ), you can attach to it your very OWN, very specific callback: CallCallbackWithTextCB ( callback_name, text_widget_name ) Inside of this callback, you can call XtDirectConvert to translate callback_name into a callback list (callback list structure is public, you can use it to call the callback, or you may use XtCallCallbackList). You can also translate the tex_widget_name into widget ID (Either using XtNameToWidget OR the Wcl's enhanced functions, see WcName.c), querry the text, and THEN use XtCallCallbackList or simply call the callback directly. Note that at LEAST the Text widget querry is VERY widget set SPECIFIC. Also, your need(s) is(are) somewhat specific. Indeed, it is a very good idea: writing callback that can call another (already existing callbacks) by name. I am doing similar things ( callbacks activated when rubberbanding starts set-up the callback to activate when ribberbanding ends...). However, Wcl tries to be KISS and Widget Set INDEPENDENT. Provide the basic support needed by EVERYBODY, but NOT overwhelming Wcl users with hundreds callbacks most of which will be specific to a particular application. That should explain WHY a direct suppoprt for your callback should NEVER be part of Wcl. Though, indeed, it IS a good idea. -- =*= 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