Kreal11 Posted May 1, 2011 Posted May 1, 2011 Hi all, i created a gui with a combo box in Koda, and i need to set $example = 1 when the first element is selected, $example = 2 when the 2nd element is selected, and so. Thanks in advance for support. I already used search but there are like 1000 results...
wakillon Posted May 1, 2011 Posted May 1, 2011 is a Xenobiologist Example ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Kreal11 Posted May 1, 2011 Author Posted May 1, 2011 Thank you, it works! But there is a little problem: i want in my script that if you select a certain item from the combobox it shows a msgbox. The problem is that it shows the msgbox even if i only go over that item with the mouse. I need to show the msgbox only if the item is clicked. Then, after showing the msgbox, i need the item on the combobox to be set on the first item. How could i do this? Thanks in advance.
wakillon Posted May 1, 2011 Posted May 1, 2011 I 'll be more clear if you show your script ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Kreal11 Posted May 1, 2011 Author Posted May 1, 2011 Ok, so here's a script example: expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 197, 66, 192, 124) $Label1 = GUICtrlCreateLabel("Choose color:", 10, 12, 93, 17) $Combo1 = GUICtrlCreateCombo("Choose here...", 106, 10, 81, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Black|White|Red|Green|Blue|Orange") $Button1 = GUICtrlCreateButton("Start", 50, 32, 97, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $color_chosen = GUICtrlRead($Combo1) Select Case $color_chosen = "Black" ;do this Case $color_chosen = "White" ;do that Case $color_chosen = "Red" MsgBox(16, "Error", "Sorry, you chose an unavailable color") ;the problem is that the msgbox is infinite ;here i want a code that resets the combobox Case $color_chosen = "Green" ;do something Case $color_chosen = "Blue" MsgBox(16, "Error", "Sorry, you chose an unavailable color") ;the problem is that the msgbox is infinite ;here i want a code that resets the combobox Case $color_chosen = "Orange" ;do something Else EndSelect $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Start() EndSwitch WEnd Func Start() ;do this EndFunc
wakillon Posted May 1, 2011 Posted May 1, 2011 Try expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 197, 66, 192, 124) $Label1 = GUICtrlCreateLabel("Choose color:", 10, 12, 93, 17) $Combo1 = GUICtrlCreateCombo("Choose here...", 106, 10, 81, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Black|White|Red|Green|Blue|Orange") $Button1 = GUICtrlCreateButton("Start", 50, 32, 97, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $color_chosen = GUICtrlRead($Combo1) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $color_chosen = GUICtrlRead($Combo1) Switch $color_chosen Case "Black" ;do this $_Start = 1 Case "White" ;do that $_Start = 1 Case "Red", "Blue" MsgBox(16, "Error", "Sorry, you chose an unavailable color") ;the problem is that the msgbox is infinite $_Start =0 ;here i want a code that resets the combobox Case "Green" ;do something $_Start = 1 Case "Orange" ;do something Else $_Start = 1 EndSwitch If $_Start Then Start() EndSwitch WEnd Func Start() ;do this EndFunc AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
wakillon Posted May 1, 2011 Posted May 1, 2011 I forget this for reset the combobox ! #include <GuiComboBoxEx.au3> ;here i want a code that resets the combobox _GUICtrlComboBox_SetEditText ($Combo1, "Choose here..." ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
wakillon Posted May 1, 2011 Posted May 1, 2011 Now it works fine! You are great! Kudos Glad to help you ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now