Page 1 of 1

Control positioning bug???

Posted: 06 Dec 2018, 13:33
by jsmain
So the help documentation states the following....
X: X-position. For example, specifying x0 y0 would position the control in the upper left corner of the window's client area, which is the area beneath the title bar and menu bar (if any). If X is omitted but not Y, the control will be positioned to the right of all previously added controls, which can be thought of as starting a new "column".

Y: Y-position. If Y is omitted but not X, the control will be positioned beneath all previously added controls, which can be thought of as starting a new "row".

Omitting either X, Y or both is useful to make a GUI layout automatically adjust to any future changes you might make to the size of controls or font. By contrast, specifying an absolute position for every control might require you to manually shift the position of all controls that lie beneath and/or to the right of a control that is being enlarged or reduced.
However, the following code places the edit box on top of the text, not beside it as indicated in the quote above...

Code: Select all

#SingleInstance,Force
gui, add, text,, text control:
Gui, add, edit,yp, my edit
Gui, Add, text, ,new text
Gui, Add, text, yp ,new text
Gui, Show, w200 h200
return
I'm using version 1.1.30.00 on Windows 7 x64 while experiencing this. Seems to only be a problem with "x", as "y" seems to work as expected.

Re: Control positioning bug???

Posted: 07 Dec 2018, 04:18
by just me
xp+n, yp+n, xp-n, yp-n (where n is any number) can be used to position controls relative to the previous control's upper left corner, which is often useful for enclosing controls in a GroupBox.
I.e., yp implies xp if the x-position is not specified.

Re: Control positioning bug???

Posted: 07 Dec 2018, 11:05
by jsmain
??????
The second and third lines of my example code, as per the documentation I provided should place the edit box beside the text label, not on top of it. yp means to place it in the same y row, yp+n would place it in another y row.
My problem is with the X column. Not signifying an x, it should start a new column, but instead places in the same column, on top of the previous control! I could use xp+n, but that defeats the purpose of having a dynamic interface. And, it is how I have fixed the problem, but that doesn't fix the discrepancy of how the documentation says the software works, and how it actually works! Are you stating I cannot use yp to make it work correctly??? I guess so! As it appears to work with hard coded values.
Seems foolish that hard coded works, while p cancels it out.

Re: Control positioning bug???

Posted: 07 Dec 2018, 12:10
by swagfag
specify x+m to achieve the desired behavior.

Re: Control positioning bug???

Posted: 08 Dec 2018, 06:25
by just me
Whenever you use yp (with or without +/-n) xp will the default for the x-position. The same is true for for xp -> yp.

This will add 3 Text controls at the same position:

Code: Select all

#NoEnv
Gui, Add, Text, w200, Test text 1!
Gui, Add, Text, w200 yp, Test text 2!  ; defaults to xp
Gui, Add, Text, w200 xp, Test text 3!  ; defaults to yp
Gui, Show, , Test
Return
GuiClose:
ExitApp