AutoHotkey Community

It is currently May 27th, 2012, 9:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: August 29th, 2006, 2:58 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
Recently I was playing around with the window resize of a GUI I was working on. There is no limit to how small you can make the window so some of the objects become hidden/inaccessible when the window is sized too small. I thought to myself, "It sure would be nice if I could figure out a way to limit the window to fixed "minimum" size!"

I did a quick search on forum and found this topic: http://www.autohotkey.com/forum/viewtopic.php?t=2441. Apparently, I wasn't the only one with this requirement. If you read through the post you'll see that Chris came up a with a way to limit sizing for a single GUI using OnMessage(0x24, "WM_GETMINMAXINFO") . A few days ago, toralf wrote a solution (with some Titan influenced code) that is able to work with multiple GUIs and uses the GUI's current width/height as the minimum.

Long story still long, the code written by Chris/toralf/Titan inspired me to create/assemble a couple of functions with the following capabilities/features:
  • Set minimum and maximum width and/or height limits for multiple GUIs.
  • Set or reset GUI size limits on demand.
  • Options to set minimum and maximum limits to the GUI's current W/H.
  • Include room in the design to support minimum/maximum X/Y positions in the future.

Here are the functions (v1.0):
Code:
;***************************************
;*                                     *
;*    LimitGUISize_WM_GETMINMAXINFO    *
;*                                     *
;***************************************
;
;
;   Description
;   ===========
;   This function restricts the sizing of a GUI window to developer-defined
;   limits. It is automatically triggered by an OnMessage(0x24,...) statement.
;   See the "Processing Notes" section (below) for more information.
;
;
;
;   Parameters
;   ==========
;
;       Name            Description
;       ----            -----------
;       wParam          Not used.
;
;       lParam          From msdn - Pointer to a MINMAXINFO structure
;                       that contains the default maximized position and
;                       dimensions, and the default minimum and maximum tracking
;                       sizes.  An application can override the defaults by
;                       setting the members of this structure.
;
;                       See the "Processing Notes" section (below) for more
;                       information.
;
;       msg             The message number.  Contains 0x24 in this case.  Only
;                       used for debugging purposes.
;
;       hWnd            The hWnd (unique ID) of the window or control to which
;                       the message was sent.  Only used for debugging purposes.
;
;
;
;
;   Global/System variables
;   =======================
;    *  A_GUI.  This AHK system variable contains the GUI window number that
;       triggered this message.
;
;    *  LimitGUISize_Table.  This global variable contains the developer-defined
;       sizing limits for one or more GUI windows.
;   
;
;
;   Processing Notes
;   ================
;    *  Monitoring of the WM_GETMINMAXINFO message is automatically enabled and
;       disabled by the LimitGUISize function.  There is no need to specify a
;       separate "OnMessage" statement outside of these functions.
;
;    *  This function updates the GUI's ptMinTrackSize and ptMaxTrackSize values
;       (as necessary) in the MINMAXINFO structure so that the GUI cannot be
;       resized to a width or height that is outside of the developer-defined
;       width and/or height limits.  For a complete description of the
;       MINMAXINFO structure, go to http://msdn.microsoft.com/ and do a search
;       for WM_GETMINMAXINFO.
;
;
;
;   Credit
;   ======
;   The original idea/code by Chris and significantly enhanced by toralf with
;   influences and code by Titan.  Original forum topic:
;
;       http://www.autohotkey.com/forum/viewtopic.php?t=2441
;
;
;
;   Return code
;   ===========
;   0 (per msdn)
;
;
;   
;   Calls To Other Functions
;   ========================
;   (None)
;
;-------------------------------------------------------------------------------
LimitGUISize_WM_GETMINMAXINFO(wParam,lParam,msg,hWnd)
    {
    global LimitGUISize_Table

    ;-- Define search pattern for the current GUI
    CurrentGUI:= "|" . A_Gui . ","

    ;-- Limits defined for this GUI?
    If not instr(LimitGUISize_Table,CurrentGUI)
        return 0
 
    ;-- Extract GUI's limits from the table (skip the GUI window number field)
    StringTrimLeft GUILimitRecord
        ,LimitGUISize_Table
        ,instr(LimitGUISize_Table,CurrentGUI)+strlen(CurrentGUI)-1

    ;-- Split record into fields
    StringSplit GUILimit,GUILimitRecord,`,|


    ;[===========================]
    ;[   Update ptMinTrackSize   ]
    ;[   and/or ptMaxTrackSize   ]
    ;[===========================]
    loop 4
        if GUILimit%A_Index%
            {
            SizeLimit:=GUILimit%A_Index%
            OffSet:=20+(A_Index*4)
            loop 4
                DLLCall("RtlFillMemory"
                    ,"UInt"
                    ,lParam+Offset+A_Index-1
                    ,"UInt"
                    ,1
                    ,"UChar"
                    ,SizeLimit>>8*(A_Index-1) & 0xFF)
            }

    ;-- Return to sender
    return 0 
    }



;**********************
;*                    *
;*    LimitGUISize    *
;*                    *
;**********************
;
;
;   Description
;   ===========
;   This function maintains user-defined sizing limits for one or more GUI
;   windows.
;
;
;
;   Parameters
;   ==========
;
;       Name            Description
;       ----            -----------
;       p_Command       Command. [Required]  The following commands are
;                       currently supported:
;
;                           Name        Action
;                           ----        ------
;                           Set         Creates or updates a record in the
;                                       LimitGUISize_Table variable.
;
;                           CurrentMin  Creates or updates a record in the
;                                       LimitGUISize_Table variable. The
;                                       p_MinW and p_MinH parameters are
;                                       automatically set to the GUI's current
;                                       width and height.
;
;                           CurrentMin  Creates or update a record in the
;                                       LimitGUISize_Table variable. The p_MaxW
;                                       and p_MaxH parameters are automatically
;                                       set to the GUI's current width and
;                                       height.
;
;                           Delete      Deletes the GUI window record from the
;                                       LimitGUISize_Table variable.  This will
;                                       remove all sizing limits for the GUI
;                                       window.
;
;       p_GUI           GUI window number.  [Required]
;
;       p_MinW          Minimum width (in pixels).  [Optional]
;
;       p_MinH          Minimum height (in pixels).  [Optional]
;
;       p_MaxW          Maximum width (in pixels).  [Optional]
;
;       p_MaxH          Maximum height (in pixels).  [Optional]
;
;
;
;   Parameter Notes
;   ===============
;    *  p_Command.  At this writing, any p_Command value that is not exactly
;       defined as "Delete", "CurrentMin", or "CurrentMax" (not case sensitive),
;       will perform the same actions as the "Set" command.  So, if you want to
;       use command names such as "Add", "Update", etc., go for it!
;
;    *  p_GUI.  The GUI window number is used to identify individual GUI windows
;       instead of the GUI's handle (unique ID) for many reasons.  The primary
;       reason is to give the developer the ability to create/delete sizing
;       limits on demand, regardless of the existence of the associated GUI
;       window.  The one consideration in this design is that if the developer
;       does not delete (or update) sizing limits for a GUI window after the
;       window has been destroyed, any new window using the same GUI window
;       number will inherit the previous sizing limits.
;
;    *  The p_MinW, p_MinH, p_MaxW, and p_MaxH parameters can be defined/used as
;       follows:
;
;         Definition/Value  Description/Operation
;         ----------------  ---------------------
;         Not defined       All of these parameters are optional.  If a min/max
;                           parameter is not defined, the related value on the
;                           GUI record will be set to null if for a new record.
;                           If for an existing record, no change will be made
;                           to the related field.
;
;         Blank or null     Same action as "Not defined". (See above)
;
;         "C" | "Current"   If the GUI window exists, the window's current
;                           width or height (whichever is appropriate) is used
;                           to populate this parameter.  If the GUI window does
;                           not exist, the parameter value is set to 0 (zero).
;
;         0 (zero)          A value of 0 (zero) effectively turns the associated
;                           limit off.  If all min/max parameter values are set
;                           to 0 (zero), the GUI record is deleted.
;
;         {Anything else}   Should be the appropriate window width or height in
;                           pixels.  Very little integrity checking is performed
;                           on these parameters so use care when assigning
;                           values.
;
;
;
;   Processing Notes
;   ================
;   Monitoring of the WM_GETMINMAXINFO message is automatically enabled when the
;   first GUI record is added, and is disabled when all GUI records are deleted.
;   There is no need to specify a separate OnMessage statement outside of these
;   functions.
;
;
;
;   Table structure
;   ===============
;   The data that is used to determine sizing limits for GUI windows is stored
;   in a global variable named LimitGUISize_Table.  The variable is treated like
;   a data table in that it has records and the records have fields.
;
;   Each "record" is delimited by the "|" character and each "field" is
;   delimited by a comma "," character.  There are currently 5 fields per record
;   and they are as follows (and in the following order):
;
;       Field               Description/Comment
;       -----               -------------------
;       GUI window number   Only 1 record per GUI window number.
;       Minimum width       May be 0 or null.
;       Minimum height      May be 0 or null.
;       Maximum width       May be 0 or null.
;       Maximum height      May be 0 or null.
;       
;
;
;   Return codes
;   ============
;   Returns TRUE if there are invalid parameters.  Returns FALSE if there are no
;   errors.
;
;   
;
;   Calls To Other Functions
;   ========================
;   (None)
;
;-------------------------------------------------------------------------------
LimitGUISize(p_Command,p_GUI,p_MinW="",p_MinH="",p_MaxW="",p_MaxH="")
    {
    global LimitGUISize_Table

    ;[==============]
    ;[  Initialize  ]
    ;[==============]
    ;-- AutoTrim all parameters
    p_Command=%p_Command%
    p_GUI=%p_GUI%
    p_MinW=%p_MinW%
    p_MinH=%p_MinH%
    p_MaxW=%p_MaxW%
    p_MaxH=%p_MaxH%

    ;-- Check p_GUI
    if p_GUI is not Integer
        return false
     else
        if p_GUI not between 1 and 99
            return false

    ;[=================]
    ;[  Process table  ]
    ;[=================]
    ;-- Extract GUI record if it exists
    if LimitGUISize_Table is not Space
        {
        ;-- Trim leading delimiter
        StringTrimLeft LimitGUISize_Table,LimitGUISize_Table,1

        ;-- Split table into an array of records
        StringSplit t_Record,LimitGUISize_Table,|

        ;--  Re-build table excluding target record
        LimitGUISize_Table:=""
        loop %t_Record0%
            {
            ;-- Target record?
            if instr(t_Record%A_Index%,p_GUI . ",")=1
                {
                ;-- Break record into an array of fields
                StringSplit t_Field,t_Record%A_Index%,`,
                continue
                }
           
            ;-- Add record
            LimitGUISize_Table:=LimitGUISize_Table . "|" . t_Record%A_Index%
            }
        }

    ;[======================]
    ;[  Process parameters  ]
    ;[======================]
    ;-- If any parm is not defined, set to previous table value (if anything)
    if p_MinW is Space
        p_MinW:=t_Field2

    if p_MinH is Space
        p_MinH:=t_Field3

    if p_MaxW is Space
        p_MaxW:=t_Field4

    if p_MaxH is Space
        p_MaxH:=t_Field5

    ;-- Delete command?
    if p_Command=Delete
        {
        p_MinW=0
        p_MinH=0
        p_MaxW=0
        p_MaxH=0
        }

    ;---------------
    ;-- Current W/H
    ;---------------
    ;-- Initialize
    CurrentW=0
    CurrentH=0

    ;-- GUI exist?
    gui %p_GUI%:+LastFoundExist
    ifWinExist
        WinGetPos,,,CurrentW,CUrrentH
   
    ;-- CurrentMin command?
    if p_Command=CurrentMin
        {
        p_MinW:=CurrentW
        p_MinH:=CurrentH
        }

    ;-- CurrentMax command
    if p_Command=CurrentMax
        {
        p_MaxW:=CurrentW
        p_MaxH:=CurrentH
        }
   
    ;------------------------
    ;-- Embedded "current" ?
    ;------------------------
    if instr(p_MinW,"C")=1
        p_MinW:=CurrentW
       
    if instr(p_MinH,"C")=1
        p_MinH:=CurrentH
       
    if instr(p_MaxW,"C")=1
        p_MaxW:=CurrentW
       
    if instr(p_MaxH,"C")=1
        p_MaxH:=CurrentH

    ;-------------------------
    ;-- Final integrity check
    ;-------------------------
    if p_MinW
        if p_MinW is not Integer
            p_MinW=0

    if p_MinH
        if p_MinH is not Integer
            p_MinH=0

    if p_MaxW
        if p_MaxW is not Integer
            p_MaxW=0

    if p_MaxH
        if p_MaxH is not Integer
            p_MaxH=0

    ;--------------------------------
    ;-- If any non-zero/null values,
    ;--   add record to the table   
    ;--------------------------------
    if (p_MinW or p_MinH or p_MaxW or p_MaxH)
        LimitGUISize_Table=
           (ltrim join
            %LimitGUISize_Table%
            |
            %p_GUI%,
            %p_MinW%,
            %p_MinH%,
            %p_MaxW%,
            %p_MaxH%
           )

    ;[======================]
    ;[  Message monitoring  ]
    ;[======================]
    ;-- Empty table?
    if not LimitGUISize_Table
        {
        ;-- Disable monitoring?
        if OnMessage(0x24)
            OnMessage(0x24,"")
        }
     else
        ;-- Enable monitoring if not already enabled
        if not OnMessage(0x24)
            if not OnMessage(0x24,"LimitGUISize_WM_GETMINMAXINFO") ;-- Name must be exact
                msgbox 262160,,Unable to set OnMessage for WM_GETMINMAXINFO

    ;-- Return to sender
    return true
    }


