ARCC Posted April 24, 2007 Posted April 24, 2007 Hi What i can send parameter in function, when function is determined in GUICtrlSetOnEvent ? Here exmpl: $btn1 = GUICtrlCreateButton ("First", 55,110,80,24) GUICtrlSetOnEvent(-1, "TEST ??? ") ; ... ... Func TEST(ByRef $a) Beep(500, $a) EndFunc
BrettF Posted April 24, 2007 Posted April 24, 2007 (edited) Hi What i can send parameter in function, when function is determined in GUICtrlSetOnEvent ? Here exmpl: $btn1 = GUICtrlCreateButton ("First", 55,110,80,24) GUICtrlSetOnEvent(-1, "TEST ??? ") ; ... ... Func TEST(ByRef $a) Beep(500, $a) EndFuncLast time I checked, you can't do that. An alternative would be to use a While loop, with Select and Case. Like this: While 1 $nMsg = GUIGetMsg () Select Case $msg = $btn1 Test ($a) EndSelect Wend EDIT: Also, you can't use this method in conjunction with GuiOnEventMode. Hope that helps! Edited April 24, 2007 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
ARCC Posted April 24, 2007 Author Posted April 24, 2007 Last time I checked, you can't do that. An alternative would be to use a While loop, with Select and Case. Like this: While 1 $nMsg = GUIGetMsg () Select Case $msg = $btn1 Test ($a) EndSelect Wend EDIT: Also, you can't use this method in conjunction with GuiOnEventMode. Hope that helps! Ok. TNX, Bert
ARCC Posted April 24, 2007 Author Posted April 24, 2007 I want only to identify misc buttons, when they cause single function I have done this: $btn1 = GUICtrlCreateButton ("64", 55,110,80,24, $BS_FLAT) GUICtrlSetOnEvent(-1, "Speed") GUICtrlSetCursor(-1, 0) $btn2 = GUICtrlCreateButton ("125", 55,135,80,24, $BS_FLAT) GUICtrlSetOnEvent(-1, "Speed") GUICtrlSetCursor(-1, 0) $btn3 = GUICtrlCreateButton ("250", 55,160,80,24, $BS_FLAT) GUICtrlSetOnEvent(-1, "Speed") GUICtrlSetCursor(-1, 0) $btn4 = GUICtrlCreateButton ("500", 55,185,80,24, $BS_FLAT) GUICtrlSetOnEvent(-1, "Speed") GUICtrlSetCursor(-1, 0) ............ Func Speed() MsgBox (48, "Button display text", GUICtrlRead (@GUI_CtrlId)) ; here my code EndFunc
BrettF Posted April 24, 2007 Posted April 24, 2007 Would you want that in the while loop?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
ARCC Posted April 24, 2007 Author Posted April 24, 2007 Would you want that in the while loop??no-no, this performance to functions for pushing buttons cycle in this program also there is, he does other task, I don't want to distract him for buttons.
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