Jump to content

Easiest way to enable scrolling on a Form nativly?


Recommended Posts

Hi i was wondering if someone could explain the process of enabling scrolling on a form without mapping a TW3ScrollBox over the whole thing, and then mapping the components to ScrollBox.Contents?

 

If that's the easiest method that's fine, it's just a bit tedious rearranging the inheritance of a lot of my project if there is a better method available.

 

For example would i want to add a ScrollController property/object to the form and then expect that to be sufficient?

Link to post
Share on other sites
  • Moderators

you can do this

 

Have a form with a panel :

 

procedure TForm1.InitializeObject;
begin
  inherited;
  {$I 'Form1:impl'}
  W3Panel1.Height := 2000;                   //force panel to exceed screen size
  self.handle.style.overflow := 'auto';
end;

if you want to limit scrolling to vertical scrolling only, then use the 'overflow-y' property, like

self.handle.setAttribute('style','overflow-y:auto');

 

You can use this on any element you want to enable scrolling for

 

  var Panel2 := TW3Panel.Create(W3Panel1);            
  Panel2.SetBounds(20,20, 100, 3000);                 // force new panel to exceed parent size
  W3Panel1.handle.style.overflow := 'auto';
Link to post
Share on other sites

Thanks Nico, this is what i was using before, but have switched to using TW3ScrollBox as the chrome browser was giving me grief with pull-down-to-refresh on mobile. Something which i couldn't disable with the typical method of preventDefault because i was using that scrolling method.

 

The overflow method is very convenient but i guess it doesn't work out for my specific case so well.

Link to post
Share on other sites
  • Moderators

There is an old post on scrolling forms

http://forums.smartmobilestudio.com/index.php?/topic/4243-scrolling

 

This still works in the new alpha

(just change mChild: TW3Component to mchild: TW3TagContainer;)

 

It uses iScroll and you just have to add the ScrollForm unit to your project

 

May be of use to you

Link to post
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...