Sign in to follow this  
Followers 0
billthecreator

Resize, but dont get smaller than original size.

6 posts in this topic

#1 ·  Posted (edited)

Just like the topic title, how would i go about setting the resize ( i already got all the buttons and listview, and everything set to resize) of the gui not to get smaller than the original size i set it to? Cause all the buttons get meshed up.

Thank you IA.

Edited by billthecreator

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Share this post


Link to post
Share on other sites



billthecreator,

This code resizes the GUI to its original size if it is reduced below those values in either axis:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $iOrgWidth = 500, $iOriginalHeight = 500

$hGUI = GUICreate("Test", $iOrgWidth, $iOriginalHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

GUISetState()
; When window is resized, run this function
GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

Func MY_WM_SIZE($hWnd, $Msg, $wParam, $lParam)

    $iGUIWidth = BitAND($lParam, 0xFFFF)
    $iGUIHeight = BitShift($lParam, 16)

    If $iGUIWidth < $iOrgWidth Or $iGUIHeight < $iOriginalHeight Then
        $aPos = WinGetPos($hGUI)
        WinMove($hGUI, "", $aPos[0], $aPos[1], $iOrgWidth, $iOriginalHeight)
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>MY_WM_SIZE

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

that does help (a little)

the only problem is that when it resizes, all the controls dont move.

it actully makes the gui look horrible.

ill work a little on this, maybe there is a better solution.

but thank you anyway, you've helped a lot.


[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Share this post


Link to post
Share on other sites

that does help (a little)

the only problem is that when it resizes, all the controls dont move.

it actully makes the gui look horrible.

ill work a little on this, maybe there is a better solution.

but thank you anyway, you've helped a lot.

Another way I would recommend restricting your window size is with

Global GUIMINWID = 300, GUIMINHT = 400;set your restrictions here
Global GUIMAXWID = DesktopWidth, GUIMAXHT = DesktopHeight ;

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

..

.
.
Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam)
    $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $GUIMINWID) ; min X
    DllStructSetData($tagMaxinfo, 8, $GUIMINHT) ; min Y
    DllStructSetData($tagMaxinfo, 9, GUIMAXWID ); max X
    DllStructSetData($tagMaxinfo, 10, GUIMAXHT ) ; max Y
    Return 0
EndFunc   ;==>WM_GETMINMAXINFO

If you want your controls to move as the window is resized then you need to look up GuiCtrlSetResizing.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Another way I would recommend restricting your window size is with

Global GUIMINWID = 300, GUIMINHT = 400;set your restrictions here
Global GUIMAXWID = DesktopWidth, GUIMAXHT = DesktopHeight ;

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

..

.
.
Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam)
    $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $GUIMINWID) ; min X
    DllStructSetData($tagMaxinfo, 8, $GUIMINHT) ; min Y
    DllStructSetData($tagMaxinfo, 9, GUIMAXWID ); max X
    DllStructSetData($tagMaxinfo, 10, GUIMAXHT ) ; max Y
    Return 0
EndFunc   ;==>WM_GETMINMAXINFO

If you want your controls to move as the window is resized then you need to look up GuiCtrlSetResizing.

Hi, thank you for the heads up Martin.

Just found your post while searching the forum for a function to do exactly this :D

Cheers

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0