[comp.windows.x] intercepting a call to XtAddCallback

jcarson@moniz.bcm.tmc.edu (Janet Carson) (11/07/89)

I am writing a widget which is essentially a "wrapper" around
several subwidgets.  By using intialize_hook and set_values_hook, 
I pass the arguments for "my widget" on to the subwidget which
"really" wants them.  However, I have a problem with callbacks.  

If the user passes the callback to my widget during XtCreateWidget, 
I can pass the callback on to the proper subwidget during
initialize_hook.  If the user tries to add the callback later with 
XtAddCallback, my widget doesn't seem to get notified, and my test 
program gets a message "Cannot find callback list."

Is there any way for a widget to intercept a call to XtAddCallback
and re-direct it to another widget?

Janet L. Carson                               internet: jcarson@bcm.tmc.edu 
Baylor College of Medicine              uucp: {rutgers,mailrus}!bcm!jcarson

swick@ATHENA.MIT.EDU (Ralph R. Swick) (11/07/89)

> Is there any way for a widget to intercept a call to XtAddCallback
> and re-direct it to another widget?

No, but you can declare your own callback procedure to (re-)
invoke your own callback list(s) and register this procedure on the
other widget.  This effectively wraps the (child) callback list.

mayer@hplabsz.HPL.HP.COM (Niels Mayer) (11/08/89)

In article <1792@gazette.bcm.tmc.edu> jcarson@moniz.bcm.tmc.edu (Janet Carson) writes:
>I am writing a widget which is essentially a "wrapper" around
>several subwidgets.  By using intialize_hook and set_values_hook, 
>I pass the arguments for "my widget" on to the subwidget which
>"really" wants them.  However, I have a problem with callbacks.  
> ...
>Is there any way for a widget to intercept a call to XtAddCallback
>and re-direct it to another widget?

Take a look at the implementation of the Motif RowColumn manager. If you
specify an XmNentryCallback, all activate events on the rowcolumn widget's
children (aka entries) will be handled by the rowcolumn widget.

Here's the relevant source code... please don't look at it if you don't
have a source licence....










...Ha ha ha.... just joking... If I did that, I'd have lawyers swarming
over me like a halo-of-flies on dung.





-------------------------------------------------------------------------------
	    Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com
		  Human-Computer Interaction Department
		       Hewlett-Packard Laboratories
			      Palo Alto, CA.
				   *