Archive: Hide/Delete a dropdown


Hide/Delete a dropdown
  I am using NSDialogs and I can create a dropdown on the fly, but is there a way to destroy a dropdown on the fly..

For Ex.

 ; === Locations (type: DropList) ===

${
NSD_CreateDropList} 89 85 159 21 ""
Pop $hCtl_RenameMe_Locations
CreateFont $hCtl_RenameMe_Locations_Font "Microsoft Sans Serif" "8.25" "400"
SendMessage $hCtl_RenameMe_Locations ${WM_SETFONT} $hCtl_RenameMe_Locations_Font 0
SetCtlColors $hCtl_RenameMe_Locations 0x000000 0xFFFFFF
${NSD_OnChange} $hCtl_RenameMe_Locations fnc_RenameMe_Locations_OnChange
${NSD_CB_AddString} $hCtl_RenameMe_Locations "Select Your Location..."
${NSD_CB_AddString} $hCtl_RenameMe_Locations "Location 1"
${NSD_CB_AddString} $hCtl_RenameMe_Locations "Location 2"
${NSD_CB_AddString} $hCtl_RenameMe_Locations "Location 3"
${NSD_CB_AddString} $hCtl_RenameMe_Locations "Location 4"
${NSD_CB_SelectString} $hCtl_RenameMe_Locations "Select Your Location..."
Function fnc_RenameMe_Locations_OnChange

${NSD_GetText} $hCtl_RenameMe_Locations $0

${If} $0 == "Select Your Location..."
< CODE TO REMOVE/HIDE DROPLIST >
${ElseIf} $0 == "Location 1"
># Var /GLOBAL hCtl_RenameMe_DropList1
# Var /GLOBAL hCtl_RenameMe_DropList1_Font

; === DropList1 (type: DropList) ===
># ${NSD_CreateDropList} 89 132 121 21 ""
# Pop $hCtl_RenameMe_DropList1
# CreateFont $hCtl_RenameMe_DropList1_Font "Microsoft Sans Serif" "8.25" "400"
# SendMessage $hCtl_RenameMe_DropList1 ${WM_SETFONT} $hCtl_RenameMe_DropList1_Font 0
# SetCtlColors $hCtl_RenameMe_DropList1 0x000000 0xFFFFFF
< CODE TO CREATE/UNHIDE DROPLIST >

${ElseIf} $0 == "Location 2"

< CODE TO CREATE/UNHIDE DROPLIST >

${EndIf}

>FunctionEnd
>
The above commented out code creates it on the fly as necessary, just not sure how to remove a droplist. If I can figure out the show/hide for an individual droplist, I will create it and just hide it by default and then just set an option to show it as necessary.. Any Ideas???

Thanks,

Squirre1

This should work:

ShowWindow $hCtl_RenameMe_Locations 0

Where $hCtl_RenameMe_Locations is the DropDownList variable you Popped after creating it, and 0 is SW_HIDE. http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx


Works perfectly... Was stuck on ShowWindow being for more than just the target element, like the whole page, but I stand corrected... Thanks...


  ${If} $0 == "Select Your Location..."

ShowWindow $hCtl_RenameMe_dyn_DropList1 0
SendMessage $hCtl_RenameMe_dyn_DropList1${CB_RESETCONTENT} 0 0 $0
ShowWindow $hCtl_RenameMe_dyn_Input1 0
${NSD_SetText} $hCtl_RenameMe_dyn_Input1 ""
${ElseIf} $0 == "Location 1"
ShowWindow $hCtl_RenameMe_dyn_DropList1 1
ShowWindow $hCtl_RenameMe_dyn_Input1 0
${NSD_SetText} $hCtl_RenameMe_dyn_Input1 ""
${ElseIf} $0 == "Location 2"
ShowWindow $hCtl_RenameMe_dyn_DropList1 0
SendMessage $hCtl_RenameMe_dyn_DropList1${CB_RESETCONTENT} 0 0 $0
ShowWindow $hCtl_RenameMe_dyn_Input1 1
${EndIf}
Obviously there are cleaner ways to do this, I will eventually call a fnc_clear_form so there is not so much repetitive code, but otherwise, this gets'er done..

Thanks,

Squirre1