Sign in to follow this  
Followers 0
CyberSlug

GuiCreate and MouseGetCursorInfo

4 posts in this topic

<begin nitpick>

Question: If a GUI contains a menu, does the "client area" include that menu bar or not???

Try the following example.... When you mouse over the menubar, the GuiGetCursorInfo reports a negative y coordinate, suggesting that the menubar is not part of the "client area"

However, the button control is cut off at the bottom, suggesting that the menubar is part of the "client area"

What is the best way to ensure that the window is exactly the right size to contain the button( regardless of the possible existance of a menubar)?

(Try again with the MenuItem commented out)

GuiCreate("Example", 200, 100)

GuiCtrlCreateMenuItem("SampleMenu", -1)
GuiCtrlCreateButton("Button", 0, 0, 200, 100)

guiSetstate()
while guigetmsg() <> -3
   $p = GUIGetCursorInfo()
   ToolTip($p[0] & ', ' & $p[1])
Wend

</end nitpick>


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites



Thinking back to when I did Aut2Exe IIRC the menu is not part of the client area - but it does take up space so you have to adjust you gui size a little to cater for it. Ie. for two identical GUIs, if one has a menu you need to create the window a little larger to fit the same number of controls on the screen.

(Also note that in AutoIt, client area stuff is defined by the windows API itself so it's not something that can be changed)

Share this post


Link to post
Share on other sites

Thanks for the info, Larry. I think this works.

$SM_CYMENU = 15
$x = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_CYMENU )

GuiCreate("Example", 200, 200 + $x[0])
GuiCtrlCreateMenuItem("Menu", -1)
GuiCtrlCreateButton("button", 0, 0, 200, 200)

GuiSetState()
While GuiGetMsg() <> -3
WEnd

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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