Archive: Problem creating a droplist


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.

Are you sure that compiles? All NSD_Create* macros expect 5 arguments not 4.

Stu


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.

Use NSD_CB_AddString to add items. Use NSD_CB_SelectString to make a selection.

Stu


I am. I am doing:

${NSD_CB_AddString} $TimeZoneDropList "US/Arizona"


Nothing shows up.

Please post your code.

Stu


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

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


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!


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.

i think you must use NSD_GetText instead


Yes. NSD_GetText worked. When is NSD_CB_SelectString used?


To select an item in the drop down list.

Stu