Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Inssue setting max height on resize

$
0
0
Hi everyone :)


I have a gui than can be expanded/collapsed (not sure if are the proper words) by the click of a button, the problem is lock the height when collapsed, and unlock it to be resized by winmove function and letting the GUI unlocked to be resized

(sorry, I cannot paste the code tidy up, even I use autoit code inputbox it stays like this, although in the inputbox is tidy)
[ autoit ]         
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 304, 63,-1,-1,BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX)) Global $flag = 0, $expand = 1 GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO") ; Monitors resizing of the GUI $Button1 = GUICtrlCreateButton("Toggle", 110, 16, 83, 25) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Local $pos = WinGetPos($Form1) If $expand = 1 Then WinMove($Form1,'',$pos[0],$pos[1], $pos[2], 300,1) $expand = 0 Else WinMove($Form1,"",$pos[0],$pos[1], $pos[2], 63+35,1) $expand = 1 EndIf EndSwitch WEnd Func _WM_GETMINMAXINFO($hWnd, $msg, $wParam, $lParam) ; used to limit the minimum size of the GUI #forceref $hWnd, $Msg, $wParam, $lParam Local $iWidth = 304 + 16 ; minimum width setting Local $iHeight = 63 + 38 ; minimum height setting ;ConsoleWrite($lParam&@LF) If $hWnd = $Form1 Then Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tagMaxinfo, 7, $iWidth) ; min width DllStructSetData($tagMaxinfo, 8, $iHeight) ; min height DllStructSetData($tagMaxinfo, 9, 99999) ; max width If $expand Then DllStructSetData($tagMaxinfo, 10, $iHeight) ; max height Else DllStructSetData($tagMaxinfo, 10, 99999) ; max height EndIf Return $GUI_RUNDEFMSG EndIf EndFunc ;==>_WM_GETMINMAXINFO

I have no ideia how can it be done : (Felling dumb)

EDIT: Updated the if inside _WM_GETMINMAXINFO()

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>