| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jan 22, 2009 3:07 am Post subject: Highlight multiple items in a multi select list box? |
|
|
I thought I had seen reference to highlighting multiple items in a list box before, but can't find anything in searching the forums here.
I took a look at the "LB" messages in the API help file, but the only thing close is the LB_SETANCHORINDEX and LB_SETCURSEL, while the first one almost does what needs to be done, it will only highlight a range. If I want to highlight say index 1,2,3 and 5, the SETANCHORINDEX I don't believe will suffice since it seems to be used for consecutive items without any breaks, unless I'm reading it wrong.
Does anyone know how to set the highlight of multiple items in a multi select list box? Specifically if they are not one after another, but broken up?
Thanks in advance,
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
uvedese Contributor


Joined: 21 Jan 2006 Posts: 169 Location: Spain
|
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Jan 22, 2009 3:06 pm Post subject: |
|
|
Quick example
| Code: |
DIALOG CREATE,New Dialog,-1,0,200,225
DIALOG ADD,LIST,LIST1,9,9,182,182,,MULTI
DIALOG ADD,BUTTON,BUTTON1,195,55,90,25,Selected Items
DIALOG SHOW
LIST ADD,LIST1,1
LIST ADD,LIST1,2
LIST ADD,LIST1,3
LIST ADD,LIST1,4
LIST ADD,LIST1,5
REM $0185 = LB_SETSEL
REM An application sends an LB_SETSEL message to select a string in a multiple-selection list box.
REM @sendmsg(@winexists(~LIST1),$0185,<TRUE/FALSE>,<Item Index>)
%P = @sendmsg(@winexists(~LIST1),$0185,1,0)
%P = @sendmsg(@winexists(~LIST1),$0185,1,1)
%P = @sendmsg(@winexists(~LIST1),$0185,1,3)
:Evloop
wait event
goto @event()
:BUTTON1BUTTON
gosub GetSelectedItems
info Selected Indexes: %%items
goto evloop
:Close
exit
:GetSelectedItems
%i = @count(LIST1)
%x = 0
%%items = ""
repeat
if @greater(@sendmsg(@winexists(~LIST1),$0187,%x,0),0)
if @greater(@len(%%items),0)
%%items = %%items"|"%x
else
%%items = %x
end
end
%x = @succ(%x)
until @equal(%x,%i)
exit
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jan 22, 2009 8:15 pm Post subject: |
|
|
Wow... I assumed the SETSEL would only allow a single selection and that a second call of it would reset the first one.
Thanks a bunch SnarlingSheep, and thanks uvedese.
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|