how to add items to a XmCreateSelectionDialog

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
how to add items to a XmCreateSelectionDialog

Submitted by Anonymous on Fri, 02/23/2001 - 05:06. Developers
Not quite sure how to add items to a Selection Dialog box.

Suppose I read the items as char arrays from a file (in esence a string) and want to use the value from this file as the items in the dialog boxs list.

I have tried to use XtSetValues(w, XmNlistItems, array) but they don`t seem to take. Is there a convenience funtion that will do this form me?

Thanks

ICS_support

That`s essentially how you do it, with two catches

1) the items are, internally, character data, but they are not simple (char *) data; they are XmString values. You pass in an array of these XmStringValues -- an XmStringTable. The XmString is a data structure containing extra information about how to display the string (its direction, character set, etc.). Ideally, you construct the string out of its components, but most people simply call one of the XmStringCreate() functions.

2) the XmSelectionBox has an XmList inside it -- it`s supposed to be hidden, but everyone knows that it is there. Motif is occasionally clumsy about making the internals of its compound widgets clumsy. You are often able to affect the internal widgets directly, as you could in this case by obtaining the XmList widget ID with XmSelectionBoxGetChild(..XmDIALOG_LIST..). But in this case you are best off accessing the list through the widget ID of the selection box itself -- the resource you use is XmNlistItems, which winds up being set on the internal list.