Code: Select all
Gui, add, dropdownlist,,item1|item2|item3
Gui, add, button,gclear,Clear selected Dropdown item
gui, show, autosize
return
clear:
GuiControl,text,combobox1
return
Code: Select all
Gui, add, dropdownlist,,item1|item2|item3
Gui, add, button,gclear,Clear selected Dropdown item
gui, show, autosize
return
clear:
GuiControl,text,combobox1
return
Code: Select all
Gui, Add, DDL, vDDL hwndDDL_ID +AltSubmit, item1|item2|item3 ; if the control has the AltSubmit property, the output variable will receive the item's position number
Gui, Add, Button, gClear, &Clear selected Dropdown item
Gui, Show, Autosize
return
clear:
GuiControlGet, DDL ; retieve the item's position number
Control, Delete, %DDL%,, % "ahk_id " . DDL_ID ; to operate upon a control's HWND (window handle), leave the Control parameter blank and specify ahk_id %ControlHwnd% for the WinTitle parameter
return
I don't want to delete the item from the dropdown list. I only want to clear it from the "dropdown field".A_AhkUser wrote:Hi DataLife,
Use Control, Delete:
Code: Select all
Gui, Add, DDL, vDDL hwndDDL_ID +AltSubmit, item1|item2|item3 ; if the control has the AltSubmit property, the output variable will receive the item's position number Gui, Add, Button, gClear, &Clear selected Dropdown item Gui, Show, Autosize return clear: GuiControlGet, DDL ; retieve the item's position number Control, Delete, %DDL%,, % "ahk_id " . DDL_ID ; to operate upon a control's HWND (window handle), leave the Control parameter blank and specify ahk_id %ControlHwnd% for the WinTitle parameter return
Code: Select all
SendMessage, 0x014E, -1, 0,, ahk_id %DDL_ID%
Code: Select all
Gui, Add, DDL, vMyDDL, item1|item2|item3
Gui, Add, button, gClear, Clear selected Dropdown item
Gui, Show, w400 h300, Test
Return
GuiClose:
ExitApp
Clear:
GuiControl, Choose , MyDDL, 0
Return
GuiControl wrote:GuiControl, Choose, ControlID, N: Sets the selection in a ListBox, DropDownList, ComboBox, or Tab control to be the Nth entry. N should be 1 for the first entry, 2 for the second, etc. If N is not an integer, the ChooseString method described below will be used instead. [v1.1.06+]: If N is zero, the ListBox, DropDownList or ComboBox's current selection is removed.
Of course it was right there in front of me. I read so much that if I felt I was going down the wrong path I would quit reading. That is why I missed "If N is zero, the ListBox, DropDownList or ComboBox's current selection is removed."just me wrote:Code: Select all
Gui, Add, DDL, vMyDDL, item1|item2|item3 Gui, Add, button, gClear, Clear selected Dropdown item Gui, Show, w400 h300, Test Return GuiClose: ExitApp Clear: GuiControl, Choose , MyDDL, 0 Return
GuiControl wrote:GuiControl, Choose, ControlID, N: Sets the selection in a ListBox, DropDownList, ComboBox, or Tab control to be the Nth entry. N should be 1 for the first entry, 2 for the second, etc. If N is not an integer, the ChooseString method described below will be used instead. [v1.1.06+]: If N is zero, the ListBox, DropDownList or ComboBox's current selection is removed.