dkeene Posted March 19, 2020 Posted March 19, 2020 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 Quote
dkeene Posted March 25, 2020 Author Posted March 25, 2020 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 Quote
Sherzod Posted March 25, 2020 Posted March 25, 2020 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; Quote
Sherzod Posted May 13, 2020 Posted May 13, 2020 24 minutes ago, Kenneth said: How to do it for mobile version? Hello, You can use OnScrollChange event. Quote
Kenneth Posted May 13, 2020 Posted May 13, 2020 @Sherzod Thanks It work. Actually I need to change TUnimScrollBox position. How can I do it? Quote
Sherzod Posted May 14, 2020 Posted May 14, 2020 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; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.