Jump to content

UniScrollBox Vertical and Horizontal Scroll Position


dkeene

Recommended Posts

Hello

I am trying to retrieve the position of the horizontal and vertical positions on a UniScrollbox. I try

   aScrollX:=Self.UniScrollBox1.HorzScrollBar.Position;
   aScrollY:=Self.UniScrollBox1.VertScrollBar.Position;
 

and I get an access violation. Any Ideas?
Thanks

Doug

Link to comment
Share on other sites

Hello

Is there anyone on the forum that could make a quick example of any way to get the scroll positions of the vertical and horizontal scroll bars? The positions can't be read from delphi, they probably need to go through AJAX, which i am learning, but not yet able to make work.

 

I occasionally need to know where a coordinate is on a scrollbox that might be scrolled with respect to Horizontal or Vertical Position.

 

Thank you kindly

Doug

Link to comment
Share on other sites

49 minutes ago, dkeene said:

I occasionally need to know where a coordinate is on a scrollbox that might be scrolled with respect to Horizontal or Vertical Position.

Hello,

Do you want something like this?

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  with UniScrollBox1 do
    JSInterface.JSCode('ajaxRequest('#1',"getScrollPositions", ["Top="+'#1'.getScrollY(), "Left="+'#1'.getScrollX()]);');
end;
procedure TMainForm.UniScrollBox1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = 'getScrollPositions' then
  begin
    ShowMessage(Params.Values['Top']+','+Params.Values['Left']);
  end;

end;

 

Link to comment
Share on other sites

  • 1 month later...
5 hours ago, Kenneth said:

Actually I need to change TUnimScrollBox position. How can I do it?

procedure TMainmForm.UnimBitBtn1Click(Sender: TObject);
begin
  //UnimScrollBox3.ScrollTo(20, 20);
  UnimScrollBox3.JSInterface.JSCode(
    #1'.getScrollable().getScrollingElement().dom.scrollTo({'+
    '  top: 20,'+
    '  left: 20'+
    '});'
  );
end;

 

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