Skip to content
⌘ NSIS Forum Archive

Problem creating a droplist

13 posts

dizou#

Problem creating a droplist

I am trying to create a drop list. This is the code I have:

Var TimeDialog
Var TimeZoneDropList

; Pages
Page components
Page directory
Page custom TimePage TimePageLeave "- Schedule Options"
Page instfiles

Function TimePage
nsDialogs::Create 1018
Pop $TimeDialog
${If} $TimeDialog == error
Abort
${EndIf}

${NSD_CreateDropList} 5u 28u 90% 12u
Pop $TimeZoneDropList

SendMessage $TimeZoneDropList ${CB_ADDSTRING} 0 "STR:US/Alaska"
${NSD_CB_AddString} $TimeZoneDropList "US/Arizona"
FunctionEnd
Everything compiles ok, but when I run it, The drop list does not show up.
dizou#
Yes, it does compile like that. I just changed

${NSD_CreateDropList} 5u 28u 90% 12u
to
${NSD_CreateDropList} 5u 28u 90% 12u ""
and now I have a drop list, but it is empty.
dizou#
Here is my code:

Var TimeDialog
Var TimeZoneDropList

; Pages
Page components
Page directory
Page custom TimePage TimePageLeave "- Schedule Options"
Page instfiles

Function TimePage
nsDialogs::Create 1018
Pop $TimeDialog
${If} $TimeDialog == error
Abort
${EndIf}

${NSD_CreateDropList} 5u 28u 90% 12u ""
Pop $TimeZoneDropList
${NSD_CB_AddString} $TimeZoneDropList "US/Arizona"
nsDialogs::Show
FunctionEnd
Afrow UK#
The height needs to be more than 12u as it is the height of the entire control including the drop down list (I don't think this applies to Vista/7 though).

Stu
dizou#
It does apply to Windows 7 because I am using Windows 7. Once I changed the height, everything worked. Did I miss something in the documentation because I didn't see anything about this when I was looking stuff up. Thanks!
dizou#
So now I have this as my page leave function:


Function TimePageLeave
Var /GLOBAL TimeZone

${NSD_CB_SelectString} $TimeZoneDropList $TimeZone
MessageBox MB_OK "$TimeZone"
FunctionEnd
However, when the messagebox pops up, nothing is displayed even when I am selecting something in my drop list.