Window zoom invalid Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
afe
Posts: 615
Joined: 06 Dec 2018, 04:36

Window zoom invalid

09 Dec 2018, 12:41

Hello everyone,

When I named the button lowercase "ftp", I encountered a strange phenomenon.
When I click on it, the ftp address in the clipboard is written to Edit box. Zooming the window at this point, the buttons and the edit box cannot move and scale as expected.

But when there is no ftp address in the clipboard or the button name is changed to other or uppercase "FTP" or "Ftp", everything is displayed normally.

Why is this happening? Is ftp a reserved variable name?
Thanks.

Code: Select all

Gui, +Resize
Gui, Add, Edit, h100 w300 vEdit1, This is a test.
Gui, Add, Button,, ftp
Gui, Show
return

GuiSize:
GuiControl, Move, Edit1, % "w" A_GuiWidth -10 "h" A_GuiHeight -40
GuiControl, Move, ftp, % "y" A_GuiHeight -30
return

GuiClose:
ExitApp

; Extract the ftp address in the clipboard and write it to the edit box
Buttonftp:
FoundPos := 1
while FoundPos := RegExMatch(Clipboard, "i)ftp://[0-9A-Z-\._~%!\$&'\(\)\*\+,;=:]{3,}((/[0-9A-Z-\._~%!\$&'\(\)\*\+,;=:@]*)*(/[0-9A-Z-\._~%!\$&'\(\)\*\+,;=:@]+))?(?<![\.'\(\),;])", URL, FoundPos + StrLen(URL))
	r .= URL . "`r`n"
GuiControl, Text, Edit1, %r%
return
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Window zoom invalid  Topic is solved

09 Dec 2018, 13:50

when u type ftp....... in the Edit box, the control's Text becomes ftp.......
when u resize it:
  1. GuiControl, Move, Edit1, ...
    1. goes through the list of available controls in the order that they were created
    2. checks to see if the control has a var, named Edit1
    3. it does, so resize it once
  2. GuiControl, Move, ftp, ...
    1. goes through the list of available controls in the order that they were created
    2. checks to see if the control (remember the Edit box comes first) has a var, named ftp
    3. it doesn't, so check to see if the control's Text starts with ftp (see here and here)
    4. it does, so resize it for the second time
takeaway is: assign hwnds to any controls u intend to manipulate to save urself some hassle in the future
afe
Posts: 615
Joined: 06 Dec 2018, 04:36

Re: Window zoom invalid

10 Dec 2018, 00:28

Thank you very much. It is for this reason.
Thank you for your advice.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: BielGuitarJP, CrowexBR, mebelantikjaya, songdg, Spawnova and 307 guests