blub Posted May 27, 2006 Posted May 27, 2006 i tryed to see with a msgbox, what is in the combobox selected. but unfortunately there every time arrives "box1". what shall i change that the other ones come, like item1, item2.... expandcollapse popup#include <GUIConstants.au3> Global $selected GUICreate("TEST1", 400, 400) GUISetState(@SW_SHOW) Opt('GUIOnEventMode', 1) hotkeyset("{ESC}", "terminate") HotKeySet("{f7}", "GO") hotkeyset("{f8}", "selectiontest") $combo1 = GUICtrlCreateCombo("box1", 50, 50, 200, 100, 3) ; create combo box GUICtrlSetData($combo1,"item1||item2|item3|item4|item5" ) ; Set data in Combo Box1 $selected = GuiCtrlRead($combo1) func GO() if $selected = "box1" Then MsgBox(1, " Selection", "box1") EndIf if $selected = "item1" Then msgbox(1, "Selection", "item1") EndIf if $selected = "item2" Then msgbox(1, "Selection", "item2") EndIf if $selected = "item33" then msgbox(1,"selection","item3") EndIf if $selected = "item4" then msgbox(1,"selection","item4") EndIf if $selected = "item5" Then msgbox(1,"selection", "item5") EndIf EndFunc func selectiontest() ;; $selected = ?? MsgBox(1,"What is selected???", $selected ) EndFunc while 1 ;idle sleep(250) WEnd func terminate() ;exit Exit 0 EndFunc
Valuater Posted May 27, 2006 Posted May 27, 2006 func selectiontest() ;; $selected = ?? $selected = GuiCtrlRead($combo1) MsgBox(1,"What is selected???", $selected ) EndFunc 8)
Xenobiologist Posted May 27, 2006 Posted May 27, 2006 Hi, or #include <GUIConstants.au3> hotkeyset("{ESC}", "terminate") GUICreate("TEST1", 400, 400) GUISetState(@SW_SHOW) $combo1 = GUICtrlCreateCombo("box1", 50, 50, 200, 100, 3); create combo box $button = GUICtrlCreateButton("ok" , 50, 250, 50, 20) GUICtrlSetData($combo1,"item1||item2|item3|item4|item5" ) ; Set data in Combo Box1 While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button MsgBox(64, "Selected",GuiCtrlRead($combo1)) EndSelect Wend func terminate() ;exit Exit 0 EndFunc So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
blub Posted May 28, 2006 Author Posted May 28, 2006 and if i want to set for every item an own function, or send("hello") or something. how would it look like. and thx for the fast replay
Xenobiologist Posted May 28, 2006 Posted May 28, 2006 and if i want to set for every item an own function, or send("hello") or something. how would it look like. and thx for the fast replay HI, not nice, but should give you what you want. #include <GUIConstants.au3> hotkeyset("{ESC}", "terminate") GUICreate("TEST1", 400, 400) GUISetState(@SW_SHOW) $combo1 = GUICtrlCreateCombo("box1", 50, 50, 200, 100, 3); create combo box $button = GUICtrlCreateButton("ok" , 50, 250, 50, 20) GUICtrlSetData($combo1,"item1||item2|item3|item4|item5" ) ; Set data in Combo Box1 While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button Local $a = GuiCtrlRead($combo1) Select case $a = "item1" MsgBox(0,"","hello") case $a = "item2" MsgBox(0,"","hello2") EndSelect EndSelect Wend func terminate() ;exit Exit 0 EndFunc So long, Mega PS: You need more case statements to get all possibilities. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
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