Error in "Screen.AlignHorizontal" - Values 2 and 3 are switched.

46 views
Skip to first unread message
Assigned to halatmi...@gmail.com by taifu...@gmail.com

A. Leo

unread,
Feb 12, 2016, 8:13:46 AM2/12/16
to mitappinv...@googlegroups.com
There is an error in Screen.AlignHorizontal and/or documentation:
...
http://ai2.appinventor.mit.edu/reference/components/userinterface.html#Screen
...
says, that for
AlignVertical these values are correct:
1 = aligned at the top, 2 = vertically centered, 3 = aligned at the bottom
1, 2, 3 from top to bottom makes sense!

For AlignHorizontal the documentation says that these values are correct:
1 = left aligned, 2 = horizontally centered, 3 = right aligned
which would make sense.

But actually AI2 implements it like this:
1 = left aligned, 2 = right aligned, 3 = horizontally centered

So, 2 and 3 are sadly switched.
I attached the file "AlignHorizontalVertical.aia", which moves a little green canvas around and shows the settings in the titlebar.

Greetings
Andreas
AlignHorizontalVertical.aia

Hal Abelson

unread,
Feb 14, 2016, 5:04:21 PM2/14/16
to MIT App Inventor Forum
Thanks for reporting this.   I'm working on fixing it, but I need to do it in such a way as to not break existing projects.

Scott Ferguson

unread,
Feb 14, 2016, 6:27:48 PM2/14/16
to MIT App Inventor Forum
How about  just changing the documentation?
---
sf

A. Leo

unread,
Feb 14, 2016, 6:49:27 PM2/14/16
to MIT App Inventor Forum
Hello Hal,

I'm glad I could help a little.

I really have a hard time finding a solution for this error. All I can think about is searching through all existing projects and changing there sourcecodes. I studied computer science myself, but I don't know a better solution like this.

Please let me know, how you'll fix it.

Thank you
Andreas

Abraham Getzler

unread,
Feb 14, 2016, 10:24:31 PM2/14/16
to MIT App Inventor Forum
@Scott +1.
A doc change is all that's needed.
ABG

A. Leo

unread,
Feb 15, 2016, 9:56:53 AM2/15/16
to mitappinv...@googlegroups.com
Sadly I still don't found another solution besides parsing all existing source codes.
Maybe a future mandatory conversion from AI2 to AI3 sourcecodes bundled with other errors of this kind?

Just changing the documantation works for sure, but it'll also leave a inconsistency in the documentation between vertical and horizontal allignment.

:-(

Greetings
Andreas

Scott Ferguson

unread,
Feb 15, 2016, 3:54:50 PM2/15/16
to MIT App Inventor Forum
Just changing the documantation works for sure, but it'll also leave a inconsistency in the documentation between vertical and horizontal allignment.
Agreed.
A kludge may be for the developers to swap 2 and 3 in the sources so the user can continue to use 2 for center and 3 for right align.
To the user it will work as expected.
I don't know how easy that would be to do but as long as it is documented in the sources, so others know what is going on, it might work.
Alternatively, I say bite the bullet and break any apps that are using these values and publish on the forum that the bug was fixed but broke stuff.
This is a learning tool, after all. We are not controlling the space station or air traffic with it :)
---
sf

Reply all
Reply to author
Forward
0 new messages