Add GUI elements with a dynamic Y position

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
JensHaglof
Posts: 81
Joined: 04 Jul 2017, 11:41

Add GUI elements with a dynamic Y position

Post by JensHaglof » 07 Jun 2023, 03:57

Hello!
I have a GUI that populates the screen with Textboxes every time you scan a barcode.

This particular code fails. How do you add textboxes where the y position changes?

Code: Select all

YPosition = 380 + (%NumberOfScansDone% * 90)
Gui, Add, Text, x300 y%YPosition% w800 h45
Gui, Add, Text, x1130 y%YPosition% w240 h45
I've also tried:

Code: Select all

YPosition := 380 + (%NumberOfScansDone% * 90)
Gui, Add, Text, x300 y%YPosition% w800 h45
Gui, Add, Text, x1130 y%YPosition% w240 h45
And

Code: Select all

Gui, Add, Text, x300 y380 + (%NumberOfScansDone% * 90) w800 h45
Gui, Add, Text, x1130 y380 + (%NumberOfScansDone% * 90) w240 h45
Last edited by JensHaglof on 07 Jun 2023, 04:17, edited 1 time in total.

Rohwedder
Posts: 7645
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Add GUI elements with a dynamic Y position

Post by Rohwedder » 07 Jun 2023, 04:17

Hallo,
try:

Code: Select all

YPosition := 380 + (0 NumberOfScansDone) * 90
Gui, Add, Text, x300 y%YPosition% w800 h45
Gui, Add, Text, x1130 y%YPosition% w240 h45

JensHaglof
Posts: 81
Joined: 04 Jul 2017, 11:41

Re: Add GUI elements with a dynamic Y position

Post by JensHaglof » 07 Jun 2023, 04:18

It worked!

Thank you! :)
/Jens

Post Reply

Return to “Ask for Help (v1)”