Here is an example that will demonstrate all of the options. After clicking on a button, resize (or try to resize) the window to see the changes.
Code:
gui Margin,,2
gui 1:Default
gui +Resize
gui Add,Button,w220 h25 gRemoveAll,Remove all sizing limits
gui Add,Button,w220 h25 gRemoveMin,Remove all minimum limits
gui Add,Button,w220 h25 gRemoveMax,Remove all maximum limits
gui Add,Button,w220 h25 gSetCurrentMin,Set current window size as minimum W/H
gui Add,Button,w220 h25 gSetCurrentMax,Set current window size as maximum W/H
gui Add,Text,x10 w110,Minimum width:
gui Add,Edit,x+05 w50 vMinW,500
gui Add,Button,x+05 w50 h25 gSetMinW,Set
gui Add,Text,x10 w110,Minimum height:
gui Add,Edit,x+05 w50 vMinH,400
gui Add,Button,x+05 w50 h25 gSetMinH,Set
gui Add,Text,x10 w110,Maximum width:
gui Add,Edit,x+05 w50 vMaxW,650
gui Add,Button,x+05 w50 h25 gSetMaxW,Set
gui Add,Text,x10 w110,Maximum height:
gui Add,Edit,x+05 w50 vMaxH,450
gui Add,Button,x+05 w50 h25 gSetMaxH,Set
gui Add,Text,x10 w10,----------
gui Add,Text,x10 w110,(Try to) change width:
gui Add,Edit,x+05 w50 vSetW,700
gui Add,Button,x+05 w50 h25 gSetW,Change
gui Add,Text,x10 w110,(Try to) change height:
gui Add,Edit,x+05 w50 vSetH,500
gui Add,Button,x+05 w50 h25 gSetH,Change
gui Add,Text,x10 w10,----------
gui Add,Button,w220 h25 g23Window,Build/Rebuild 2nd window
gui Show,w600 h400
return

