madflame991 Posted August 13, 2008 Share Posted August 13, 2008 Hello! I followed the simple example from the help file on creating windows and moving them... I created a child window (and it's parent); the parent window has $WS_POPUP and WS_MAXIMIZE; Why does the child window move in the example below? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $gui, $background, $pic, $basti_stay, $msg Dim $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\logo4.gif" Dim $X = 10, $Y = 300 $gui = GUICreate("Background", 400, 100,-1,-1,$WS_POPUP+$WS_MAXIMIZE) $background = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg", 0, 0, 400, 100) GUISetState(@SW_SHOW) $pic = GUICreate("", 169, 68, $X, $Y, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_MDICHILD, $gui) $basti_stay = GUICtrlCreatePic($sFile, 0, 0, 169, 68) GUISetState(@SW_SHOW) Sleep(2000) WinMove($pic,'',$X,$Y);it's the same $X and $Y and yet it moves... why? Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Game Game Gadget! - read about indie games, gadgets, chiptunes and demoscenesAssembly-like language interpreter and custom machine emulatorSuper Mario Screen Mate - official website or autoit forum pageCogut - Puzzle Game + Editor like sokoban and others Link to comment Share on other sites More sharing options...
therks Posted August 13, 2008 Share Posted August 13, 2008 (edited) When the control is created initially it's not at those exact coordinates. It's at 13 by 322, I'm not sure exactly why though. Either way when you use WinMove it replaces it to the actual coordinates. And off topic, adding styles together is a big no-no. Should always use BitOR. ie: Instead of $WS_POPUP+$WS_MAXIMIZE Use BitOR($WS_POPUP, $WS_MAXIMIZE) Edited August 13, 2008 by RobSaunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
madflame991 Posted August 13, 2008 Author Share Posted August 13, 2008 Thx for the tip on using BitOr when summing hex values... I used the basic "+" operator because I thought it was a bit faster than calling a function.When the control is created initially it's not at those exact coordinates.That's what I'm trying to do... create the child window at those exact coordinates. Anyone who knows how to do it please post here. Game Game Gadget! - read about indie games, gadgets, chiptunes and demoscenesAssembly-like language interpreter and custom machine emulatorSuper Mario Screen Mate - official website or autoit forum pageCogut - Puzzle Game + Editor like sokoban and others Link to comment Share on other sites More sharing options...
YellowLab Posted August 13, 2008 Share Posted August 13, 2008 I had this issue once before and found it has to do with the border styles of the different windows. You need to add a fudge factor to the child window to prevent it from moving - it should be moving up and to the left (up and to the left) because the border of the child window is thinner than that of the main GUI. Bob You can't see a rainbow without first experiencing the rain. Link to comment Share on other sites More sharing options...
madflame991 Posted August 14, 2008 Author Share Posted August 14, 2008 So... Is there any way to completely remove the borders of a window? I thought $WS_POPUP didn't just turn the borders invisible... Game Game Gadget! - read about indie games, gadgets, chiptunes and demoscenesAssembly-like language interpreter and custom machine emulatorSuper Mario Screen Mate - official website or autoit forum pageCogut - Puzzle Game + Editor like sokoban and others Link to comment Share on other sites More sharing options...
therks Posted August 17, 2008 Share Posted August 17, 2008 I thought it should work normal too, but I guess not. Any reason it has to be in place at creation time? You could just do WinMove() before GUISetState(). Also, as to your comment about BitOR, I'm honestly not sure which is faster (though the difference should be negligible anyway) but adding values together can potentially yield unexpected results, BitOR is the proper way to combine styles. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 17, 2008 Share Posted August 17, 2008 (edited) The deal is that when you create a child window at 0x0 it will be created where the client coords would be if it was a "normal" window. It is solvable by a little math like this in the example below. (I used this method in Franks Gadgets) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $gui, $background, $pic, $basti_stay, $msg Dim $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\logo4.gif" Dim $X = 10, $Y = 300, $Correction[2] $GUIWindows = GUICreate("Windows test", 32, 32, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW) $GUIWindows2 = GUICreate("Windows test2", 32, 32, 0, 0, $WS_POPUP, BitOR($WS_CLIPCHILDREN, $WS_EX_MDICHILD, $WS_EX_TOOLWINDOW), $GUIWindows) $Pos4 = WinGetPos($GUIWindows2) GUIDelete($GUIWindows2) GUIDelete($GUIWindows) $Correction[0] = "-" & $Pos4[0] ;This make sure all "ChildGui"s is created on the right spot (0,0) $Correction[1] = "-" & $Pos4[1] ;This make sure all "ChildGui"s is created on the right spot (0,0) $gui = GUICreate("Background", 400, 100,-1,-1, BitOR($WS_POPUP, $WS_MAXIMIZE)) $background = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg", 0, 0, 400, 100) GUISetState(@SW_SHOW) $pic = GUICreate("", 169, 68, $Correction[0]+$X, $Correction[1]+$Y, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui) $basti_stay = GUICtrlCreatePic($sFile, 0, 0, 169, 68) GUISetState(@SW_SHOW) Sleep(2000) WinMove($pic,'',$X,$Y);it's the same $X and $Y and yet it moves... why? Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Edited August 17, 2008 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
ahshayou Posted August 17, 2008 Share Posted August 17, 2008 is this for cabal ? Link to comment Share on other sites More sharing options...
madflame991 Posted August 18, 2008 Author Share Posted August 18, 2008 Thanks guys! @AdmiralAlkex: the script solves the problem... Game Game Gadget! - read about indie games, gadgets, chiptunes and demoscenesAssembly-like language interpreter and custom machine emulatorSuper Mario Screen Mate - official website or autoit forum pageCogut - Puzzle Game + Editor like sokoban and others 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