Search the Community
Showing results for tags 'redraw'.
-
I am seeing a buttons position change when the following happens. 1. GUI created at 800 x 600 2. GUI info is stored using WinGetPos 3. GUI changed to full-screen using WinMove 4. Button info is stored using ControlGetPos 5. Button is deleted 6. Button is re-created using the stored data from item 4. 7. GUI is restored to the info gathered in item 2. The button starts with this info: Button Left: 408 Button Top: 84 Button Width: 80 Button Height: 24 and after the events above the button has this info: Button Left: 409 Button Top: 83 Button Width: 80 Button Height: 24 Here is some code that can reproduce the issue: (press space, f, space, f, then look in the console) #Region Includes #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <Array.au3> #EndRegion Includes Const $HT_KEY_FULLSCREEN = "f" Const $HT_KEY_SPACE = "{SPACE}" Global $btnAddRebuy[21] Global $btnRemovePlayer[21] Global $fFullscreen = False Global $aGuiInfo Global $aGuiInfo2 Global $guiWidth = 800 Global $guiHeight = 600 #Region Dimensions for Settings Screen ; Player Global $lblPlayerTop = 60 Global $playerLabelSpace = 24 ; Add Rebuy Button Global $btnRebuyLeft = 320 Global $btnRebuyWidth = 80 Global $btnRebuyHeight = 24 ; Remove Player Global $btnRemoveLeft = 408 Global $btnRemoveWidth = 80 Global $btnRemoveHeight = 24 #EndRegion Dimensions for Settings Screen $hMain = GUICreate("Timer", $guiWidth, $guiHeight, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) For $i = 1 To 5 Step 1 $btnAddRebuy[$i] = GUICtrlCreateButton("Button", $btnRebuyLeft, $lblPlayerTop + ($playerLabelSpace * $i), $btnRebuyWidth, $btnRebuyHeight) GUICtrlSetResizing($btnAddRebuy[$i], $GUI_DOCKAUTO) GuiCtrlSetState($btnAddRebuy[$i], $GUI_DISABLE) $btnRemovePlayer[$i] = GUICtrlCreateButton("Button", $btnRemoveLeft, $lblPlayerTop + ($playerLabelSpace * $i), $btnRemoveWidth, $btnRemoveHeight) ;GUICtrlSetResizing($btnRemovePlayer[$i], $GUI_DOCKAUTO) Next GUISetState(@SW_SHOW) HotKeySet($HT_KEY_FULLSCREEN, "Fullscreen") HotKeySet($HT_KEY_SPACE, "Redraw") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd Func Fullscreen() If WinActive($hMain) Then If $fFullscreen Then ;GUISetStyle(BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS), Default, $hMain) $aGuiInfo2 = WinGetPos($hMain) ConsoleWrite("******* Fullscreen *******" & @LF) ConsoleWrite("Win Left: " & $aGuiInfo2[0] & @LF) ConsoleWrite("Win Top: " & $aGuiInfo2[1] & @LF) ConsoleWrite("Win Width: " & $aGuiInfo2[2] & @LF) ConsoleWrite("Win Height: " & $aGuiInfo2[3] & @LF & @LF) ;WinMove($hMain, Default, $aGuiInfo[0], $aGuiInfo[1], $aGuiInfo[2], $aGuiInfo[3]) WinMove($hMain, Default, 238, 179, 816, 638) $fFullscreen = False $aCtrlInfo = ControlGetPos($hMain, "", $btnRemovePlayer[1]) ConsoleWrite("******* Button Info after Restored *******" & @LF) ConsoleWrite("Button Left: " & $aCtrlInfo[0] & @LF) ConsoleWrite("Button Top: " & $aCtrlInfo[1] & @LF) ConsoleWrite("Button Width: " & $aCtrlInfo[2] & @LF) ConsoleWrite("Button Height: " & $aCtrlInfo[3] & @LF & @LF) Else ;GUISetStyle($WS_POPUP, Default, $hMain) $aGuiInfo = WinGetPos($hMain) ConsoleWrite("******* Start Size *******" & @LF) ConsoleWrite("Win Left: " & $aGuiInfo[0] & @LF) ConsoleWrite("Win Top: " & $aGuiInfo[1] & @LF) ConsoleWrite("Win Width: " & $aGuiInfo[2] & @LF) ConsoleWrite("Win Height: " & $aGuiInfo[3] & @LF & @LF) WinMove($hMain, Default, 0, 0, @DesktopWidth, @DesktopHeight) $fFullscreen = True $aCtrlInfo = ControlGetPos($hMain, "", $btnRemovePlayer[1]) ConsoleWrite("******* Button Info after Fullscreened *******" & @LF) ConsoleWrite("Button Left: " & $aCtrlInfo[0] & @LF) ConsoleWrite("Button Top: " & $aCtrlInfo[1] & @LF) ConsoleWrite("Button Width: " & $aCtrlInfo[2] & @LF) ConsoleWrite("Button Height: " & $aCtrlInfo[3] & @LF & @LF) EndIf Else HotKeySet($HT_KEY_FULLSCREEN) Send($HT_KEY_FULLSCREEN) HotKeySet($HT_KEY_FULLSCREEN, "Fullscreen") EndIf EndFunc Func Redraw() Local $aCtrlInfo $aCtrlInfo = ControlGetPos($hMain, "", $btnRemovePlayer[1]) ConsoleWrite("******* Button Info before Redraw *******" & @LF) ConsoleWrite("Button Left: " & $aCtrlInfo[0] & @LF) ConsoleWrite("Button Top: " & $aCtrlInfo[1] & @LF) ConsoleWrite("Button Width: " & $aCtrlInfo[2] & @LF) ConsoleWrite("Button Height: " & $aCtrlInfo[3] & @LF & @LF) GuiCtrlDelete($btnRemovePlayer[1]) $btnRemovePlayer[1] = GUICtrlCreateButton("Button", $aCtrlInfo[0], $aCtrlInfo[1], $aCtrlInfo[2], $aCtrlInfo[3]) ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $aCtrlInfo = ControlGetPos($hMain, "", $btnRemovePlayer[1]) ConsoleWrite("******* Button Info after Redraw *******" & @LF) ConsoleWrite("Button Left: " & $aCtrlInfo[0] & @LF) ConsoleWrite("Button Top: " & $aCtrlInfo[1] & @LF) ConsoleWrite("Button Width: " & $aCtrlInfo[2] & @LF) ConsoleWrite("Button Height: " & $aCtrlInfo[3] & @LF & @LF) EndFunc Is there a way to fix this, or is the issue built in to how windows get resized?
- 5 replies
-
- fullscreen
- button
-
(and 5 more)
Tagged with: