how read combobox ?

how read combobox ?

Post by Didie » Sun, 11 Jul 2004 01:14:56


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
 
 
 

how read combobox ?

Post by Fred L. Kl » Sun, 11 Jul 2004 03:45:34


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

 
 
 

how read combobox ?

Post by Didie » Wed, 14 Jul 2004 01:22:53


I have try this, but it dont work, item return adress and not string !?
an idea ?

thanks

vinvent
 
 
 

how read combobox ?

Post by Fred L. Kl » Wed, 14 Jul 2004 06:52:43


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