 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
antonyb
Joined: 26 May 2004 Posts: 61
|
Posted: Wed Mar 09, 2005 4:37 pm Post subject: (Possible) Bug with WinSet, Region? |
|
|
Hi,
When I run the following code, the final WinMaximize doesn't behave as I'd expect it to. The window I run the code on maximises, but I can't see it all - the visible area seems to be exactly the same size as the previously unmaximized window. Hard to explain, but you'll see what I mean.
I presume its something to do with "WinSet, Region, , A" not properly reseting the visible region?
| Code: | #k::
WinMaximize, A
Sleep, 2000
WinRestore, A
Sleep, 2000
WinGetPos , , , ws_width, , A
WinSet, Region, 0-0 W%ws_width% H27, A
Sleep, 2000
WinSet, Region, , A
Sleep, 2000
WinMaximize, A
return |
Open a new window - anything'll do - and hit Win-k, then wait.
Thanks
Ant. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5390 Location: /b/
|
Posted: Wed Mar 09, 2005 4:43 pm Post subject: |
|
|
Hi,
Trying it myself on WinXP Pro it seems to be fine, the last command, maximise has no problems (atlest, none I notice or expect). _________________
 |
|
| Back to top |
|
 |
antonyb
Joined: 26 May 2004 Posts: 61
|
Posted: Wed Mar 09, 2005 4:54 pm Post subject: |
|
|
Oh really?
How weird. Its absolutely repeatable here. Hmm. Will look into it further.
Thanks for trying, titan.
Ant. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Wed Mar 09, 2005 5:08 pm Post subject: |
|
|
Well, I tried it on Notepad and it seems to work okay, but maybe I'm missing something. It's also quite possible that certain types of windows don't like their regions being changed. If you find out more, please post here so that the documentation can be updated with any known limitations.
By the way, your idea of rolling up windows to their title bars using "Region" is a great one. It probably has advantages over the WinMove method. |
|
| Back to top |
|
 |
antonyb
Joined: 26 May 2004 Posts: 61
|
Posted: Wed Mar 09, 2005 5:12 pm Post subject: |
|
|
Very strange. Happens to me with Notepad, Explorer, in fact everything.
Will keep investigating, but can't really imagine what it could be.
Yes - I prefer this to the WinMove method - I found that didn't work on some windows.
Ant. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Wed Mar 09, 2005 5:15 pm Post subject: |
|
|
My understanding is that your window vanishes or that its region doesn't get properly restored by "WinSet, Region, , WinTitle". If this is correct, perhaps you could work around it with one of these:
WinSet, Redraw, , WinTitle
WinMove, WinTitle, , 0, 0 ; Move anywhere to try to force it to redraw.
Last resort:
WinHide, WinTitle
WinShow, WinTitle ; probably best to use ahk_id for WinTitle in both of these. |
|
| Back to top |
|
 |
antonyb
Joined: 26 May 2004 Posts: 61
|
Posted: Wed Mar 09, 2005 5:47 pm Post subject: |
|
|
Hi Chris,
Unfortunately neither of those work.
Thats not exactly the problem. If I have a window, size X,Y, and I call | Code: | WinGetPos , , , ws_width, , ahk_id %winid%
WinSet, Region, 0-0 W%ws_width% H27, ahk_id %winid% |
on it, it "rolls up in to its titlebar", size X,27. If I then call | Code: | | WinSet, Region, , ahk_id %winid% |
the window reappears, size X,Y. If I then maximise that window (either by clicking on the maximise button or by calling WinMaximize from ahk), the window appears to maximise - i.e. moves to 0,0 and appears much wider and taller, but I can only see a section of that window, starting at 0,0, size X,Y.
If I call WinGetPos on the sort-of-maximised window it reports back 1600x1200. If I calling the first bit of code above it rolls up to a proper full length titlebar, and then will unroll properly with the second bit of code (i.e. I can now see the entire window).
Ant. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Thu Mar 10, 2005 1:19 am Post subject: |
|
|
Thanks for the details. As a workaround, you might try explicitly setting the region to be as large as it was originally, rather than relying on "WinSet, Region, , WinTitle" to restore it.
I'm don't yet understand all the side-effects and inner workings of regions, so if you or I find out more about how it works, I'll either document the limitations or try to improve the program. |
|
| Back to top |
|
 |
antonyb
Joined: 26 May 2004 Posts: 61
|
Posted: Fri Mar 11, 2005 10:23 am Post subject: |
|
|
Hi,
| Quote: | | As a workaround, you might try explicitly setting the region to be as large as it was originally, rather than relying on "WinSet, Region, , WinTitle" to restore it. |
Makes no difference. However:
| Code: | SysGet, sys_xres, 61
SysGet, sys_yres, 62
WinSet, Region, 0-0 W%sys_xres% H%sys_yres%, ahk_id %ws_id%
|
Seems to work fine.
The only odd effect I still get is, if I use WinSet to display only the titlebar of a window, as above, and while the window is in this state I click the "Maximize" button, I get a similar effect to the one I describe above.
Ant. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Fri Mar 11, 2005 12:05 pm Post subject: |
|
|
| antonyb wrote: | | The only odd effect I still get is, if I use WinSet to display only the titlebar of a window, as above, and while the window is in this state I click the "Maximize" button, I get a similar effect to the one I describe above. | Once a smaller-than-usual region is in effect, I think it's normal for the window to be a little traumatized and be unable to maximize and change its shape as it normally does.
Thanks for posting the partial workaround. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|