how read combobox ? - Motif
This is a discussion on how read combobox ? - Motif ; hello,
when I click on a button, I would like read text from a combo box ( the
selected text );
how to do ? I just know the ID of widget of the combobox. ( I want not use
...
-
how read combobox ?
hello,
when I click on a button, I would like read text from a combo box ( the
selected text );
how to do ? I just know the ID of widget of the combobox. ( I want not use
callback)
thanks
vincent
-
Re: how read combobox ?
Didier wrote:
>
> hello,
>
> when I click on a button, I would like read text from a combo box ( the
> selected text );
> how to do ? I just know the ID of widget of the combobox. ( I want not use
> callback)
>
> thanks
>
> vincent
XmString item;
XtVaGetValues( combobox, XmNselectedItem, &item, NULL );
/* you must free this when you are done with it */
XmStringFree( item );
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225
-
Re: how read combobox ?
> XmString item;
> XtVaGetValues( combobox, XmNselectedItem, &item, NULL );
>
> /* you must free this when you are done with it */
> XmStringFree( item );
I have try this, but it dont work, item return adress and not string !?
an idea ?
thanks
vinvent
-
Re: how read combobox ?
Didier wrote:
>
> > XmString item;
> > XtVaGetValues( combobox, XmNselectedItem, &item, NULL );
> >
> > /* you must free this when you are done with it */
> > XmStringFree( item );
>
> I have try this, but it dont work, item return adress and not string !?
> an idea ?
>
> thanks
>
> vinvent
XmNselectedItem is an XmString, not a string. To convert it to a string,
you need to use one or more of of the XmStringGet... functions. Try
char *str;
XmString item;
XtVaGetValues( combobox, XmNselectedItem, &item, NULL );
XmStringGetLtoR( item, XmFONTLIST_DEFAULT_TAG, &str );
XmStringFree(item);
/* ... and you will also have to free the string eventually: */
XtFree( str ) ;
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225