[comp.windows.x] help with callbacks

hwa@ece-csc.UUCP (George Hwa) (04/11/89)

	I am working on an application using the X Toolkit and the Athena
Widgets.  I need a little help with passing parameters to a callback function.
My application uses multiple windows.  I have a single main menu that
controls all the windows.  Several of my menu operations perform certain
operations on one of the windows.  I use a pop up menu to choose the window
I want to use.  I want to have a single callback for all of the windows.
My problem, after I have selected the window from the menu, how can I pass
that window id to the callback function.

	Any help would be greatly appreciated.

	Thanks in advance.

	Russ Cook
	NC State University
	hwa@ece-csc.ncsu.edu

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/19/89)

>  I want to have a single callback for all of the windows.
> My problem, after I have selected the window from the menu, how can I pass
> that window id to the callback function.

XtAddCallback() takes a generic pointer that is client specified data.
This can point to one item, or a structure of items that are specific
to this particular callback.  This data is then passed to the Callback 
routine that is called when your menu item is selected.  There are
many examples of this, one is xman.  Xman is on the core R3 distribution
in "clients/xman/*".


                                                Chris D. Peterson
                                                MIT X Consortium