Skip to content
⌘ NSIS Forum Archive

Listbox in a custom page

18 posts

magicpm7#

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... 😕

Thanks.
pospec#
Try to learn something about nsDialogs: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html 🙄
magicpm7#
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 ?
magicpm7#
Originally posted by LoRd_MuldeR
What do you think "NSIS\Examples\nsDialogs" is for ???

🙄
I have already looked at NSIS\Examples\nsDialogs. There are no examples of listBox or radioButtons. I wouldn't be asking if there were. 🙄
Yathosho#
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?
Yathosho#
i had a mistake in my script, but GetText still doesn't work. suprises me, as it does work with DropLists
Yathosho#
attached the script, maybe it helps finding an answer
pospec#
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
Yathosho#
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.
Yathosho#
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 🙂
Yathosho#
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.
pospec#
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
demiller9#
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.