Sign in to follow this  
Followers 0
water

Size of GUI not equal to size of GUICreate

6 posts in this topic

The following GUI should have a size of 327x94 pixel but AutoIt Window Info shows it as 333x119.

Is there a grid that Windows (XP SP2 in my case) adjusts GUIs to?

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 327, 94, 193, 125)
$Input1 = GUICtrlCreateInput("", 176, 24, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 64, 24, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Button2", 80, 136, 75, 25, 0)
$Button3 = GUICtrlCreateButton("Button3", 200, 136, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Thanks in advance

Thomas


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

No magic there... 327, 94 is the inner size of the gui... 333x119 the outer size...


This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi Polyphem,

thanks for your fast reply!

Is there a topic/URL you could recommend to start reading on how this type of size calculation is done by Windows?

The bottom part of another GUI gets "out of alignment" when maximized (see attachement).

Thanks

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

There is no calculation done by Windows, the parameters you set in GuiCreate() is the client area, not the window area.

That thing that gets "out of alignment", is it perhaps a List or ListView? Try adding the style $LBS_NOINTEGRALHEIGHT to force it to be exactly the size specified. (normally List and Listview adapt their height to "fully" show items)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

If you wanted to create a window the size w x h then you could do this

$w = 600
$h = 400

$titleht = DllCall("user32.dll",'int',"GetSystemMetrics",'int',4);$SM_CYCAPTION)
$framewid = DllCall("user32.dll",'int',"GetSystemMetrics",'int',7);$SM_CYFIXEDFRAME)

GUICreate("ex",$w - 2 *$framewid[0] ,$h - 2*$framewid[0] - $titleht[0])
GUISetState()

$ws = wingetpos("ex")
ConsoleWrite($ws[2] & ', ' & $ws[3] & @CRLF)
Edited by martin

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

Hi AdmiralAlkex,

you're right - its a List. After adding $LBS_NOINTEGRALHEIGHT everything works fine.

Thanks a lot

Thomas


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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