Sign in to follow this  
Followers 0
Student_coder

Multiple Form Related

7 posts in this topic

Hi Everyone ,

Am new in Autoit Coding. Am now trying to automate something. The issue am facing is :- There are 3 Forms in my script. In every form there is close button. If I click on the close button in 1st form then it's going out of the script which is fine. But If I click the close button in the second form it's not coming back to the 1st form. So please let me know if there any solution for this.

Thanks for the help o:)

Share this post


Link to post
Share on other sites



Someone please reply me :( ..... Am stuck in between this script.

Share this post


Link to post
Share on other sites

@AutoBert :-

Ok. I will read it and try to figure it out.

Thankyou

 

 

 

 

Share this post


Link to post
Share on other sites

@AutoBert :-

Consider this code.
 

#include <GUIConstantsEx.au3>

 Global $hButton3 = 9999

 gui1()

 Func gui1()
     $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100)
     $hButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30)
     $hButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30)
     GUISetState()

     While 1
         Switch GUIGetMsg()
             Case $GUI_EVENT_CLOSE
                 ExitLoop
             Case $hButton1
                 MsgBox("", "MsgBox 1", "Test from Gui 1")
             Case $hButton2
                 GUICtrlSetState($hButton2, $GUI_DISABLE)
                 gui2()
             Case $hButton3
                 MsgBox("", "MsgBox 2", "Test from Gui 2")
         EndSwitch
     WEnd

 EndFunc   ;==>gui1

 Func gui2()
     $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350)
     $hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30)
     GUISetState()
 EndFunc   ;==>gui2

 

Here if we select GUI2 and click close button we will come out of the script. That's my problem. The same issue i found in the link that you have given.

Share this post


Link to post
Share on other sites

You had to read until end of "MessageLoop Mode" the last example is the real solution:

Quote

As you can see, we have a single While...WEnd loop which distinguishes between the two GUIs, both GUIs and their controls remain active and we stay in the main idle loop while we wait (you did read that other tutorial I hope!).

, the examples before have issues, the issue of your concept:

Quote

The script exits because it has a single GUIGetMsg loop and the $GUI_EVENT_CLOSE message is received when either [X] is clicked - we have no way of telling the messages from the two GUIs apart.

 

Share this post


Link to post
Share on other sites

@AutoBert

Thankyou man.......

I got it.

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