Jump to content

InputBox with Drop Down


Recommended Posts

Is there anything built-in that mimics the InputBox() but is able to have a drop down for different options instead of the input field? I would like to avoid multiple GUIs if possible.

Something like this ?

#include <GUIConstantsEx.au3>

GUICreate("My GUI combo")  
$_Combo =GUICtrlCreateCombo("item1", 10, 10)
GUICtrlSetData(-1, "item2|item3", "item3") 
GUISetState()
$_ReadOld=''

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    $_Read = GUICtrlRead ( $_Combo )
    If $_Read <> $_ReadOld Then
        ConsoleWrite ( "-->-- $_Read : " & $_Read & @Crlf )
        $_ReadOld = $_Read
    EndIf
WEnd

Type what you want in the combobox ! Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

I have a main GUI now and I want a user to click a button and choose an option from a drop down, but don't want to go through the hassle of dealing with multiple GUIs if at all possible.

I know what I would have to do if I'm forced to go with a sub GUI, but I was wondering if there was something I over-looked.

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

GUICreate("My GUI combo")
$_Combo =GUICtrlCreateCombo("item1", 10, 10)
GUICtrlSetData(-1, "item2|item3", "item3")
$_Button = GUICtrlCreateButton ( 'Select', 20, 50 )
GUISetState()
$_ReadOld=''

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $_Button
            ConsoleWrite ( "+->-- Select : " & GUICtrlRead ( $_Combo ) & @Crlf )
    EndSwitch
    $_Read = GUICtrlRead ( $_Combo )
    If $_Read <> $_ReadOld Then
        ConsoleWrite ( "-->-- $_Read : " & $_Read & @Crlf )
        $_ReadOld = $_Read
    EndIf
WEnd

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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...