Sign in to follow this  
Followers 0
evilertoaster

cant call function

3 posts in this topic

#1 ·  Posted (edited)

Hey, I posted this in the GUI section but maybe it is more of a problem for this forum-

#include <GUIConstants.au3>
opt ("Guioneventmode",1)
;make GUI1
$GUI1=GUICreate("GUI1")
$button1=GUICtrlCreateButton("button1", 50, 50)
GUICtrlSetOnEvent($button1, "action1")

;Make GUI2
$GUI2 = GUICreate("GUI2")
$button2=GUICtrlCreateButton("button2", 50, 50)
GUICtrlSetOnEvent($button2,"action2")

;Show GUI1
GUIsetstate(@SW_SHOW,$GUI1)

;Wait around
While 1
    sleep (1000)
WEnd

;Button1 is pressed...
func action1 ()
    GUISetState(@SW_SHOW,$GUI2)
               ;show GUI2 then wait around
    while 1
        sleep (1000)
    WEnd
endfunc

;when button2 is pressed this function IS NOT CALLED
func action2 ()
    MsgBox(0,"OK","You pressed button2")
endfunc

Maybe that will help simplify things... Basically it's calling a function from inside a funcion

Edited by evilertoaster

Share this post


Link to post
Share on other sites



change this

func action1 ()

GUISetState(@SW_SHOW,$GUI2)

;show GUI2 then wait around

while 1

sleep (1000)

WEnd

endfunc

to this

func action1 ()

GUISetState(@SW_SHOW,$GUI2)

endfunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

This works but the problem is that in my actual code i'm doing somthing in that while loop that you removed.

I guess i just need to know why this is doing it... can GUI OnEvents not be called from functions?

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