Archive: Listbox in a custom page


Listbox in a custom page
Hi,

at the beginning of my installer, I'd like to add a custom page that includes a listbox with several choices. Depending on the choice that the user will select, some variables will be modified.

Is there a simple way to accomplish this ? I didn't fiund what I'm looking for on the net... :confused:

Thanks.


Try to learn something about nsDialogs: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html :rolleyes:


Thanks for the link.

However, I can't find enough information in it about what I want to do.

Any sample that would be more "detailed" about nsDialogs ?


What do you think "NSIS\Examples\nsDialogs" is for ???

:rolleyes:


Originally posted by LoRd_MuldeR
What do you think "NSIS\Examples\nsDialogs" is for ???

:rolleyes:
I have already looked at NSIS\Examples\nsDialogs. There are no examples of listBox or radioButtons. I wouldn't be asking if there were. :rolleyes:

i'm also stuck working with listboxes. neither getstate nor gettext seem to be able to determine which item in a listbox was selected.

are there plans for listboxes that support the selection of multiple items?


i had a mistake in my script, but GetText still doesn't work. suprises me, as it does work with DropLists


attached the script, maybe it helps finding an answer


You need something like this:

Function OnClickCopyRight
SendMessage $LB_left ${LB_GETCURSEL} 0 0 $0
${If} $0 >= 0
System::Call user32::SendMessage(i$LB_left,i${LB_GETTEXT},i$0,t.r1)
MessageBox MB_OK '0: $0, 1: $1'
${EndIf}
FunctionEnd

thanks a lot, it's working. is there a way to get an item by its index? what i'm trying to do is build a loop (if necessary) to get all items in a listbox.


It's getting item by its index. Index is stored in $0 in my example.


so it would be best to use LB_GETCOUNT first and the loop using your LB_GETTEXT call?


Sure.


the getcount part is working, but i failed getting the gettext to work then

SendMessage $LB_left ${LB_GETCOUNT} 0 0 $0

hopefully my last question, sorry :)


It works for me. I think that you are overwriting value in $0 somewhere.


i was just trying to use it with the value i was getting from getcount, just to do a simple test (the loop comes later). however, i failed to go on from there. do i use a gettext before the syscall? i don't really get where i can use the index i just queried.


Function OnClickCopyRight
SendMessage $LB_left ${LB_GETCOUNT} 0 0 $9
StrCpy $0 0
${Do}
System::Call user32::SendMessage(i$LB_left,i${LB_GETTEXT},i$0,t.r1)
MessageBox MB_OK '$1'
IntOp $0 $0 + 1
${LoopUntil} $0 == $9
FunctionEnd

i was just trying to use it with the value i was getting from getcount, just to do a simple test
If it told you the list has 5 entries, they are numbered 0 - 4. There is no entry number 5.