Jeremy Child

unread,
Jul 21, 2016, 6:53:23 PM7/21/16
to MIT App Inventor Forum
Hi
I want to be able to control what part of the window is visible in an App with the screen set to scrollable.
More specifically I have a number of buttons on the screen, and when I click one I want to set the screen (vertical) scroll position so that the button is in the centre of the visible section.
Can this be done?
Thanks in advance.
Jeremy

Abraham Getzler

unread,
Jul 22, 2016, 10:51:16 AM7/22/16
to MIT App Inventor Forum
Maybe the new scrollable arrangements feature can help?

FYI - Testers needed - ABG
I have just updated ai2-test.appinventor.mit.edu to have code which should be in our next release, currently scheduled for mid-week this coming week.

This *is* a Component release, but the old Companion will mostly work (all but the new Scrollable arrangements will work with the old Companion). For testing ai2-test will ask to auto-update your Companion to the test version (2.37t2).

Release notes can be found here.

-Jeff

Abraham Getzler

unread,
Jul 22, 2016, 10:53:08 AM7/22/16
to MIT App Inventor Forum
Another alternative is to use blank labels an inflatable bladders above and below the buttons,
and adjust the label heights as needed.  I haven't tried this.

ABG

Abraham Getzler

unread,
Jul 22, 2016, 10:56:02 AM7/22/16
to MIT App Inventor Forum
Yet another alternative would be to stack vertical arrangements with subsets of the buttons,
and control their visibility selectively.

This would be good for Options and Settings dialogs.

ABG

Jeremy Child

unread,
Jul 23, 2016, 6:28:50 AM7/23/16
to MIT App Inventor Forum
Thanks, Abraham.  I don;t really know what being a component release means, but I'll have a look. 

I don't think the blank labels thing will work as to use it I'd need to know where the scroll position currently is, and I don't have that available (afaik).

Controlling visibility might work, but only without a scrollable screen (otherwise I'm back to "where is the screen scroll position currently at?").  If I've understood your suggestion correctly, what I'd really be doing is emulating a scroll, and that's not really what I want.

Jeremy Child

unread,
Jul 23, 2016, 6:44:52 AM7/23/16
to MIT App Inventor Forum
I've had a look at the new scrollable arrangements.  They're really neat, but I still have the same problem, I have no way of knowing what part of the scrollable arrangement is currently visible on screen.

Tim at Loddon

unread,
Jul 23, 2016, 7:20:15 AM7/23/16
to mitappinv...@googlegroups.com
Try ABG's suggestion of labels as inflatable bladders, so when you click on a button, the labels are resized to put your button in the middle. (You may also have to turn scrolling off for this to work!)

Another method might be to use the visibility of arrangements (vertical/horizontal) with resizing, to achieve the same thing. (Oops just seen ABG covered this one too ;))

As another alternative consider using the canvas, you then get co-ordinates back from screen touches which you can work with (but this may mean you have to reprogram your whole app!)

Tim

Abraham Getzler

unread,
Jul 23, 2016, 10:49:18 PM7/23/16
to MIT App Inventor Forum
Here's an extra idea to try...

Put your button components into a list at startup time,
and arrange them vertically in a horizontal arrangement on the left,
with a long vertical thin canvas on the right.
Add a little ball to the vertical canvas as a scroll bar.

Use the relative vertical position of the dragged ball in the canvas
to control which section (maybe 3 buttons) of the list are visible at a time.

See this doc and app for an example of using a canvas as a scroll bar
(different app) ...

For your purposes, there is no real scrolling here, just visibility control.

ABG

Reply all
Reply to author
Forward
0 new messages