ioa747 Posted Friday at 02:28 PM Share Posted Friday at 02:28 PM (edited) Resize and reposition the GUI controls when the user drags the $DragBar. the $DragBar is invisible, move the mouse between $List1 and $Edit1 and you will see the change in the cursor, then you can do it expandcollapse popup; https://www.autoitscript.com/forum/topic/212020-drag-adjust/ ;---------------------------------------------------------------------------------------- ; Title...........: _DragAdjust.au3 ; Description.....: Resize and reposition the GUI controls when the user drags the $DragBar. ; AutoIt Version..: 3.3.16.1 Author: ioa747 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <WinAPIGdi.au3> Global $iGuiW = 600, $iMargin = 4 Global $hGUI = GUICreate("Form1", $iGuiW, 315, 205, 130) Global $Combo1 = GUICtrlCreateCombo("Combo1", $iMargin, $iMargin, 196, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) Global $List1 = GUICtrlCreateList("", $iMargin, 30, 196, 285) Global $Edit1 = GUICtrlCreateEdit("Edit1", 204, $iMargin, 392, 305) Global $DragBar = GUICtrlCreateLabel("", 200, 0, $iMargin, 315, $SS_CENTERIMAGE, $WS_EX_LAYERED) GUICtrlSetCursor(-1, 13) GUISetState(@SW_SHOW) ;********************************** While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch _DragAdjust() Sleep(10) WEnd ;********************************** Func _DragAdjust() Local Static $iOffset = $iMargin / 2 If Not WinActive($hGUI) Then Return SetError(1, 0, False) Local $ActiveCtrl Local $aCtrl = GUIGetCursorInfo($hGUI) $ActiveCtrl = IsArray($aCtrl) ? $aCtrl[4] : 0 If $ActiveCtrl = $DragBar Then Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client If $aCtrl[2] = 1 Then ;Primary down While $aCtrl[2] $aCtrl = GUIGetCursorInfo($hGUI) Local $iMp = MouseGetPos(0) < $iMargin ? $iMargin : MouseGetPos(0) > ($iGuiW - $iMargin) ? $iGuiW - $iMargin : MouseGetPos(0) GUICtrlSetPos($DragBar, $iMp - $iOffset) GUICtrlSetPos($Combo1, $iMargin, Default, $iMp - $iMargin - $iOffset) GUICtrlSetPos($List1, $iMargin, Default, $iMp - $iMargin - $iOffset) GUICtrlSetPos($Edit1, $iMp + $iOffset, Default, $iGuiW - $iMp - $iMargin - $iOffset) Sleep(10) WEnd _WinAPI_RedrawWindow($hGUI) EndIf Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client EndIf EndFunc ;==>_DragAdjust Please, every comment is appreciated! leave your comments and experiences here! Thank you very much Edited Friday at 05:19 PM by ioa747 improvement argumentum 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Numeric1 Posted Saturday at 01:56 PM Share Posted Saturday at 01:56 PM Hi, I imagine that if the user interface were to contain more controls, your code could quickly become difficult to manage, even though it is well-written. I suggest leaving everything to the message handler to optimize the code a bit. Additionally, you are making too many unnecessary calls to the control movement function, especially within a loop, which is not recommended. You could specifically target the events you need in order to handle them correctly. Here is a proposal to optimize your code. expandcollapse popup;---------------------------------------------------------------------------------------- ; Title...........: DragAdjust.au3 ; Description.....: Resize and reposition the GUI controls when the user drags the DragBar. ; AutoIt Version..: 3.3.16.1 Author: ioa747 ; Note............: Tested in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <WinAPIGdi.au3> #include <Math.au3> ; Global constants Global Const $GUI_WIDTH = 600 Global Const $GUI_HEIGHT = 315 Global Const $MARGIN = 4 Global Const $DRAGBAR_WIDTH = $MARGIN ; GUI creation Global $hGUI = GUICreate("Resizable GUI", $GUI_WIDTH, $GUI_HEIGHT, 205, 130) Global $Combo1 = GUICtrlCreateCombo("Combo1", $MARGIN, $MARGIN, 196, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) Global $List1 = GUICtrlCreateList("", $MARGIN, 30, 196, 285) Global $Edit1 = GUICtrlCreateEdit("Edit1", 204, $MARGIN, 392, 305) Global $DragBar = GUICtrlCreateLabel("", 200, 0, $DRAGBAR_WIDTH, $GUI_HEIGHT, $SS_CENTERIMAGE, $WS_EX_LAYERED) ; Set drag bar cursor GUICtrlSetCursor($DragBar, 13) GUISetState(@SW_SHOW) ; Variables to track mouse movement Global $iPrevMousePos = -1 ; Main loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN AdjustGUIControls() EndSwitch WEnd GUIDelete() ; Function to adjust GUI controls when the drag bar is moved Func AdjustGUIControls() Local Static $iOffset = $MARGIN / 2 If Not WinActive($hGUI) Then Return SetError(1, 0, False) Local $aCursorInfo = GUIGetCursorInfo($hGUI) Local $iActiveCtrl = IsArray($aCursorInfo) ? $aCursorInfo[4] : 0 Local $iPrimaryDown = 0 If $iActiveCtrl = $DragBar Then Opt("MouseCoordMode", 2) ; 1=absolute, 0=relative, 2=client Do $aCursorInfo = GUIGetCursorInfo($hGUI) $iPrimaryDown = $aCursorInfo[2] Local $iMousePos = MouseGetPos(0) $iMousePos = _Clamp($iMousePos, $MARGIN, $GUI_WIDTH - $MARGIN) ; Only update positions if the mouse has moved If $iMousePos <> $iPrevMousePos Then GUICtrlSetPos($DragBar, $iMousePos - $iOffset) GUICtrlSetPos($Combo1, $MARGIN, Default, $iMousePos - $MARGIN - $iOffset) GUICtrlSetPos($List1, $MARGIN, Default, $iMousePos - $MARGIN - $iOffset) GUICtrlSetPos($Edit1, $iMousePos + $iOffset, Default, $GUI_WIDTH - $iMousePos - $MARGIN - $iOffset) $iPrevMousePos = $iMousePos _WinAPI_RedrawWindow($hGUI) EndIf Sleep(10) Until Not $iPrimaryDown Opt("MouseCoordMode", 1) ; 1=absolute, 0=relative, 2=client EndIf EndFunc ;==>AdjustGUIControls ; Helper function to clamp a value between a minimum and maximum Func _Clamp($value, $min, $max) Return _Max($min, _Min($value, $max)) EndFunc ioa747 1 Link to comment Share on other sites More sharing options...
ioa747 Posted Sunday at 05:12 AM Author Share Posted Sunday at 05:12 AM (edited) @Numeric1 thanks for the improvement points In the new version for overlap window, I have adopted them expandcollapse popup; https://www.autoitscript.com/forum/topic/212020-drag-adjust/ ;---------------------------------------------------------------------------------------- ; Title...........: _DragAdjust.au3 ; Description.....: Resize and reposition the GUI controls when the user drags the $DragBar. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 2.0 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <ListBoxConstants.au3> #include <WinAPIGdi.au3> Global $iGuiW = 600, $iGuiH = 300, $iMargin = 4 Global $hGUI = GUICreate("Form1", $iGuiW, $iGuiH, 205, 130, $WS_OVERLAPPEDWINDOW) Global $Combo1 = GUICtrlCreateCombo("Combo1", $iMargin, $iMargin, 196, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT) ;DOCK ctrl Global $List1 = GUICtrlCreateList("", $iMargin, 29, 196, 267, BitOR($LBS_STANDARD, $LBS_NOINTEGRALHEIGHT)) Global $Edit1 = GUICtrlCreateEdit("Edit1", 204, $iMargin, 392, 292) Global $DragBar = GUICtrlCreateLabel("", 200, 0, $iMargin, 315, $SS_CENTERIMAGE, $WS_EX_LAYERED) GUICtrlSetCursor(-1, 13) GUISetState(@SW_SHOW) ;********************************** While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN _DragAdjust() Case $GUI_EVENT_RESIZED, $GUI_EVENT_MAXIMIZE _OrderPos() EndSwitch Sleep(10) WEnd ;********************************** ;-------------------------------------------------------------------------------------------------------------------------------- Func _OrderPos() Local $aWin = WinGetClientSize($hGUI) Local $aCtrl = ControlGetPos($hGUI, "", $Combo1) ;DOCK ctrl $iGuiW = $aWin[0] $iGuiH = $aWin[1] ;ConsoleWrite($iGuiW & ", " & $iGuiH & @CRLF) GUICtrlSetPos($DragBar, $iMargin + $aCtrl[2], 0, $iMargin, $iGuiH) GUICtrlSetPos($List1, $iMargin, 2 * $iMargin + $aCtrl[3], $aCtrl[2], $iGuiH - (3 * $iMargin + $aCtrl[3])) GUICtrlSetPos($Edit1, 2 * $iMargin + $aCtrl[2], $iMargin, $iGuiW - (3 * $iMargin + $aCtrl[2]), $iGuiH - (2 * $iMargin)) _WinAPI_RedrawWindow($hGUI) EndFunc ;==>_OrderPos ;-------------------------------------------------------------------------------------------------------------------------------- Func _DragAdjust() Local Static $iOffset = $iMargin / 2 Local Static $iPrevMousePos = -1 If Not WinActive($hGUI) Then Return SetError(1, 0, False) Local $ActiveCtrl Local $aCtrl = GUIGetCursorInfo($hGUI) $ActiveCtrl = IsArray($aCtrl) ? $aCtrl[4] : 0 If $ActiveCtrl = $DragBar Then Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client If $aCtrl[2] = 1 Then ;Primary down While $aCtrl[2] $aCtrl = GUIGetCursorInfo($hGUI) Local $iMousePos = MouseGetPos(0) $iMousePos = $iMousePos < $iMargin ? $iMargin : $iMousePos > ($iGuiW - $iMargin) ? $iGuiW - $iMargin : $iMousePos If $iMousePos <> $iPrevMousePos Then GUICtrlSetPos($DragBar, $iMousePos - $iOffset) GUICtrlSetPos($Combo1, $iMargin, Default, $iMousePos - $iMargin - $iOffset) GUICtrlSetPos($List1, $iMargin, Default, $iMousePos - $iMargin - $iOffset) GUICtrlSetPos($Edit1, $iMousePos + $iOffset, Default, $iGuiW - $iMousePos - $iMargin - $iOffset) $iPrevMousePos = $iMousePos EndIf Sleep(10) WEnd _WinAPI_RedrawWindow($hGUI) EndIf Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client EndIf EndFunc ;==>_DragAdjust ;-------------------------------------------------------------------------------------------------------------------------------- Edited Sunday at 05:15 AM by ioa747 Numeric1 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Numeric1 Posted Sunday at 01:12 PM Share Posted Sunday at 01:12 PM Good job! Since the movement of the controls is done in both functions, you could create a single function for that. The code could be further simplified by removing the _OrderPos function. Link to comment Share on other sites More sharing options...
ioa747 Posted yesterday at 10:53 AM Author Share Posted yesterday at 10:53 AM (edited) I incorporated them expandcollapse popup; https://www.autoitscript.com/forum/topic/212020-drag-adjust/ ;---------------------------------------------------------------------------------------- ; Title...........: _DragAdjust.au3 ; Description.....: Resize and reposition the GUI controls when the user drags the $DragBar. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 3.0 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <ListBoxConstants.au3> #include <WinAPIGdi.au3> Global $iGuiW = 600, $iGuiH = 300, $iMargin = 4 Global $hGUI = GUICreate("Form1", $iGuiW, $iGuiH, 205, 130, $WS_OVERLAPPEDWINDOW) Global $Combo1 = GUICtrlCreateCombo("Combo1", $iMargin, $iMargin, 196, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT) ;DOCK ctrl Global $List1 = GUICtrlCreateList("", $iMargin, 29, 196, 267, BitOR($LBS_STANDARD, $LBS_NOINTEGRALHEIGHT)) Global $Edit1 = GUICtrlCreateEdit("Edit1", 204, $iMargin, 392, 292) Global $DragBar = GUICtrlCreateLabel("", 200, 0, $iMargin, 315, $SS_CENTERIMAGE, $WS_EX_LAYERED) GUICtrlSetCursor(-1, 13) GUISetState(@SW_SHOW) ;********************************** While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN _DragAdjust() Case $GUI_EVENT_RESIZED, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE _DragAdjust(True) EndSwitch Sleep(10) WEnd ;********************************** Func _DragAdjust($bResized = False) Local Static $iOffset = $iMargin / 2 Local Static $iPrevMousePos = -1 If Not WinActive($hGUI) Then Return SetError(1, 0, False) If $bResized = True Then ;OrderPos Local $aWin = WinGetClientSize($hGUI) Local $aDockCtrl = ControlGetPos($hGUI, "", $Combo1) ;DOCK ctrl $iGuiW = $aWin[0] $iGuiH = $aWin[1] GUICtrlSetPos($DragBar, $iMargin + $aDockCtrl[2], 0, $iMargin, $iGuiH) GUICtrlSetPos($List1, $iMargin, 2 * $iMargin + $aDockCtrl[3], $aDockCtrl[2], $iGuiH - (3 * $iMargin + $aDockCtrl[3])) GUICtrlSetPos($Edit1, 2 * $iMargin + $aDockCtrl[2], $iMargin, $iGuiW - (3 * $iMargin + $aDockCtrl[2]), $iGuiH - (2 * $iMargin)) Else Local $aCtrl = GUIGetCursorInfo($hGUI) Local $ActiveCtrl = IsArray($aCtrl) ? $aCtrl[4] : 0 If $ActiveCtrl <> $DragBar Then Return SetError(2, 0, False) Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client If $aCtrl[2] = 1 Then ;Primary down While $aCtrl[2] $aCtrl = GUIGetCursorInfo($hGUI) Local $iMousePos = MouseGetPos(0) $iMousePos = $iMousePos < $iMargin ? $iMargin : $iMousePos > ($iGuiW - $iMargin) ? $iGuiW - $iMargin : $iMousePos If $iMousePos <> $iPrevMousePos Then GUICtrlSetPos($DragBar, $iMousePos - $iOffset) GUICtrlSetPos($Combo1, $iMargin, Default, $iMousePos - $iMargin - $iOffset) GUICtrlSetPos($List1, $iMargin, Default, $iMousePos - $iMargin - $iOffset) GUICtrlSetPos($Edit1, $iMousePos + $iOffset, Default, $iGuiW - $iMousePos - $iMargin - $iOffset) $iPrevMousePos = $iMousePos EndIf Sleep(10) WEnd EndIf Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client EndIf _WinAPI_RedrawWindow($hGUI) EndFunc ;==>_DragAdjust ;-------------------------------------------------------------------------------------------------------------------------------- Edited yesterday at 11:02 AM by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
Numeric1 Posted 2 hours ago Share Posted 2 hours ago (edited) It's good. But since events are managed distinctly through message handling, why not clearly differentiate responsibilities? It's an effective technique for development, maintenance, and debugging. You could simply simplify the code by considering all the suggestions. Here is a very simple and much more optimized example. Try it. expandcollapse popup; https://www.autoitscript.com/forum/topic/212020-drag-adjust/ ;---------------------------------------------------------------------------------------- ; Title...........: _DragAdjust.au3 ; Description.....: Resize and reposition the GUI controls when the user drags the $DragBar. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 2.0 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <ListBoxConstants.au3> #include <WinAPIGdi.au3> ; Constants Global $iGuiW = 600, $iGuiH = 300, $iMargin = 4 ; Create GUI Global $hGUI = GUICreate("Form1", $iGuiW, $iGuiH, 205, 130, $WS_OVERLAPPEDWINDOW) Global $Combo1 = GUICtrlCreateCombo("Combo1", $iMargin, $iMargin, 196, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT) ; DOCK ctrl Global $List1 = GUICtrlCreateList("", $iMargin, 2 * $iMargin + 25, 196, 267, BitOR($LBS_STANDARD, $LBS_NOINTEGRALHEIGHT)) Global $Edit1 = GUICtrlCreateEdit("Edit1", 204, $iMargin, 392, 292) Global $DragBar = GUICtrlCreateLabel("", 200, 0, $iMargin, 315, $SS_CENTERIMAGE, $WS_EX_LAYERED) GUICtrlSetCursor(-1, 13) GUISetState(@SW_SHOW) ; Main loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN _DragAdjust() Case $GUI_EVENT_RESIZED, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE _AdjustControls() EndSwitch WEnd ; Functions ; Adjusts the positions and sizes of controls when the window is resized or DragBar is moved Func _AdjustControls($iMousePos = -1) Local $aWin = WinGetClientSize($hGUI) $iGuiW = $aWin[0] $iGuiH = $aWin[1] Local $aCtrl = ControlGetPos($hGUI, "", $Combo1) Local $iPos = $iMousePos == -1 ? $aCtrl[2] + $iMargin : _Constrain($iMousePos, $iMargin, $iGuiW - $iMargin) GUICtrlSetPos($DragBar, $iPos - $iMargin, 0, $iMargin, $iGuiH) GUICtrlSetPos($Combo1, $iMargin, Default, $iPos - 2 * $iMargin) GUICtrlSetPos($List1, $iMargin, 2 * $iMargin + $aCtrl[3], $iPos - 2 * $iMargin, $iGuiH - (3 * $iMargin + $aCtrl[3])) GUICtrlSetPos($Edit1, $iPos, $iMargin, $iGuiW - $iPos - $iMargin, $iGuiH - 2 * $iMargin) EndFunc ;==>_AdjustControls ; Handles the dragging of the DragBar and adjusts the controls accordingly Func _DragAdjust() Local Static $iPrevMousePos = -1 If Not WinActive($hGUI) Then Return SetError(1, 0, False) Local $aCtrl = GUIGetCursorInfo($hGUI) If IsArray($aCtrl) And $aCtrl[4] = $DragBar Then Opt("MouseCoordMode", 2) ; 1=absolute, 0=relative, 2=client If $aCtrl[2] = 1 Then ; Primary down While $aCtrl[2] $aCtrl = GUIGetCursorInfo($hGUI) Local $iMousePos = MouseGetPos(0) $iMousePos = _Constrain($iMousePos, $iMargin, $iGuiW - $iMargin) If $iMousePos <> $iPrevMousePos Then _AdjustControls($iMousePos) $iPrevMousePos = $iMousePos EndIf Sleep(10) WEnd EndIf Opt("MouseCoordMode", 1) EndIf EndFunc ;==>_DragAdjust ; Constrains a value between a minimum and maximum Func _Constrain($value, $min, $max) Return $value < $min ? $min : ($value > $max ? $max : $value) EndFunc ;==>_Constrain This code structure offers several significant advantages: 1. Clear Separation of Responsibilities: Each function has a distinct and clear responsibility: - _AdjustControls manages the resizing of controls. - _DragAdjust handles the movement of controls when the drag bar is used. - _Constrain ensures values stay within defined limits. 2. Readability and Maintainability: The separation of responsibilities makes the code more readable. It is easier to understand what each part of the code does, which facilitates maintenance and future modifications. 3. Reusability: By isolating functionalities into distinct functions, it is easier to reuse these functions in other parts of the project or even in other projects. For instance, _Constrain could be reused wherever value constraints are needed. 4. Simplified Debugging: Having separate functions makes it easier to locate and fix errors. If an issue arises in the control movement, you know that the _DragAdjust function is likely the cause. 5. Scalability: The modular structure allows for easier addition of new features without disrupting existing functionalities. For example, adding a new resizing or moving method could be done by simply adding a new function. 6. Centralized Event Handling: The centralized event handler in the main loop makes the execution flow clearer and simplifies the management of various GUI events ($GUI_EVENT_CLOSE, $GUI_EVENT_PRIMARYDOWN, $GUI_EVENT_RESIZED, etc.). In conclusion, this code structure allows for better organization, improves readability, and facilitates the maintenance and evolution of the project. +-------------------------------------------------------------+ | Main Loop | | +-------------------+-------------------------------------+ | | | GUIGetMsg | | | | | | | | | | | | | | | | | | | +-------------------+--+ | | +------------------------|----------------------------------|-------+ | | | v v | +--------------+ +-------------+ | | _DragAdjust |<------------------>| _Constrain | | | | | | | +--------------+ +-------------+ | ^ | | | | | v | | +-----------------+ | | | _AdjustControls |<------------------------+ | +-----------------+ | | | | | | v +----------------+ | GUI Functions | +----------------+ Here are some remarks on your code: 👉 In your script, since you are already using GUICtrlSetPos to adjust the positions and sizes of controls, AutoIt should automatically handle the redrawing of these controls. Therefore, you can remove the calls to _WinAPI_RedrawWindow. 👉 You are using the Sleep function in the main loop while also using GUIGetMsg() to handle events. This significantly slows down your program because GUIGetMsg() already handles code timing to prevent CPU overload. 👉 The function _DragAdjust exhibits blatant redundancy, making it prone to errors and turning into a bug nest. Edited 2 hours ago by Numeric1 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