Jump to content
Sign in to follow this  
gcue

guictrlsetdata clears a combo list

Recommended Posts

gcue

i have a combo that has data and i would like to blank the current selection but not the entire list

i add to the combolist like this:

GUICtrlSetData($c_IP, GUICtrlRead($c_IP))

but after adding id like to clear the last entry and make ready for the next entry so id like to blank the current entry without deleting the list

i tried this but it clears the entire list:

GUICtrlSetData($c_IP, "")

Share this post


Link to post
Share on other sites
rasim

Example:

#Include <GuiConstantsEx.au3>
#Include <GuiComboBox.au3>

$hGUI = GUICreate("Test", 200, 100)

$cCombobox = GUICtrlCreateCombo("", 11, 25, 180, 20)
GUICtrlSetData(-1, "One|Two|Three", "One")

$cButton_DelString = GUICtrlCreateButton("Delete", 60, 66, 75, 23)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $cButton_DelString
            _DelString($cCombobox)
    EndSwitch
WEnd

Func _DelString($cControl)
    Local $iIndex = _GUICtrlComboBox_GetCurSel($cCombobox)
    If $iIndex = -1 Then Return 0
    
    If _GUICtrlComboBox_DeleteString($cControl, $iIndex) <> -1 Then
        _GUICtrlComboBox_SetCurSel($cControl, 0)
        Return 1
    EndIf
EndFunc

:)

Share this post


Link to post
Share on other sites
gcue

thanks!

Share this post


Link to post
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
Sign in to follow this  

×