Jump to content

[SOLVED] ChildWindow Bug?


Recommended Posts

Hi,

I have a problem with creating child windows for a main gui. It worked just fine on the stable release afaik.

I have not checked the latest beta (3.2.13.2) yet, but according to the change log, nothing like this have been changed as far as I can see.

More information commented in the code.

Does this work for you? Am I doing anything obviously wrong?

I apologize if this has been reported from before (and is fixed).

EDIT:

Fixed a typing mistake in the example code.

Problem does still exist.

EDIT2:

Fixed in 3.2.13.1 Beta and higher.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.13.0 (beta)
 Author:         Encoded

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; The main GUI opens just fine. When you press the Exit button, the program quits as it should. However, when clicking the ChildWindow button,
; the program freezes, and so does the exit button. The child window does not appear at all. Is this a bug with AutoIt 3.2.13.0 Beta?
; Everything works just fine without the extra child window code.
; This worked fine on the stable release.

#NoTrayIcon
#include <GUIConstants.au3>
#include <WindowsConstants.au3>

$aAppName        = "Bug: ChildWindow" 
$aParentWindow   = GUICreate($aAppName, 200, 90, -1, -1)
$Button_Test     = GUICtrlCreateButton($aAppName, 10, 10, 180, 30)
$Button_Exit     = GUICtrlCreateButton("Exit", 10, 50, 180, 30)
                   GUICtrlSetState(-1, $GUI_DEFBUTTON)
GUISetState(@SW_SHOW)

While 1
    Dim $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button_Exit
            Exit
        Case $Button_Test
            $ChildWindow        = GUICreate("ChildWindow", 300, 200, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU), $WS_EX_MDICHILD, $aParentWindow)
                                ; GUICreate("ChildWindow", 300, 200, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU), -1, $aParentWindow)   <-- I have tried this way
                                ; GUICreate("ChildWindow", 300, 200, -1, -1, -1, $WS_EX_MDICHILD, $aParentWindow)               <-- And this way
            $CloseChildButton   = GUICtrlCreateButton("Close", 10, 160, 280, 30)
            GUISetState(@SW_SHOW)
            While 1
                Dim $cMsg = GUIGetMsg()
                Select
                    Case $cMsg = $GUI_EVENT_CLOSE
                        GUISetState(@SW_ENABLE, $aAppName)
                        GUIDelete($ChildWindow)
                        ExitLoop
                    Case $cMsg = $CloseChildButton
                        GUISetState(@SW_ENABLE, $aAppName)
                        GUIDelete($ChildWindow)
                        ExitLoop
                EndSelect
            WEnd
    EndSwitch
WEnd
Edited by Encoded
Link to comment
Share on other sites

$ChildWindow = GUICreate("ChildWindow", 300, 200, -1, -1,BitOR($WS_CAPTION, $WS_SYSMENU),$WS_EX_MDICHILD, $aParentWindow)

Edit: added back original $WS styles

Edited by ResNullius
Link to comment
Share on other sites

Thank you for correcting that ResNullius.

I wrote the example code to demonstrate this issue, which unfortunately remains the same.

Several scripts i wrote on the stable release did work with the script posted above (not with the error you found of course).

They do not work on the beta release.

Can anyone check if they have the same problem or if there are more errors in my example code?

Edited by Encoded
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...