Jump to content
Sign in to follow this  
B3TA_SCR1PT3R

Gui Resizing Boundaries

Recommended Posts

if i have a gui that is allowed to be resized is there anyway i can set the minimum resize

so like you cant shrink it below 200 X 200 or something of the sort


[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Share this post


Link to post
Share on other sites

Actually.. Here is one way, if you resize smaller than what the window is, it will snap back to default... I prefer to have it stop while resizing. I am going to mess around with it some more. I took the GUICtrlSetResizing() help file and edited it a little to show. Also, I used $GUI_EVENT_MOUSEMOVE instead of $GUI_EVENT_RESIZED because it has a faster response.

#include <GUIConstants.au3>

Opt("GUICoordMode", 2)
$nWindow = GUICreate ("My InputBox",190,114,-1,-1,$WS_SIZEBOX+$WS_SYSMENU); start the definition
GUISetIcon ("Eiffel Tower.ico")

GUISetFont (8,-1,"Arial")

GUICtrlCreateLabel ("Prompt", 8,7); add prompt info
GUICtrlSetResizing (-1,$GUI_DOCKLEFT+$GUI_DOCKTOP)

$nEdit = GUICtrlCreateInput ("Default", -1,3,175,20,$ES_PASSWORD); add the input area
GUICtrlSetState ($nEdit,$GUI_FOCUS)
GUICtrlSetResizing ($nEdit,$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)

$nOk = GUICtrlCreateButton ("OK",-1,3,75,24); add the button that will close the GUI
GUICtrlSetResizing ($nOk,$GUI_DOCKBOTTOM+$GUI_DOCKSIZE+$GUI_DOCKVCENTER)

$nCancel = GUICtrlCreateButton ("Annuler", 25,-1); add the button that will close the GUI
GUICtrlSetResizing ($nCancel,$GUI_DOCKBOTTOM+$GUI_DOCKSIZE+$GUI_DOCKVCENTER)

GUISetState ()          ; to display the GUI

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    ElseIf $msg = $GUI_EVENT_MOUSEMOVE Then
        $WinPos = WinGetPos($nWindow, "")
            
        If $WinPos[2] < 190 Then
            WinMove($nWindow, "", $WinPos[0], $WinPos[1], 190, $WinPos[3])
        EndIf
        If $WinPos[3] < 114 Then
            WinMove($nWindow, "", $WinPos[0], $WinPos[1], $WinPos[2], 114)
        EndIf
    EndIf
Wend
Edited by Starky

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...