Modify

Opened 10 years ago

Closed 6 years ago

#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:1 Changed 10 years ago by BrewManNH

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.


Window <<<<

Title: Menu and edit example
Class: AutoIt v3 GUI
Position: 758, 417
Size: 416, 338
Style: 0x14CF0000
ExStyle: 0x00000110
Handle: 0x00000000007E0E70

Control <<<<

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.

comment:2 Changed 10 years ago by FredAI

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 Changed 10 years ago by FredAI

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.

comment:4 follow-ups: Changed 10 years ago by anonymous

the edit control is too tall, and the bottom scroll bar gets hidden

See #2588 and use GUICtrlCreateMenu() after GUISetState()

comment:5 in reply to: ↑ 4 Changed 10 years ago by FredAI

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 in reply to: ↑ 4 Changed 10 years ago by FredAI

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 Changed 6 years ago by Jpm

  • Resolution set to Fixed
  • Status changed from new to closed

Checking with 3.3.14.4 and it works so we fix it without closing

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.