RemoveAll:
LimitGUISize("Delete",1)
return

RemoveMin:
LimitGUISize("Set",1,0,0)
return

RemoveMax:
LimitGUISize("Set",1,"","",0,0)
return

SetCurrentMin:
LimitGUISize("CurrentMin",1)
return

SetCurrentMax:
LimitGUISize("CurrentMax",1)
return

SetMinW:
gui Submit,NoHide
LimitGUISize("Set",1,MinW)
return

SetMinH:
gui Submit,NoHide
LimitGUISize("Set",1,"",MinH)
return

SetMaxW:
gui Submit,NoHide
LimitGUISize("Set",1,"","",MaxW)
return

SetMaxH:
gui Submit,NoHide
LimitGUISize("Set",1,"","","",MaxH)
return

SetW:
gui Submit,NoHide
gui show,% "w" . SetW
return

SetH:
gui Submit,NoHide
gui show,% "h" . SetH
return

23Window:
LimitGUISize("Delete",23)
gui 23:Default
gui Destroy
Gui +Resize
Gui Add, Text,,23: This window cannot be drag-resized to smaller than 400x100.
Gui Show,w400 h100
LimitGUISize("CurrentMin",23)
return

guiescape:
guiclose:
exitapp

23guiescape:
23guiclose:
LimitGUISize("Delete",23)
gui Destroy
return


