erich.wanker Posted November 13, 2013 Posted November 13, 2013 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('}'); Quote
Sherzod Posted November 14, 2013 Posted November 14, 2013 Hi erich.wanker! Try this: document.getElementById("'+UniScrollBox1.JSName+'_id-body").scrollTop = 0; UniSession.AddJS('document.getElementById("'+UniScrollBox1.JSName+'_id-body").scrollTop = 0;'); Sincerely. 1 Quote
erich.wanker Posted November 14, 2013 Author Posted November 14, 2013 thank you - works perfect :-) .... nice greetings from austria ... erich 1 Quote
mikromundo Posted January 11, 2021 Posted January 11, 2021 @Sherzod do you can help me ? Please... I have this issue with the same code above: Quote
Sherzod Posted January 11, 2021 Posted January 11, 2021 1 minute ago, mikromundo said: I have this issue with the same code above: Hi, Do you have a simple testcase? Quote
mikromundo Posted January 11, 2021 Posted January 11, 2021 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. Quote
mikromundo Posted January 11, 2021 Posted January 11, 2021 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 Quote
mikromundo Posted January 17, 2021 Posted January 17, 2021 Hi @Sherzod Some info about the post above ? Quote
Sherzod Posted January 18, 2021 Posted January 18, 2021 4 hours ago, mikromundo said: Some info about the post above ? Hi, Sorry, I will check your testcase. Quote
Sherzod Posted January 18, 2021 Posted January 18, 2021 6 hours ago, mikromundo said: Some info about the post above ? Such codes should be used in the UniFrameReady event. Quote
mikromundo Posted January 18, 2021 Posted January 18, 2021 Hi @Sherzod Same error on Frame Ready: Quote
Sherzod Posted January 19, 2021 Posted January 19, 2021 10 hours ago, mikromundo said: Same error on Frame Ready: procedure TUniButtonsSpeedButton.UniFrameReady(Sender: TObject); begin sboxGridBlock.JSInterface.JSCall('getScrollable().getScrollElement().setScrollTop', [0]); end; Quote
mikromundo Posted January 19, 2021 Posted January 19, 2021 Hi @Sherzod 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. ButtonsSpeedButton.rar Quote
Sherzod Posted January 19, 2021 Posted January 19, 2021 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; Quote
mikromundo Posted January 19, 2021 Posted January 19, 2021 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. scrollbox.mp4 1 Quote
mikromundo Posted October 30, 2023 Posted October 30, 2023 @Sherzod how can I get uniscrollbox.HorzScrollBar.Position ? I get A.V. message... Quote
mikromundo Posted October 30, 2023 Posted October 30, 2023 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... 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.