Jump to content

Solved - Combo Clear Only Selection String


Xandy
 Share

Recommended Posts

Hi I'm struggling to clear the display text of of a GUI control combo selection string.

I would like to clear the selection like it is clear after it is populated, but not remove any items from the list.

Here is a small example.

#include <GuiComboBox.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>

; Create GUI
$hgui= guicreate("Clear ComboBox Edit Text", 320, 200)
$control_combo= guictrlcreatecombo("", 10, 10, 250, 20, $CBS_DROPDOWNLIST)
$control_clear_button= guictrlcreatebutton("Reset Blank Combo Selection String", 10, 40, 200, 20)
guisetstate()
guictrlsetdata($control_combo, "a|b|c"); Populate Combo

while 1
    switch guigetmsg()
        case $control_clear_button
            guictrlsetdata($control_combo, ""); This clears the entire list frustrating me

        case $gui_event_close
            exitloop
    endswitch;guigetmsg()
wend;main loop
Does anyone one know how I can reset the selection to "", clear, empty set?

I've tried SetEditText but doesn't work CBS_DROPDOWNLIST.

SOLVED:

Sorry I thought I had tried this: _GUICtrlComboBox_SetCurSel($control_combo, -1) is the solution.

Edited by Xandy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...