I hope that someone finds this useful.

---------------
20060903: v1.0
Minor improvements for release. Updated documentation.


Last edited by jballi on September 21st, 2006, 10:53 pm, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2006, 6:17 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Thanks jballi for sharing and working on it.
I'll take a look at it when time permits. But I assume it will be of use.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2006, 8:13 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Cool. Here is a simplified version: GuiSet.ahk

_________________
GitHubScriptsIronAHK Contact by email not private message.


Last edited by polyethene on September 2nd, 2006, 9:34 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2006, 9:46 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
Titan wrote:
Cool. Here is a simplified version...

I took some to time to play around with your version. It's very similar to the version that toralf submitted although how the message is triggered is different.

I did make one tiny fix:
Code:
StringTrimLeft, d, s, InStr(s, g)+strlen(g)-1


The good news is that it will do the trick and it does it with a very small amount of code.

The problem that I have with the WM_GETMINMAXINFO message is that once it's set, it is triggered a ba-jillion times. Every tiny window move calls the function from 4 to 40 times. You can imagine how many lines of code are executed if you are doing a lot of moves. I found that the response becomes noticeable sluggish especially if the computer is already quite busy.

The approach I came up with to improve performance is to only execute the code that sets the window limits unless you actually sizing the window. In addition, only check/set limits to the fields that could be affected. i.e. if you're moving the right window edge (changing the window width), there is no reason to check/set height values. In an attempt to "fix" the problem, I added an OnMessage for WM_SIZING so that I can tell when the window is actually being resized and an added bonus, which window edge is being resized.

