October 31, 2025, 05:17:30 AM

News:

IWBasic runs in Windows 11!


Listbox selection

Started by ckoehn, January 16, 2010, 06:11:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ckoehn

Is it possible to programaticaly remove a selection on an item in a listbox control?  There is a SETSELECTED but no DESELECTITEM.

Thanks

LarryMc

Use the SETSELECTED command with a position  of -1

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ckoehn

Thanks Larry.  I appreciate your help.


ckoehn

Sorry Larry.  Setting it to -1 doesn't work.  Here is my list settings.  It is a multi-selection list box.

I used: SETSELECTED win,2,-1

QuoteCONTROL win,@LISTBOX,"",370,tHeight*2,180,60,@TABSTOP|@CTLISTEXTENDED|@VSCROLL|@CTLISTNOTIFY|@CTLISTSORT,2

LarryMc

Went back to the SDk and it states that what I told you to do will not work when you have the multiselect flag set.

The only thing I would know to do is delete all the items in the listbox and then reload it.

I've done it before but right now I don't know where a copy of the program I did it in is located.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Use this to clear out your listbox:

CONST LB_RESETCONTENT = 0x184
SENDMESSAGE win,LB_RESETCONTENT,0,0,2

then reload it

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

sapero

January 17, 2010, 01:53:38 AM #6 Last Edit: January 17, 2010, 01:55:12 AM by sapero
An application sends an LB_SETSEL message to select a string in a multiple-selection list boxSendMessage(d1, LB_SETSEL, FALSE, -1, listbox_id)
Should deselect all items. Include windows.inc or windowssdk.inc.

LarryMc

I missed that one, Sapero.  As always you come through!

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library