Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!harrier.ukc.ac.uk!elder.ukc.ac.uk!rlh2 From: rlh2@ukc.ac.uk (R.L.Hesketh) Newsgroups: comp.windows.x Subject: Re: Wcl conceptual trouble Message-ID: <234@elder.ukc.ac.uk> Date: 4 Feb 91 09:47:56 GMT References: Reply-To: rlh2@ukc.ac.uk (Richard Hesketh) Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 47 In article jsparkes@bwdls49.bnr.ca (Jeff Sparkes) writes: > 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. If the OK button is a commandWidget then the callback is "callback". Callbacks can be passed the name of a widget as a string argument: *loadDialog.okButton.callback: load_file(*loadDialog.value) The load_file callback would be bound using: WcRegisterCallback(app, "load_file", load_file, NULL); and when called the client_data is a string "*loadDialog.value". This can be converted into the the Widget id using: void load_file(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { Widget id = WcFullNameToWidget(w, (char *)client_data); ... } > 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. Again you can pass the widget name as the client data. What would be useful is a GetValues interface for Wc which already has WcSetValuesCB() and WcSetValuesACT(). However to get an equivalent WcGetValuesCB() which would return a string when used in something like: fred.callback: do_something(WcGetValuesCB(*valueEntry.value)) the addition of TypeToString converters would be required for all the different application resource types. This would also be very useful for UI Builders etc but I fear we have missed the boat on this one. Richard