Jump to content

How to code (alignment Client) Panel Scallbar to horizontal scroll with timer?


newsanti

Recommended Posts

12 minutes ago, newsanti said:

ClientScrollBoxEvent.zip 98.44 kB · 0 downloads

Try this approach:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  //UniContainerPanel1.ScrollBy(-100,0);    //not working
  UniContainerPanel1.JSInterface.JSCall('getScrollable().scrollBy', [-100, 0]);
end;

procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  //UniContainerPanel1.ScrollBy(100,0);    //not working
  UniContainerPanel1.JSInterface.JSCall('getScrollable().scrollBy', [100, 0]);
end;

 

  • Like 1
Link to comment
Share on other sites

3 minutes ago, Sherzod said:

Try this approach:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  //UniContainerPanel1.ScrollBy(-100,0);    //not working
  UniContainerPanel1.JSInterface.JSCall('getScrollable().scrollBy', [-100, 0]);
end;

procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  //UniContainerPanel1.ScrollBy(100,0);    //not working
  UniContainerPanel1.JSInterface.JSCall('getScrollable().scrollBy', [100, 0]);
end;

 

procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
  var oPanel:= UniContainerPanel1;
  UniContainerPanel1.JSInterface.JSCall('getScrollable().scrollBy', [50, 0]);
end;
How to Check..Left / Right Positon to Reverse Scroll?

Link to comment
Share on other sites

41 minutes ago, newsanti said:

How to Check..Left / Right Positon to Reverse Scroll?

Try this approach:

procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
  UniContainerPanel1.JSInterface.JSCode(
    'var container='#1';'+
    'if (container.getScrollable().getScrollElement().getScrollLeft() == 0) {delta=1};'+
    'if (container.getScrollable().getScrollElement().getScrollLeft()+container.width == container.getScrollable().getScrollElement().dom.scrollWidth) {delta=-1};'+
    'container.getScrollable().scrollBy(100*delta,0);'
  )
end;

 

Link to comment
Share on other sites

19 minutes ago, Sherzod said:

Try this approach:

procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
  UniContainerPanel1.JSInterface.JSCode(
    'var container='#1';'+
    'if (container.getScrollable().getScrollElement().getScrollLeft() == 0) {delta=1};'+
    'if (container.getScrollable().getScrollElement().getScrollLeft()+container.width == container.getScrollable().getScrollElement().dom.scrollWidth) {delta=-1};'+
    'container.getScrollable().scrollBy(100*delta,0);'
  )
end;

 

Stop When End Right. Not Back.

Link to comment
Share on other sites

39 minutes ago, newsanti said:

html - Understanding offsetWidth, clientWidth, scrollWidth and -Height,  respectively - Stack Overflow

procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
  var oPanel:= UniContainerPanel1;
  oPanel.JSInterface.JSCode(
    'var container='#1';'+
    'if (container.getScrollable().getScrollElement().getScrollLeft() == 0) {delta=1};'+
    'if (container.getScrollable().getScrollElement().getScrollLeft()+container.width+20'+
    ' >= container.getScrollable().getScrollElement().dom.scrollWidth) {delta=-1};'+
    'container.getScrollable().scrollBy(100*delta,0,true);'
  )
end;

+20 is work!

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...