Jump to content

Registering an Event from within a function

Recommended Posts

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

Func DoScreenshotFS()
    _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)

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...


Link to comment
Share on other sites

  • Moderators

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.

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.

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...