Sign in to follow this  
Followers 0
BinaryBrother

Registering an Event from within a function

2 posts in this topic

I am having some issues with registering events from within functions.

Func DoScreenshotFS()
    ;FadeOut()
    ;ShotGUI()
    ;FadeIn()
    ;Opt("GUIOnEventMode",0)
    _IENavigate($oIE, 'javascript:ajaxChat.sendMessage("/action is posting a Screenshot...");', 0)
    $hMain_GUI = GUICreate("ScreenCapture", 280, 50)

    $hRect_Button = GUICtrlCreateButton("Select Region", 10, 10, 80, 30)
    $hFS_Button = GUICtrlCreateButton("Entire Screen", 100, 10, 80, 30)
    $hCancel_Button = GUICtrlCreateButton("Cancel", 190, 10, 80, 30)
    GUICtrlSetOnEvent($hRect_Button,"test")

Notice the last line... I am setting an event trigger from within a function... Is this not suppose to work? That's ALL I need to know... >_<

Simple question, simple answer... :(

Issue: GuiCtrlSetOnEvent() Is not firing as I expected.

Question: Is this 'proper' behavior? (Not working)

I don't need to know how to fix it (Or I would have provided more source), I just need to know if it's proper behavior...

Share this post


Link to post
Share on other sites



All variables in a function are "local" scope variables, unless otherwise noted within the code as "global". Local scope variables are destroyed on the return from the function.

If that's not the answer, then provide a re-inactment script that someone can actually run that demonstrates your issue.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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