Jump to content
Sign in to follow this  
dmorand

Trying to create multiple windows

Recommended Posts

dmorand

I have an application that I'm building, and I want to have another window open when the user selects "Create New" from a Menu. How do I manage the new window once it's open? I'm able to get the window open, but I can't figure out how to manage the new window.

Here is a code snippet....

$ApplicationMenu = GUICtrlCreateMenu("Application")
$NewItem = GUICtrlCreateMenuItem("Create New", $ApplicationMenu)
$EditItem = GUICtrlCreateMenuItem("Edit Existing", $ApplicationMenu)
$DeleteItem = GUICtrlCreateMenuItem("Delete", $ApplicationMenu)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $QuitItem
            Exit
        Case $BagelItem
            Run('notepad \\isops\analysts\_Application_Launcher\bagel_list_v2.txt');
        Case $ReleaseItem
            Run('notepad \\ISOPS\Analysts\_Application_Launcher\Application_Launcher_help.txt');
        Case $AboutItem 
        Case $NewItem
        ;$FormNew = GUICreate("", 400, 200, 280, 160)
            $Form1_1 = GUICreate("Create New Application", 540, 140, 250, 175,"","",$Form1)
            $Group1 = GUICtrlCreateGroup("Application Details", 8, 8, 529, 129)
            $Combo1 = GUICtrlCreateCombo("Combo1", 104, 24, 169, 25)
            $Input1 = GUICtrlCreateInput("Description", 104, 48, 185, 21)
            GUICtrlCreateInput("Please copy the path needed to launch", 104, 72, 425, 21)
            $Create = GUICtrlCreateButton("Create", 160, 104, 65, 25, 0)
            $Cancel = GUICtrlCreateButton("Cancel", 232, 104, 65, 25, 0)
            $Please = GUICtrlCreateLabel("Application Group:", 16, 24, 91, 17)
            $Label1 = GUICtrlCreateLabel("Description:", 40, 48, 60, 17)
            $Label2 = GUICtrlCreateLabel("Path:", 72, 72, 29, 17)
            GUICtrlCreateGroup("", -99, -99, 1, 1)

            GUISetState(@SW_SHOW)
        case $appChoser
            $group_sel = GUICtrlRead($appChoser)
            _buildList($group_sel)
        Case $launch_app_btn
            _GetApplication()
    EndSwitch
WEnd

I tried putting the GUIGetMsg() logic after my GUISetState(@SW_SHOW) statement, but that didn't allow for me to read the form controls.

Share this post


Link to post
Share on other sites
dmorand

I was being dumb, I got it working...but how do I close the new window without exiting my entire application?

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $QuitItem
            Exit
        Case $BagelItem
            Run('notepad \\isops\analysts\_Application_Launcher\bagel_list_v2.txt');
        Case $ReleaseItem
            Run('notepad \\ISOPS\Analysts\_Application_Launcher\Application_Launcher_help.txt');
        Case $AboutItem 
            MsgBox(0,"About","Application Launcher - HealthAlliance Hospital" & @CRLF & "-------------------------------------------------------" & @CRLF & "Version: 2.0" & @CRLF & "Revision Date: 01/09/2009" & @CRLF & "Author: Douglas Morand" & @CRLF & @CRLF & "Email: dmorand@healthalliance.com")
        Case $NewItem
            $NewForm = GUICreate("Create New Application", 540, 140, 250, 175)
            $Group1 = GUICtrlCreateGroup("Application Details", 8, 8, 529, 129)
            $Combo1 = GUICtrlCreateCombo("Combo1", 104, 24, 169, 25)
            $Input1 = GUICtrlCreateInput("Description", 104, 48, 185, 21)
            GUICtrlCreateInput("Please copy the path needed to launch", 104, 72, 425, 21)
            $Create = GUICtrlCreateButton("Create", 160, 104, 65, 25, 0)
            $Cancel = GUICtrlCreateButton("Cancel", 232, 104, 65, 25, 0)
            $Please = GUICtrlCreateLabel("Application Group:", 16, 24, 91, 17)
            $Label1 = GUICtrlCreateLabel("Description:", 40, 48, 60, 17)
            $Label2 = GUICtrlCreateLabel("Path:", 72, 72, 29, 17)
            GUICtrlCreateGroup("", -99, -99, 1, 1)
            GUISetState(@SW_SHOW)
            While 1
                $subMsg = GUIGetMsg()
                Switch $subMsg
                    Case $Cancel

                    Case $Create
                        MsgBox(0,"","Hello!!")
                EndSwitch
            WEnd
            GUISetState($Form1)
        case $appChoser
            $group_sel = GUICtrlRead($appChoser)
            _buildList($group_sel)
        Case $launch_app_btn
            _GetApplication()
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
rasim

but how do I close the new window without exiting my entire application?

Asked many times. Example

Share this post


Link to post
Share on other sites
dmorand

Asked many times. Example

Thanks, I did search through the forums, but must have been looking for the wrong topics.

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  

×