StrokesPlus.net Forum
»
General Discussion
»
Feature Requests
»
Expose GetClientRect for consistent window sizing.
Rank: Newbie
Groups: Approved
Joined: 8/10/2019(UTC) Posts: 4
Thanks: 3 times Was thanked: 1 time(s) in 1 post(s)
|
This is in response to the sticky in scripts: Working with Window Size and Location
As you've noted in the comments there are inconsistencies in the window placement when trying to resize a window to fit, for example, 1/3 the screen; however, this isn't a system dependent problem but rather an application dependent one. This is caused by some windows ignoring SM_CXFRAME and SM_CXBORDER and using some of that space for a custom border or borderless appearance. Windows that use the entire border area for their client can appear quite a bit larger than a window with standard borders. This becomes very noticeable and problematic on a multi-monitor setup as aligning a window to the edge of a monitor will work perfectly for some programs while others will overflow onto the next monitor, leaving an ugly strip that invites misclicks while blocking another window. These problematic windows can be cut off quite a bit vertically or overlap their same-monitor neighbors as well. (One example I found of a "borderless" window is the discord client, which does a great job of demonstrating the issue.)
This can be entirely solved by using a combination of getWindowRect (.Rectangle) and the proposed getClientRect to determine the true border sizes for a window. From what I've seen the client Rect accurately reflects the "real" or visual size of a window and would allow all windows to be positioned perfectly.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 Location: Tampa, FL Thanks: 28 times Was thanked: 416 time(s) in 354 post(s)
|
I'm out of town until Monday night, but will look into it when I get home.
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 Location: Tampa, FL Thanks: 28 times Was thanked: 416 time(s) in 354 post(s)
|
In release 0.3.3.3:
- Added .ClientRectangle property (read only) to SystemWindow class which returns a Rectangle with the client coordinates. Note that the top left of client coordinates always begin at 0,0. Also ClientRectangle size is exclusive, meaning the right and bottom values are always just outside of the actual client area e.g. action.Window.ClientRectangle sp.ForegroundWindow().ClientRectangle - Added .ScreenPointToClientPoint(point) to SystemWindow class which translates a screen point to a client point relative to the upper-left corner of the window's client area - Added .ClientPointToScreenPoint(point) to SystemWindow class which translates a client point to a screen point relative to the upper-left corner of the screen
|
1 user thanked Rob for this useful post.
|
|
|
StrokesPlus.net Forum
»
General Discussion
»
Feature Requests
»
Expose GetClientRect for consistent window sizing.
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close