Jump to content

Recommended Posts

Posted

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('}');

 

 

 

 

Posted
Hi erich.wanker!
 
Try this:
document.getElementById("'+UniScrollBox1.JSName+'_id-body").scrollTop = 0;
UniSession.AddJS('document.getElementById("'+UniScrollBox1.JSName+'_id-body").scrollTop = 0;');

Sincerely.

  • Upvote 1
  • 7 years later...
Posted

Wait a minute ... I did the test alone and saw that the ScrollBox is already going to the top automatically.

So it must be something else generating the conflict.

I give you feedback.

Thanks in advance for your attention.

Posted

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

Posted
10 hours ago, mikromundo said:

Same error on Frame Ready:

procedure TUniButtonsSpeedButton.UniFrameReady(Sender: TObject);
begin
  sboxGridBlock.JSInterface.JSCall('getScrollable().getScrollElement().setScrollTop', [0]);
end;

 

Posted
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;

 

Posted

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
  • 2 years later...
Posted

I solved the problem without needing to capture the current position.


but... if there is any way... if there is a way to do this without having to use the scrollchange event, I would appreciate it...

  • 8 months later...

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