Jump to content

uniScrollbox -> scrollTop


erich.wanker

Recommended Posts

hi,

 

i want to hide the x scrollbar of a uniScrollbox & scrolling to top-position...

 

the "overflow-x: hidden" - works perfect, but i can not scroll to the top ???

whats wrong with my code - any ideas ?

 

ThanX

Erich

 

UniHTMLFrame1.HTML.Append('<html><head><title>scoller</title>');
UniHTMLFrame1.HTML.Append('<style type="text/css"> DIV#' +UniScrollBox1.JSName+ '_id> DIV {overflow-x: hidden !important;}</style>');     [ THIS WORKS ] 

UniHTMLFrame1.HTML.Append('<script type="text/javascript">');
UniHTMLFrame1.HTML.Append('function tothetop () {');
UniHTMLFrame1.HTML.Append('  ' +UniScrollBox1.JSName+'_id-body.scrollTo(0, 0);');
UniHTMLFrame1.HTML.Append('}');
UniHTMLFrame1.HTML.Append('</script>');
UniHTMLFrame1.HTML.Append('</head>');
UniHTMLFrame1.HTML.Append('<body onload="tothetop()">');
UniHTMLFrame1.HTML.Append('</body></html>');

p.s.:

 

i tryed out - but didn´t help:  

  • UniScrollBox1.JSName+'
  • UniScrollBox1.JSName+'_id
  • UniScrollBox1.JSName+'_id-body

and:

 

UniHTMLFrame1.HTML.Append('function tothetop () {');
UniHTMLFrame1.HTML.Append('document.getElementById("'+UniScrollBox1.JSName+'_id").scrollTo(0, 0);');
UniHTMLFrame1.HTML.Append('}');

 

 

 

 

Link to comment
Share on other sites

  • 7 years later...

Hi @Sherzod

 

I change a DEMO of uniGUI to make a test case:

ButtonsSpeedButton.rar

 

I changed one of the demos to make the demonstration easier.

There are several objects in the FRAME.

Please Overwrite the SpeedButton DEMO( C:\Program Files (x86)\FMSoft\Framework\uniGUI\Demos\Desktop\AllFeaturesDemo\units ) for you to test ok.

When processing, SCROLLBOX does not return to the top.

ButtonsSpeedButton.rar

image.png.a2b18a47699a1be048acf5c574ee1376.png

Link to comment
Share on other sites

3 hours ago, mikromundo said:

Almost...see the test case again, please !!!!

What I realized is that the SCROLL works ... but the initial POSITION of the components remains in the "ON CREATE" state of the frame, that is, hidden at the bottom.

What you ask is not very clear to me.

Maybe you wanted like this?

procedure TUniButtonsSpeedButton.UniFrameCreate(Sender: TObject);
var
  f: integer;
begin
   //Try to see BEFORE and AFTER the loop
   //sboxGridBlock.JSInterface.JSCall('getScrollable().getScrollElement().setScrollTop', [0]);

   for f := 0 to ComponentCount - 1 do
   begin
     TUniControl( Components[f] ).Left := Random( 800 );
     TUniControl( Components[f] ).Top := Random( 2000 );
   end;
end;
procedure TUniButtonsSpeedButton.UniFrameReady(Sender: TObject);
begin
  sboxGridBlock.JSInterface.JSCall('getScrollable().getScrollElement().setScrollTop', [0]);
end;

 

Link to comment
Share on other sites

Hi @Sherzod

Thanks again for your patience.

 

When the application starts, SCROLL goes to the TOP, OK !!!

But, the components should be created at the beginning of the form, only that they are created at the bottom, because, as we left in the design time the scroll bar "further down", it assumes this position.

That's what I'm trying to solve and trying to explain to you. I apologize for the "bad" communication.

 

  • Upvote 1
Link to comment
Share on other sites

  • 2 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...