Sign in to follow this  
Followers 0
Marklar

Opening Multiple Child Windows

7 posts in this topic

#1 ·  Posted (edited)

I have a main window which shows my menu. I click on a menu item and it opens a new child window. I click on the main menu again, with the child window open or minimized, and select something else so that I can have two child windows open.

But, if i had a menu, or button, in the first child window that opened... It will open up the second child window just fine.

How come the window underneath wont respond to anything I click on? Any examples of multitasking/multiwindowed autoit apps?

Edited by Marklar

Share this post


Link to post
Share on other sites



I don't think I understand. Could you clarify this a bit?


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

With this code here. I can only open Child Window A or Child Window B but not Both at the same time.

#include <GUIconstants.au3>

$main_window = GUICreate("My GUI menu",300,200)

$menu = GUICtrlCreateMenu ("Windows")
$menuitem1 = GUICtrlCreateMenuitem ("Child Window A",$menu)
$menuitem2 = GUICtrlCreateMenuitem ("Child Window B",$menu)

GUISetState()
While 1
    $msg = GUIGetMsg(1)
    Select
    case $msg[0] = $menuitem1 AND $msg[1] = $main_window
        child_a()
    Case $msg[0] = $menuitem2 AND $msg[1] = $main_window
        child_b()
    case $msg[0] = $GUI_EVENT_CLOSE AND $msg[1] = $main_window
        ExitLoop
    EndSelect
WEnd
Exit

Func child_a()
    $child_a = GUICreate("Child Window A",200,200,-1,-1,-1,-1,$main_window)
    
    GUISetState()
    While 1
        $cmsga = GUIGetMsg(1)
        Select
        case $cmsga[0] = $GUI_EVENT_CLOSE AND $cmsga[1] = $child_a
            ExitLoop
        EndSelect
    WEnd
    GUISetState(@SW_HIDE,$child_a)
    Return
EndFunc

Func child_b()
    $child_b = GUICreate("Child Window B",200,200,-1,-1,-1,-1,$main_window)
    
    GUISetState()
    While 1
        $cmsgb = GUIGetMsg(1)
        Select
        case $cmsgb[0] = $GUI_EVENT_CLOSE AND $cmsgb[1] = $child_b
            ExitLoop
        EndSelect
    WEnd
    GUISetState(@SW_HIDE,$child_b)
    Return
EndFunc
Edited by Marklar

Share this post


Link to post
Share on other sites

O, but that's not very surprising, because as soon as you create one window, your script gets stuck in that window's while loop, and it's GuiGetMsg doesn't check for the menu-event. I will post an updated version in some minutes :D

Alzo


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Think this should work:

#include <GUIconstants.au3>

$main_window = GUICreate("My GUI menu",300,200)

$menu = GUICtrlCreateMenu ("Windows")
$menuitem1 = GUICtrlCreateMenuitem ("Child Window A",$menu)
$menuitem2 = GUICtrlCreateMenuitem ("Child Window B",$menu)

Dim $child_a, $child_b

GUISetState()
While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
    case $menuitem1
        child_a()
    Case $menuitem2
        child_b()
    case $GUI_EVENT_CLOSE
        Switch $msg[1]
            Case $main_window
                Exit
            Case $child_a
                GUIDelete($child_a)
            Case $child_b
                GUIDelete($child_B)
        EndSwitch
    EndSwitch
WEnd
Exit

Func child_a()
    $child_a = GUICreate("Child Window A",200,200)
    GUISetState()
EndFunc

Func child_b()
    $child_b = GUICreate("Child Window B",200,200)
    GUISetState()
EndFunc

Alzo


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

oh... so i just need to do something like this?

case $cmsgb[0] = $menuitem1 AND $cmsgb[1] = $main_window

child_a()

Saw your post... that would be easier.. thanks

Edited by Marklar

Share this post


Link to post
Share on other sites

YWC


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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