[solved] Windows are not correctly resized on certain OS

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
bichlepa
Posts: 183
Joined: 15 Aug 2014, 06:44
Location: Germany
Contact:

[solved] Windows are not correctly resized on certain OS

03 Dec 2015, 13:54

Hi, I'm struggeling with a problem of the user Danielsan73 using AutoHotFlow. On his Windows 8 the windows are not moved correctly.
I've already written a test tool in order to localize the problem.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


gui,1:Default

w:=A_ScreenWidth-50
h:=A_ScreenHeight-200

gui,add,button,w200 h30, A button of a big window
gui,show, x15 y15 w%w% h%h%, GUI 1 Big

gui,2:Default

gui,add,button,w200 h30, OK
gui,show, x30 y10 w220 h50, GUI 2

gui,3:Default
gui,add,text,w200 , some Text
gui,+hwndGUI2HWND
gui,show,,GUI 3
WinMove,ahk_id %GUI2HWND%,,30,140,220, 100

gui,4:default
gui,add,button,,a button
gui,show,,GUI 4
WinMove,GUI 4,,30,350

gui,5:default
gui,add,text,w200 , some Text
gui,add,button,w300 h100,a button
gui,show,,GUI 5

return

1guiclose:
2guiclose:
3guiclose:
4guiclose:
5guiclose:
ExitApp
This are two screenshots: One of Danielsan73:
Image
This is how it looks on my computer:
Image
This are the results of my analysis:
GUI 4 and 5 are same size in both pictures. The sizes of the GUIs were not specified in the script.
GUI 1, 2 and 3 have wrong size. The sizes of the GUIs were either set on creation or they were moved. Although the sizes of GUIs 2 and 3 were set to a specific value, they are not correct. GUI 1 was set to be almost screen-filling, depending of a_screenheight and a_screenwidth. Althoug the values in those build in variables are correct (already tested in an other test script), the GUI becomes too big.

What may be the reason and solution?
Last edited by bichlepa on 04 Dec 2015, 02:32, edited 1 time in total.
Scripting is too complicated? Try AutoHotFlow, the graphical automation tool! Written in AutoHotkey.
User avatar
joedf
Posts: 8949
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Windows are not correctly resized on certain OS

03 Dec 2015, 15:49

Hmm.... You should set a Minsize and control the position and size of everything on the guisize label. Try using relative positioning and sizing. The screenshots look the same to me :/ ?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: Windows are not correctly resized on certain OS

03 Dec 2015, 15:58

two options

1. make sure both people are using the same scaling level in Control Panel -> Display

2. use Gui, -DPIScale
https://www.autohotkey.com/docs/command ... m#DPIScale

User avatar
bichlepa
Posts: 183
Joined: 15 Aug 2014, 06:44
Location: Germany
Contact:

Re: Windows are not correctly resized on certain OS

04 Dec 2015, 02:24

Thank you, guest3456!
I tried to change the scaling level and this caused the issue. I will use Gui, -DPIScale.
Scripting is too complicated? Try AutoHotFlow, the graphical automation tool! Written in AutoHotkey.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], haomingchen1998 and 252 guests