Jump to content

Window size inaccuracy


Recommended Posts

Perhaps the topic can be moved here.

http://www.leadwerks.com/werkspace/topic/7172-screen-size-and-mouse-coordinates/

 

I have been getting weird results with my GUI. I made a script that displays the x and y coordinate of the mouse. My window is 1024 x 768. I would expect that 768 is the bottom of the window, but the mouse coordinates indicate that height 768 is actually lower than the window.

 

I have been getting weird results with my GUI. I made a script that displays the x and y coordinate of the mouse. My window is 1024 x 768. I would expect that 768 is the bottom of the window, but the mouse coordinates indicate that height 768 is actually lower than the window. I am not sure if this is intended or a bug.

 

See the video attached: zip.gif 768.zip 2.11MB 1 downloads

 

The image shows a blue dot where my mouse is.

post-45-0-47520600-1373140612_thumb.jpg

 

I made an image which display a window of resolution 1024 x 768.

 

post-45-0-24459600-1373141250_thumb.jpg

Link to comment
Share on other sites

i can confirm this.

 

When i create a window with 1024x768 the window including the window title and borders is 1034x778 (measured with paint. ph34r.png pressing ALT and Print key )

 

But if you use context:GetWidth() and context:GetHeight() it fits perfectly. So i don't think it is an inaccuracy.

 

however window:GetWidth() and window:GetHeight() return 1024x768.

Maybe it is more of an inaccuracy of microsoft windows?

Link to comment
Share on other sites

thats what i wanted to write. :)

 

However the window that is created when i set the window size to 1024x768 is a bit larger when i measured it.

So either my measuring is inaccurate or windows calculates the window size a bit different.

Link to comment
Share on other sites

  • 1 month later...

Wow, the plot keeps thickening. Apparently Microsoft can't accurately return the size of a window:

http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/6c1c67a9-5548-4e9b-989f-c7dbac0b1375/getwindowrect-on-nonresizable-windows-under-aero-glass

 

I tried adding a preprocessor define of "WINVER 6" in the code and in the project, but to no avail.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 2 months later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...