MrCreatoR Posted July 16, 2007 Share Posted July 16, 2007 (edited) Hi all... I am trying to create a child window, that must move with his parent (when the parent moved, the child must move with it)... From the help file: $WS_EX_MDICHILD -> Create a child window that will be moved with its parent. (simulation of a MDI window maximize/minimize are not simulated). I am trying like this: #include <GuiConstants.au3> $Gui = GuiCreate("Test", 300, 200) $ChildGui = GuiCreate("Child test", 300, 200, -1, -1, -1, $WS_EX_MDICHILD, $Gui) $ParentPosArr = WinGetPos($Gui) WinMove($ChildGui, "", $ParentPosArr[0]+$ParentPosArr[2], $ParentPosArr[1]) GUISetState(@SW_SHOW, $Gui) GUISetState(@SW_SHOW, $ChildGui) While 1 $Msg = GUIGetMsg(1) Select Case $Msg[1] = $Gui And $Msg[0] = -3 Exit EndSelect WEnd But only what i get, is some strange "effect" - the window of parent gui is kind of copying itself, and the screen is filed with it's "tail"... (until we minimize or close the parent window) How to get it work? (move child widow with parent without any strange "effects"). P.S I know that it's possible to do it using WinMove/WinGetPos etc... but why it's wont work with this style? (it also will save to as many lines of code). Edited July 17, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Siao Posted July 16, 2007 Share Posted July 16, 2007 The child is being moved alright, it's just the repaint that gets messed up for some reason. Here's my lolsome solution: #include <GuiConstants.au3> $Gui = GuiCreate("Test", 300, 200) $ChildGui = GuiCreate("Child test", 300, 200, -1, -1, -1, $WS_EX_MDICHILD, $Gui) $ParentPosArr = WinGetPos($Gui) WinMove($ChildGui, "", $ParentPosArr[0]+$ParentPosArr[2], $ParentPosArr[1]) GUISetState(@SW_SHOW, $Gui) GUISetState(@SW_SHOW, $ChildGui) GUIRegisterMsg(0x231, "On_WM_ENTERSIZEMOVE") GUIRegisterMsg(0x232, "On_WM_EXITSIZEMOVE") While 1 $Msg = GUIGetMsg(1) Select Case $Msg[1] = $Gui And $Msg[0] = -3 Exit EndSelect WEnd Func On_WM_ENTERSIZEMOVE() WinSetTrans($ChildGui, '', 254) EndFunc Func On_WM_EXITSIZEMOVE() WinSetTrans($ChildGui, '', 255) EndFunc There's a better way of doing it than this workaround, but I'm no GUI expert, so go from here on your own if you want. Maybe WM_PAINT or something... vicmc 1 "be smart, drink your wine" Link to comment Share on other sites More sharing options...
evilertoaster Posted July 16, 2007 Share Posted July 16, 2007 #include <GuiConstants.au3> $Gui = GuiCreate("Test", 300, 200) $ChildGui = GuiCreate("Child test", 300, 200, -1, -1, -1,-1, $Gui) $ParentPosArr = WinGetPos($Gui) WinMove($ChildGui, "", $ParentPosArr[0]+$ParentPosArr[2], $ParentPosArr[1]) GUISetState(@SW_SHOW, $Gui) GUIRegisterMsg (0x0003,"Move") GUISetState(@SW_SHOW, $ChildGui) GUIRegisterMsg (0x0003,"Move") While 1 $Msg = GUIGetMsg(1) Select Case $Msg[1] = $Gui And $Msg[0] = -3 Exit EndSelect WEnd func Move($hWndGUI) if $hWndGUI=$Gui then $ParentPosArr = WinGetPos($Gui) WinMove($ChildGui, "", $ParentPosArr[0]+$ParentPosArr[2], $ParentPosArr[1]) Else $ChildPosArr = WinGetPos($ChildGui) WinMove($Gui, "", $ChildPosArr[0]-$ChildPosArr[2], $ChildPosArr[1]) EndIf EndFunc Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 17, 2007 Author Share Posted July 17, 2007 Thanks guys for the solution, but what i can not understand, is why the style $WS_EX_MDICHILD not working as it suppouse to, maby i should report about it as possible bug? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
evilertoaster Posted July 17, 2007 Share Posted July 17, 2007 http://en.wikipedia.org/wiki/Multiple_document_interfaceMDI child windows are made so you can have a child window inside and parent window, not outside. 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