Jump to content
Deye

combobox (ShowDropDown)

Recommended Posts

how can we make the DropDown wait for a full user input selection until HideDropDown is set and not conditioned to a sleep() pause
or is there a way to disable the data reading on hover

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include<ComboConstants.au3>
Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 300, 200)

    ; Create a combobox control.
    Local $idComboBox = GUICtrlCreateCombo("test", 10, 10, 185, 20, $CBS_DROPDOWNLIST)
    Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25)
    Local $idtest = GUICtrlCreateButton("test", 100, 170, 85, 25)
    ; Add additional items to the combobox.
    GUICtrlSetData($idComboBox, "Item 1|Item 2|Item 3", "test")

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    Local $sComboRead = ""

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idClose
                ExitLoop
            Case $idtest
                Do
                    ControlCommand($hGUI, "", $idComboBox, "ShowDropDown", "")
                    Sleep(100)
                Until GUICtrlRead($idComboBox) <> "test"
                Local $data = GUICtrlRead($idComboBox)
                MsgBox($MB_SYSTEMMODAL, "", "The combobox is currently displaying: " & $data, 0, $hGUI)

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites

Deye,

I would do it like this:

Case $idtest

    _GUICtrlComboBoxEx_ShowDropDown($idComboBox, True)
    While 1
        If GUIGetMsg() = $idComboBox Then ExitLoop

        Sleep(10)
    WEnd

    Local $data = GUICtrlRead($idComboBox)
    MsgBox($MB_SYSTEMMODAL, "", "The combobox is currently displaying: " & $data, 0, $hGUI)

Any use?

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

×
×
  • Create New...