Locate two buttons in GUI Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
john_c
Posts: 493
Joined: 05 May 2017, 13:19

Locate two buttons in GUI

25 Apr 2018, 11:06

How it could be fixed?

It looks almost as I want, but Bar button should be on the same level with Foo.

Code: Select all

gui add, text,, Text text text text text text
gui add, button, gFoo, Foo
gui add, button, gBar ym, Bar
gui show,, Foobar
return

GuiClose:
exitApp

Foo:
exitApp

Bar:
exitApp
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Locate two buttons in GUI  Topic is solved

25 Apr 2018, 11:10

yp aligns the "Bar" button to the same y-coordinate as the previous control. x+10 is used to add some padding between the controls.

Code: Select all

#SingleInstance, Force

Gui, Add, Text,, Text Text Text Text Text Text
Gui, Add, Button, gFoo, Foo
Gui, Add, Button, gBar x+10 yp, Bar
Gui, Show, AutoSize, Foobar
return

Foo:
Bar:
GuiClose:
	ExitApp
return
john_c
Posts: 493
Joined: 05 May 2017, 13:19

Re: Locate two buttons in GUI

25 Apr 2018, 11:16

TheDewd wrote:...
Yes, thanks. Actually, I already seen this workaround on internet - but it's really only a workaround, hardcoded. Probably there exists better way for it?
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: Locate two buttons in GUI

25 Apr 2018, 13:06

What do you mean with workaround ? The solution posted by TheDewd it's the right way to position a Gui control in relation to the previous control. And surely it has to be hardcoded. The interpreter needs to know where the button must be rendered in the Gui.
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
john_c
Posts: 493
Joined: 05 May 2017, 13:19

Re: Locate two buttons in GUI

25 Apr 2018, 14:14

TheDewd wrote:...
Sorry, it was my fault, I misunderstood your answer. It works excellent. Thank you very much! :-)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: drani, montie and 231 guests