The good news is that this approach does significantly reduce the amount of code that executed under many circumstances -- moving the entire window for example or just sizing an edge.

The bad news is that the approach does add additional overhead (although not that much) for some moves -- sizing a corner for example. In addition, much of the efficiency will be lost if the feature to limit X/Y coords is added in the future. I'm not entirely convinced that the extra trouble is worth it since moving and sizing a window "should" be only a small portion of the operation of the GUI.

In addition to improving efficiency (debatable, see previous paragraph), the LimitGUISize function supports changes to the GUI table on demand. For the most part, not a big deal but could come in handy if 1) a GUI is significantly manipulated (adding/deleting a bunch of objects) or 2) a GUI window number is reused.

Them be my thoughts. I would certainly like to read yours...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2006, 1:34 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Nice presentation of LimitGUISize. This will be useful to me when the time comes to work on building in such a feature.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2006, 1:53 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
Chris wrote:
Nice presentation of LimitGUISize. This will be useful to me when the time comes to work on building in such a feature.

I can only speak for myself but a built-in feature to limit the GUI size would be WAY COOL! :!: :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2006, 4:53 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
jballi wrote:
The problem that I have with the WM_GETMINMAXINFO message is that once it's set, it is triggered a ba-jillion times. Every tiny window move calls the function from 4 to 40 times.
Using GuiSet() the event is triggered for every pixel the window changed in size and twice for a maximise/restore.

jballi wrote:
I can only speak for myself but a built-in feature to limit the GUI size would be WAY COOL! :!: :D
Most definitely.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2006, 2:08 am 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
Titan wrote:
Using GuiSet() the event is triggered for every pixel the window changed in size and twice for a maximise/restore.

Actually, once the OnMessage(0x24, "GuiSet") is set (which is immediately because the GuiSize routine runs once even if the window is not sized), the GuiSet function is called even if the window is not being sized.

Using your script as an example...

