1
votes

I am using Delphi XE8 to develop an Android application, and I want to move the ViewportPosition of a VertScrollBox when a button is clicked, to see a specific component (somewhere in the VertScrollBox).

But set the value of ViewportPosition does not work (I tried the answer here : Go Top a TVertScrollBox) and the method ScrollBy does not work neither (http://docwiki.embarcadero.com/Libraries/Seattle/en/FMX.Layouts.TVertScrollBox).

I tried this :

procedure TFormTournee.T3ButtonBackToTopClick(Sender: TObject);
begin
    T1VertScrollBox.ViewportPosition := PointF(T1VertScrollBox.ViewportPosition.X, 0);
    T1VertScrollBox.RealignContent;
end;

And that :

procedure TFormTournee.T3ButtonBackToTopClick(Sender: TObject);
begin
    T1VertScrollBox.ScrollBy(0,-100);
    T1VertScrollBox.RealignContent;
end;

For now, I just tried on Windows (I have to fix an other problem on Android about insufficient storage), but nothing change when I click, and it is supposed to work the same on Windows and Android, isn't that right ? So can anybody help me, please ? Or perhaps explain me what I am doing wrong ? Thanks !

1
on xe8 tvertscrollBox is buggy and must be avoided on firemonkey. Can you try with the Talvertscrollbox (fully similare to TvertscrollBox) here: svn.code.sf.net/p/alcinoe/codezeus
i never try on xe8 :( what error you have ?zeus
Thank you for your answer, I just tried to install it, like it is explain in the INSTALL part of readme_firemonkey.txt, but it do not works : 1. if I take the java\dex\xx\classes.dex and put him like shown in classes_dex.png, delphi says me INSTALL_FAILED_DEXOPT; 2. if I try to execute java/build_xx.bat (%ANDROID% and %EMBO_DEX% variables setted), it is write that all specified files are untraceable Perhaps I forget to do something or took some file, but I am a beginner and I am absolutely not familiar with external components like this TalvertscrollboxManon
I am just thinking, for the first way, it just cannot works because the .dex have been created from Berlin, and I am using XE8, it is not supposed to be compatible with previous Delphi versions, isn't it ? So it could be the same reason for the second way, so I tried the compile_dxe2.bat in the archive folder, but it do not works either, perhaps too old ?Manon
yes exactly, dex is for berlin :( i don't have xe8 unfortunatly to compile. but don't worry for the scrollbox you don't need the .dex (you need it for the native android Edit only). can you just try to compile and install Alcinoe_berlin.dproj ?zeus

1 Answers

1
votes

So, if there is someone trying to program a scroll in a TVertScrollBox, with ScrollBy or ViewportPosition, and if it is not working, @loki 's link in the comments refer to an alternative working on Windows and Android (I cannot try on iOS but it is supposed to work too) (https://svn.code.sf.net/p/alcinoe/code/). I had to do a few adjustments because I am working on Delphi XE8, but it was really quick.

On that procedure, the button click positionned the VertScrollBox on the component Panel:

procedure TFormTournee.ButtonClick(Sender: TObject);
begin
    // The position is placed at the top
    ALVertScrollBox1.ScrollBy(0, ALVertScrollBox.Width);
    // And then it go down to the panel position
    ALVertScrollBox1.ScrollBy(0, -Panel.Position.Y);
end;

Once more, thank you @loki !