Jump to content
Sign in to follow this  
Merchants

How to remove a item out of a combobox?

Recommended Posts

Merchants

GUICtrlSetData($GUI[1], "item2|item3", "item3") ; add other item snd set a new default

and how to remove item 2 ? so that item1 and 3 remains in the combobox..

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $GUI[10]
    $GUI[0] = GUICreate("My GUI combo")  ; will create a dialog box that when displayed is centered

    $GUI[1] = GUICtrlCreateCombo("item1", 10, 10) ; create first item
    
    GUICtrlSetData($GUI[1], "item2|item3", "item3") ; add other item snd set a new default

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $GUI[2] = GUIGetMsg()
        Select
            Case $GUI[2] = $GUI_EVENT_CLOSE
                Exit
            Case $GUI[2] = $GUI[1]
                MsgBox(64,"test",GUICtrlRead($GUI[1]))
        EndSelect
    WEnd
EndFunc   ;==>Example
Edited by Merchants

Share this post


Link to post
Share on other sites
Merchants

GUICtrlSetData($GUI[1], "item1|item3", "item3")

-Aaron

already tried then it wil ADD item1 and item3 again..

so then you get 5 items

Edited by Merchants

Share this post


Link to post
Share on other sites
FlyinRiz

Need to start the literal string with "|" or else its added. ;)

Remarks

For Combo or List control :

If the "data" corresponds to an already existing entry it is set as the default.

If the "data" starts with GUIDataSeparatorChar or is an empty string "" the previous list is destroyed.

Good call!

Share this post


Link to post
Share on other sites
Merchants

wel i have used: _GUICtrlComboBox_DeleteString(control, index)

Share this post


Link to post
Share on other sites
Habland0

wel i have used: _GUICtrlComboBox_DeleteString(control, index)

;)

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  

×