Jump to content

Size of GUI not equal to size of GUICreate


water
 Share

Recommended Posts

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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)

Link to comment
Share on other sites

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.
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...