Sign in to follow this  
Followers 0
toothyXdip

open wnd from main wnd

2 posts in this topic

#1 ·  Posted (edited)

ok i want to know is there a way to have a main window open (dummy) and from that have a button/menu that you can click/goto and it will open another window (dummy) and in that one have lables and all the other stuff.

I tryed but it opened the secondary window not the main window...i want to go from the main TO the secondary not start off with the secondary.

can i do that? cause i dont want to have to use msgbox's all the time for my program

so pretty much i want to open one window from anther window

(i still need help with #1)

Edited by toothyXdip

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝

Share this post


Link to post
Share on other sites



ok i want to know is there a way to have a main window open (dummy) and from that have a button/menu that you can click/goto and it will open another window (dummy) and in that one have lables and all the other stuff.

I tryed but it opened the secondary window not the main window...i want to go from the main TO the secondary not start off with the secondary.

can i do that? cause i dont want to have to use msgbox's all the time for my program

so pretty much i want to open one window from anther window

(i still need help with #1)

Try this. This might help you get on your way. It's not perfect but it may give you ideas on how to expand it to do what you want. As it is, this code will open another GUI/Window that will perform other functions. However while the 2nd window is open you cannot do anything on the main window until you finish and close the 2nd window. Like I said its not perfect but I've never been able to do things with multiple windows in the same script. You usually have to close the child windows first. If anyone has a better method by all means post it. :whistle:

#include <GUIConstants.au3>

dim $Var1_CHKBOX
dim $RUN
dim $EXIT
dim $VarStatus1
Dim $GUINAME = "Main Window"
Dim $GUINAME2 = "Another Window"
GUICreate ($GUINAME,300,450)
GUISetFont(14,600)
GUICtrlCreateLabel($GUINAME,90,80)
GUISetFont(9,400)
$Var1_CHKBOX = GUICtrlCreateCheckbox("Some function to run",10,130)  ;Checkbox 1
$RUN = GUICtrlCreateButton("Run",10,350,120,20)  ;This is the Run button
$EXIT = GUICtrlCreateButton("Exit",168,350,120,20)  ;This is to exit the application
$OpenGUI2 = GUICtrlCreateButton("GUI 2",85,390,120,20)  ;This is the Run button
GUISetState()

CAll("Main")

Func Main()
While 1
     $msg = GUIGetMsg()
     $VarStatus1 = GUICtrlRead($Var1_CHKBOX)
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $EXIT
            Exit
        Case $msg = $RUN            
            If $VarStatus1 = 1 Then Call("ITEM_1")
        Case $msg = $OpenGUI2
            Call("New_Gui")
        EndSelect
WEnd
EndFunc
     
Func New_Gui()
    GUICreate ($GUINAME2,300,450)    
    GUISetFont(14,600)
    GUICtrlCreateLabel($GUINAME2,70,80)
    GUISetFont(9,400)
    $GUI2Var1_CHKBOX = GUICtrlCreateCheckbox("Another function to run",10,130)  ;Checkbox 1
    $RUN2 = GUICtrlCreateButton("Run",10,350,120,20)  ;This is the Run button
    $EXIT2 = GUICtrlCreateButton("Exit",168,350,120,20)  ;This is to exit the application
    GUISetState()
    
    While 1
        $msg = GUIGetMsg()
        $GUI2VarStatus1 = GUICtrlRead($GUI2Var1_CHKBOX)
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $EXIT2
            GUIDelete($GUINAME2)
            CAll("Main")
        Case $msg = $RUN2
            If $GUI2VarStatus1 = 1 Then Call("GUI2ITEM_1")
        EndSelect
WEnd
    EndFunc
;The list of functions to run from either GUI
Func ITEM_1()
    MsgBox(64, $GUINAME, "Some function to run.", 10)
EndFunc

Func GUI2ITEM_1()
    MsgBox(64, $GUINAME2, "Another function to run on GUI 2.", 10)
EndFunc

Hope this helps!


EndFuncAutoIt is the shiznit. I love 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