How can I multi-select via code?

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

Questions about motif? Contact us

3 posts / 0 new
Last post
How can I multi-select via code?

Submitted by Anonymous on Mon, 10/07/2002 - 20:36. Developers
I am using Motif 1.2.3 on Solaris 2.5.1 and I need to "re-select" items in a list. I can determine which positions need to be reselected but if there is more than one position, it toggles the previously selected position to unselected before it selects the the next one. Is there a way to select the next one (mimic the Ctrl key) without the deselecting the previous one.

any ideas?
Thanks!

Anonymous

For lists you can use the XmNextendedSelectionCallback...
However, when you create the list the set the XmNselectionPolicy to XmEXTENDED_SELECT...

(XtVaSetValues(List, XmNselectionPolicy, XmEXTENDED_SELECT, NULL);

Inside the Callback you can check for the type of selection. This will allow you to determine if the selection was SHIFT-CLICK, CTR-CLICK, etc...

XmListCallbackStruct Callback = (XmListCallbackStruct *)call_data);

CTRL-CLICK... Callback->selection_type == XmADDITION
SHIFT-CLICK... Callback->selection_type == XmMODIFICATION

Hopefully this will help.
C. Lamb

Anonymous

The problem actually was that the list was identified as Extended Select so when I tried to re-select items with the XmListSelectPos I first had to change the selection policy to Multiple select, make the selections, and then change the selection policy back to extended select. An additional callback for the list was needed for the multiple select but I used the same one as the extended select and just handled the selection policy within the callback.