bladem2003 Posted January 14, 2023 Share Posted January 14, 2023 (edited) the second child gui window doesn't have the ex style $WS_EX_MDICHILD but it is moved with the parent gui. How can I make the second window not move and still be a child window? #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <File.au3> #include <String.au3> #include <Array.au3> $hParent = GUICreate("Parent", 500, 300) $hChild1 = GUICreate("Child1", 200, 100, -1, -1, -1, $WS_EX_MDICHILD, $hParent) $hChild2 = GUICreate("Child2", 200, 100, 100, -1, -1, -1, $hParent) GUISetState(@SW_SHOW, $hParent) GUISetState(@SW_SHOW, $hChild1) GUISetState(@SW_SHOW, $hChild2) While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Edited January 14, 2023 by bladem2003 Link to comment Share on other sites More sharing options...
Nine Posted January 15, 2023 Share Posted January 15, 2023 What is it you want the second window to react to ? 1- Not move when parent moves 2- ? 3- ? etc Your question is somewhat vague... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
bladem2003 Posted January 16, 2023 Author Share Posted January 16, 2023 (edited) i want that child1 move with the parent and child2 not move. in the example above, both windows are moved with the parent. Edited January 16, 2023 by bladem2003 Link to comment Share on other sites More sharing options...
AutoBert Posted January 16, 2023 Share Posted January 16, 2023 (edited) Don't use the $WS_EX_MDICHILD Extended Style in any childgui of $hParent and handle the moving yourself with with ControlGetPos, ControlMove. Don't know it's a bug (one 1 MDIChild causes all Childs are MDIChilds) ore a feature. Edited January 16, 2023 by AutoBert Link to comment Share on other sites More sharing options...
Werty Posted January 16, 2023 Share Posted January 16, 2023 Setting Child2 to Child1 instead of Parent1 seems to do what you want. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <File.au3> #include <String.au3> #include <Array.au3> $hParent = GUICreate("Parent", 500, 300) $hChild1 = GUICreate("Child1", 200, 100, -1, -1, -1, $WS_EX_MDICHILD, $hParent) $hChild2 = GUICreate("Child2", 200, 100, 100, -1, -1, -1, $hChild1) GUISetState(@SW_SHOW, $hParent) GUISetState(@SW_SHOW, $hChild1) GUISetState(@SW_SHOW, $hChild2) While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
AutoBert Posted January 16, 2023 Share Posted January 16, 2023 (edited) can be deleted Edited January 16, 2023 by AutoBert Link to comment Share on other sites More sharing options...
pixelsearch Posted January 16, 2023 Share Posted January 16, 2023 (edited) @Werty the problem when using your script is that minimizing child1 automatically minimizes child2 (if I'm not mistaken) Back to 2015, Yashied wrote in this link : If you read about the MDI windows in MSDN, it becomes clear that the work with these windows is slightly different from the standard windows. I'm not sure what it's all natively supported in AutoIt. AutoIt help file stipulates : $WS_EX_MDICHILD Create a child window that will be moved with its parent (simulation of a MDI window maximize/minimize are not simulated). But this is very far from a real MDI interface as shown in this msdn pic... ... where 3 type of windows are involved : 1) a Frame window (initial GUI) 2) a MDI client window, which is displayed in the client area of the frame window. This MDI client window is a child of the frame window. 3) Child windows whose parent is the MDI client window. These child windows have a WS_EX_MDICHILD extended style. As read on msdn : Many new and intermediate users find it difficult to learn to use MDI applications. Therefore, you should consider other models for your user interface. Maybe that's why developers just picked the extended style $WS_EX_MDICHILD, only to allow "a window to be moved with its parent", but we can see the side effect in OP's script, where his $hChild2 moves when not requested, though it doesn't have a $WS_EX_MDICHILD extended style. Edited January 17, 2023 by pixelsearch typo Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now