#2707 closed Bug (Fixed)
Incorrect GUI client size
| Reported by: | FredAI | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.10.2 | Severity: | None |
| Keywords: | Cc: |
Description
The script below worked fine in the version 3.3.8.1.
When using the version 3.3.10.2 or the latest beta 3.3.11.5, WinGetClientSize() and the GetClientRect() Windows api do not exclude the area occupied by the menu like they should.
#include <WindowsConstants.au3>
_main()
Func _main()
$Gui = GUICreate('Menu and edit example',400,300, -1,-1, _
BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_CAPTION,$WS_SYSMENU,$WS_MINIMIZEBOX), $WS_EX_ACCEPTFILES)
$menu = GUICtrlCreateMenu('File')
$apos = WinGetClientSize($Gui)
$edit = GUICtrlCreateEdit('',0,0,$apos[0], $apos[1])
GUISetState()
While GUIGetMsg() <> -3
WEnd
EndFunc
Attachments (0)
Change History (7)
comment:2 by , on May 7, 2014 at 9:33:39 PM
Just run that script with both versions 3.3.8.1 and 3.3.10.2 and you'll see what I mean.
I use WinGetClientHeight() to get the size of the client area after adding the menu. That allows me to create an edit control of the same size as the remaining client area, just like the notepad window. In the version 3.3.10.2, the edit control is too tall, and the bottom scroll bar gets hidden. It works fine in the version 3.3.8.1.
comment:3 by , on May 7, 2014 at 9:44:36 PM
The info you got with the Au3Info tool demonstrates exactly what I mean. Initially, the window is created with 400x300 px. After adding the menu, the client hight should be 300 less that menu's height, which would make ~280 px.
That's the expected behavior. Try creating a GUI with a menu in C. You'll see.
follow-ups: 5 6 comment:4 by , on May 8, 2014 at 1:22:53 PM
the edit control is too tall, and the bottom scroll bar gets hidden
See #2588 and use GUICtrlCreateMenu() after GUISetState()
comment:5 by , on May 8, 2014 at 5:49:17 PM
Replying to anonymous:
the edit control is too tall, and the bottom scroll bar gets hidden
See #2588 and use GUICtrlCreateMenu() after GUISetState()
Thanks. I like to create all the controls while thw GUI is hidden, so I found a better solution. We just have to call GUISetState(@SW_ENABLE)immediatelly after creating the GUI.
Then we can create all controls before calling GuiSetState(). Hope it helps to fix the bug.
comment:6 by , on May 8, 2014 at 5:49:17 PM
Replying to anonymous:
the edit control is too tall, and the bottom scroll bar gets hidden
See #2588 and use GUICtrlCreateMenu() after GUISetState()
Thanks. I like to create all the controls while thw GUI is hidden, so I found a better solution. We just have to call GUISetState(@SW_ENABLE)immediatelly after creating the GUI.
Then we can create all controls before calling GuiSetState(). Hope it helps to fix the bug.
comment:7 by , on Mar 10, 2018 at 11:47:12 AM
| Resolution: | → Fixed |
|---|---|
| Status: | new → closed |
Checking with 3.3.14.4 and it works so we fix it without closing

What exactly are you demonstrating with the script posted? Where are you showing that WinGetClientSize isn't returning the correct size?
When I run that script I get the following in the Au3Info tool.
Title: Menu and edit example
Class: AutoIt v3 GUI
Position: 758, 417
Size: 416, 338
Style: 0x14CF0000
ExStyle: 0x00000110
Handle: 0x00000000007E0E70
Class: Edit
Instance: 1
ClassnameNN: Edit1
Name:
Advanced (Class): [CLASS:Edit; INSTANCE:1]
ID: 4
Text:
Position: 0, 0
Size: 400, 300
ControlClick Coords: 192, 101
Style: 0x503310C4
ExStyle: 0x00000200
Handle: 0x0000000000600BD4
I'm not saying you're wrong, I'm just not sure what you're expecting to see and what you're actually getting.