Jump to content

How to remove a item out of a combobox?


Merchants
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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!

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...