Sign in to follow this  
Followers 0
ARCC

Call Function with parameters

6 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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)

EndFunc

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!

Edited by Bert

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

I want only to identify misc buttons, when they cause single function :shocked: 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

Share this post


Link to post
Share on other sites

Would you want that in the while loop??

no-no, this performance to functions for pushing buttons :shocked: cycle in this program also there is, he does other task, I don't want to distract him for buttons.

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
Sign in to follow this  
Followers 0