IonicWind Software

IWBasic => General Questions => Topic started by: ckoehn on January 16, 2010, 06:11:47 PM

Title: Listbox selection
Post by: ckoehn on January 16, 2010, 06:11:47 PM
Is it possible to programaticaly remove a selection on an item in a listbox control?  There is a SETSELECTED but no DESELECTITEM.

Thanks
Title: Re: Listbox selection
Post by: LarryMc on January 16, 2010, 06:18:15 PM
Use the SETSELECTED command with a position  of -1

Larry
Title: Re: Listbox selection
Post by: ckoehn on January 16, 2010, 06:30:28 PM
Thanks Larry.  I appreciate your help.

Title: Re: Listbox selection
Post by: ckoehn on January 16, 2010, 06:37:39 PM
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
Title: Re: Listbox selection
Post by: LarryMc on January 16, 2010, 07:04:04 PM
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
Title: Re: Listbox selection
Post by: LarryMc on January 16, 2010, 07:12:55 PM
Use this to clear out your listbox:

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

then reload it

Larry
Title: Re: Listbox selection
Post by: sapero on January 17, 2010, 01:53:38 AM
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.
Title: Re: Listbox selection
Post by: LarryMc on January 17, 2010, 09:36:27 AM
I missed that one, Sapero.  As always you come through!

Larry