Option Menu Current Value
I want to get the current value of an option menu, outside its callback. The
menu is created with
W = XmCreatePulldownMenu()
O = XmCreateOptionMenu()
similar to the BuildMenu() function described in Vol 6A, Motif Programming Manual.
I have the widget O, and want to get the current label of O.
Is this available via XtGetValues()? If so, what resource do I request?
tomdean
Re: Option Menu Current Value
"Thomas D. Dean" <tomdean@speakeasy.net> wrote in
news:3OCdnaxbn6sS0aCiRVn-ig@speakeasy.net:[color=blue]
> I want to get the current value of an option menu,[/color]
Subject 173 in the Motif FAQ. My web site has a copy of the FAQ.
Ken Lee, [url]http://www.rahul.net/kenton/[/url]
Re: Option Menu Current Value
The option menu is a RowColumn Widget. When created via XmCreateOptionMenu(),
an internal CascadeButtonGadget is created to hold the label.
XmOptionButtonGadget() returns the widget ID for the CascadeButtonGadget. To
get the current label, use XtVaGetValues() with XmNlabelString. Use
XmCvtXmStringToCT() to convert it to a char*.
XmString str;
Widget w = XmOptionButtonGadget(option_menu);
XtVaGetValues(w, XmNlabelString, &str, NULL);
printf("w -> XmNlabelString %s\n", XmCvtXmStringToCT(str) );
XmStringFree(str);