Option Menu Current Value - Motif

This is a discussion on Option Menu Current Value - Motif ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Option Menu Current Value

  1. 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


  2. Re: Option Menu Current Value

    "Thomas D. Dean" wrote in
    news:3OCdnaxbn6sS0aCiRVn-ig@speakeasy.net:
    > I want to get the current value of an option menu,


    Subject 173 in the Motif FAQ. My web site has a copy of the FAQ.

    Ken Lee, http://www.rahul.net/kenton/

  3. 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);


+ Reply to Thread