Submitted by Anonymous on Tue, 01/22/2002 - 21:29. Developers
Hello everybody,
I am a beginner debugging an application and need your help.
I have a window with 64 toggle buttons. My application selects a toggle button with
XtVaSetValues(ToggleButton[ix], XmNset, True, NULL);
When running my application, my window appears with the toggle button selected but the
"selection highlighting rectangle" which shows a selected toggle button appears at a different toggle button.
How do I make this rectangle coincide with my selected toggle button?
How is the position of this rectangle decided in a window with several toggle buttons? Who decides where it will be?
Thanks
Sly
To set the focus on the correct toggle, call
XmTraverseWidget on the widget with an XM_TRAVERSE_CURRENT argument...
XmTraverseWidge(toggle_widget,XM_TRAVERSE_CURRENT)
Your second question depends on which container widget you use. Whether its a row-column or a form, etc. With a "form" widget, you have the most freedom to put the widgets where you want, but at a price of ease-of-use. With a row-column, it depends on how many columns and how the XmNpacking resource is set.
The O`Reilly Motif series is really excellent in explaining the details. I don`t know of an on-line API source.
The rectangle isn`t the "selected" button -- that term doesn`t really have a meaning in Motif. Instead, that rectangle indicates the object with the keyboard focus, such that hitting Return or whatever is appropriate to the particular widget Activates it.
Focus is initially set by the toolkit, with hints from the application, and is later set by the user and the application.
In this case, you can use the resource XmNinitialFocus or the function XmProcessTraversal() to reset the toggle.
PS I wonder if there is a better interface than 64 toggles. Can these buttons be broken up into smaller groups?
These 64 toggles correspond to 64 different users of the same application. These users have different privileges. That is why I can not put them in smaller groups.
Thank you both for your comments, I will try this today and give you a feedback.
Everything works perfectly now.
Thank you!