Submitted by Anonymous on Wed, 06/25/2003 - 15:14.
This issue`s been bugging me for a while and I`ve found plenty of workarounds, but I`ve always wondered if I was missing some shortcut...
In a callback function that is shared by several widgets, say, all the buttons and text bars in an app, is there a way to determine which widget called the function by looking at any attributes of the widget itself?
So, instead of determining if a certain widget called the function by making the widget global and using the actual variable name
if(widget == myButton)
or a pointer to it
if(widget == *refToMyButton)
Is it possible to do something like this
XtVaGetValues(widget, ,
charstr, NULL);
if(charstr == <"Enroll", whatever>)
Ben
Sun, 06/29/2003 - 21:49#1
Anonymous
widgets and identifying features (ie names, etc)
Ah, so even BUTTONS have an XmNlabelString...hot damn. Well, at least I look like King Stupid now, instead of just Captain Stupid.
Hope this helps anyone else *shrug*
Thu, 07/03/2003 - 18:25#2
ICS_support
widgets and identifying features (ie names, etc)
You want the XmNuserData value which is exactly for this.
Thu, 07/03/2003 - 18:27#3
ICS_support
widgets and identifying features (ie names, etc)
I don`t think you want to use the label -- it can easily change, either programmatically or via user resources. Rather, tag the widget with XmNuserData