Jump to content

Mobile Scrollbox


RobYost

Recommended Posts

I have a mobile scrollbox.  I slide up to see the hidden part of the screen, when I let go it automatically goes back to the top of the scroll box so I can not select anything at the bottom of the scroll box.

 

I have attached an mp4 screen capture of the problem, but it wouldn't let me upload a mp4 file, so I renamed it .txt.  You will need to rename it back to mp4 to watch the video.

 

In the video the first scroll box works OK, the second one is the one that pops back.

 

Does anyone have any ideas?

 

Thanks.

 

UPDATE: I thought it might be related to being on a tabsheet, but I moved the scrollbox to the mainform, but the problem is the same.

scrollbox .txt

Link to comment
Share on other sites

If I fill the scrollbox in the create event it works

 

If I fill it from a button click it does not.

 

The project I sent will fail (scroll snaps back to top)

but if you uncomment the line in the create event it will work.

 

 

The problem with this is what ever size you load in the create event is how large the scroll box is for the rest of the program.

ScrollBox.zip

Link to comment
Share on other sites

In your case, can you try to use this approach ?!:

var
  i  : Integer;
  top: Integer;
  txt: string;
  _top: Integer; // <-----
for i := 0 to Length(aMemo) - 1 do
begin
  ...
end;

_top := top - UnimScrollBox1.Height + UnimScrollBox1.Top; // <-----
UnimScrollBox1.JSInterface.JSCode('var me='#1'; me.scrollableBehavior.scrollView.getScroller().maxPosition.y = '+ IntToStr(_top) +';'); // <-----  
Link to comment
Share on other sites

Thanks, it worked perfectly for my test project.

 

It didn't work on my real project, so I am looking into what is different.

 

If you have any ideas what could go wrong, please let me know.

 

Thanks again.

 

PS: I changed _top to 3000, but it still won't scroll down.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...