- NSIS Discussion
- Listbox in a custom page
Archive: Listbox in a custom page
magicpm7
22nd July 2008 08:56 UTC
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.
pospec
22nd July 2008 11:25 UTC
Try to learn something about nsDialogs: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html :rolleyes:
magicpm7
22nd July 2008 16:34 UTC
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 ?
LoRd_MuldeR
22nd July 2008 16:43 UTC
What do you think "NSIS\Examples\nsDialogs" is for ???
:rolleyes:
magicpm7
23rd July 2008 07:31 UTC
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:
Yathosho
31st July 2008 11:21 UTC
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
1st August 2008 14:59 UTC
i had a mistake in my script, but GetText still doesn't work. suprises me, as it does work with DropLists
Yathosho
4th August 2008 22:56 UTC
attached the script, maybe it helps finding an answer
pospec
5th August 2008 07:57 UTC
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
5th August 2008 11:59 UTC
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.
pospec
5th August 2008 12:01 UTC
It's getting item by its index. Index is stored in $0 in my example.
Yathosho
5th August 2008 12:05 UTC
so it would be best to use LB_GETCOUNT first and the loop using your LB_GETTEXT call?
pospec
5th August 2008 12:07 UTC
Sure.
Yathosho
5th August 2008 12:23 UTC
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 :)
pospec
5th August 2008 12:26 UTC
It works for me. I think that you are overwriting value in $0 somewhere.
Yathosho
5th August 2008 12:42 UTC
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
5th August 2008 12:46 UTC
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
5th August 2008 14:39 UTC
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.