Try just clicking on the edge of the window (don't move anything) and count the number of times the GuiSet function is called. If the OnMessage(0x24, "GuiSet") were not set, the GuiSize routine wouldn't fire at all.

Next, try dragging the entire window (not resizing) from one corner of the screen to another and count the number of calls. The GuiSize routine is never called in this circumstance but because the OnMessage(0x24, "GuiSet") is set, the GuiSet function is called many many many times.

Next, try turning off the OnMessage(0x24, "GuiSet") statement (just temporarily comment it out), and resize the window a tiny bit. Like you stated, the GuiSet function is "triggered for every pixel the window is changed in size and twice for a maximise/restore." Now, turn back on the OnMessage(0x24, "GuiSet") statement and try the tiny resize again. Not only is the GuiSet function "triggered for every pixel the window is changed in size" but it is called every time the OnMessage(0x24, "GuiSet") triggers it which is more often that the GuiSize would call it.

I'm working on some ideas on how to turn off the OnMessage(0x24,...) message once the address has been collected but dealing with more than one window and reusing GUI Window numbers, etc., etc, ...

Them be my thoughts...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2006, 2:09 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
With a few regrets, I've given up trying to use the WM_SIZING message to improve the efficiency of these functions. The reason? The WM_SIZING message is only triggered by user attempts to size a window. It does not trigger if the window is programmatically resized. Although the WM_SIZING message did improve efficiency, I'm afraid it's not enough to merit the loss of functionality.

I've modified the first post with the changes. I've also added a few features. The one feature of note is that the OnMessage statement does not have to be defined by the user. Message monitoring is automatically handled by the LimitGUISize function. I have also enhanced the example so that you can get a better idea of all of the options.

As always, your comments, suggestions, changes, etc., are very much needed and are welcome.


----------
Edit 20060903. No additional feedback? OK... 1st post has been updated with final changes. We'll call this a done deal for now.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2006, 11:06 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
With the release of AutoHotkey v1.0.44.13, this function is no longer needed because of the new GUI MinSize/MaxSize options. Thanks Chris! :D

I played around with the new options to make sure that I could duplicate all of the features of the LimitGUISize function and so far, everything can be duplicated with a minimum amount of effort. Here are some examples of the MinSize option (assumes +Resize has been set):

Code:
;-- Set minimum size to the GUI's current/initial WxH.
Gui +MinSize

;-- Set minimum size to 640x480.
Gui +MinSize640x480

;-- Set minimum width to 600.  Height limit not set/changed.
Gui +MinSize600

;-- Set minimum height to 400.  Width limit not set/changed.
Gui +MinSizex400

;-- Set minimum width to 300.  Minimum height set to GUI's current/initial height.
Gui +MinSize +MinSize300

;-- Set minimum height to 200.  Minimum width set to GUI's current/initial width.
Gui +MinSize +MinSizex200

;-- Turn off all minimum sizing limits
Gui -MinSize

Them be my thoughts...

PS. When did we go code blue? I must have been sleeping.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2006, 1:04 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
jballi wrote:
I played around with the new options to make sure that I could duplicate all of the features of the LimitGUISize function and so far, everything can be duplicated with a minimum amount of effort.
Thanks for the feedback.

Quote:
;-- Set minimum width to 300. Minimum height set to GUI's current/initial height.
Gui +MinSize +MinSize300
Nice trick. I've added it to the docs as:
Quote:
Either the width or the height may be omitted to leave it unchanged (e.g. +MinSize640x or +MinSizex480). Furthermore, Min/MaxSize can be specified more than once to use the window's current size for one dimension and an explicit size for the other. For example, +MinSize +MinSize640x would use the the window's current size for the height and 640 for the width.


Quote:
PS. When did we go code blue? I must have been sleeping.
It's my theory that blue is easier to read than green. Furthermore, green seems a better choice for comments, for which Titan has created some JavaScript.
EDIT: There is now a poll to help decide on the color scheme for scripts in the forum: http://www.autohotkey.com/forum/viewtopic.php?t=12808


Last edited by Chris on September 22nd, 2006, 2:14 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2006, 9:35 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
I love when Chris puts some of our scripts out of job...
I am happy not to have to use your (clean and nice!) script, jballi. :-D

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, nomissenrojb, Stigg and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group