andyhill Posted September 21, 2021 Share Posted September 21, 2021 In my project I can set panel setScrollTop and setScrollLeft with the following code - works as expected. RightPanel.JSInterface.JSCall('body.setScrollTop', [0]); TopPanel.JSInterface.JSCall('body.setScrollLeft', [0]); If I understand correctly, to scroll to bottom I will need a 'div' id in the body script as a locator ? As for right ? Please advise with code example how to setScrollBottom and setScrollRight an a panel containing a HTMLFrame ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
andyhill Posted September 23, 2021 Author Share Posted September 23, 2021 Experimenting:- HTMLFrame ... <head> <script type="text/javascript"> function gotoBottom(id) { var element = document.getElementById(id); element.scrollTop = element.scrollHeight - element.clientHeight; } </script> </head> <body id="Right"> ... </body> ... HTMLFrame.JSInterface.JSCode('gotoBottom("Right");'); // ERRORS Cannot read properties of null (reading 'scrollHeight') Please advise howto - thanks in advance Quote Link to comment Share on other sites More sharing options...
andyhill Posted September 24, 2021 Author Share Posted September 24, 2021 Sherzod, Can you please advise - thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 25, 2021 Share Posted September 25, 2021 On 9/24/2021 at 2:34 AM, andyhill said: Experimenting:- HTMLFrame ... <head> <script type="text/javascript"> function gotoBottom(id) { var element = document.getElementById(id); element.scrollTop = element.scrollHeight - element.clientHeight; } </script> </head> <body id="Right"> ... </body> ... HTMLFrame.JSInterface.JSCode('gotoBottom("Right");'); // ERRORS Cannot read properties of null (reading 'scrollHeight') 4 hours ago, andyhill said: Can you please advise - thanks Hello, Please try to create a working example. This does not mean that the problem will be solved, although it will make it easier to reproduce and see the problem. Quote Link to comment Share on other sites More sharing options...
andyhill Posted September 25, 2021 Author Share Posted September 25, 2021 Test Case Project1.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 26, 2021 Share Posted September 26, 2021 On 9/25/2021 at 12:17 PM, andyhill said: Project1.zip 30.7 kB · 1 download I'm checking, so far to no avail... Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 1, 2021 Author Share Posted October 1, 2021 Any progress Sherzod ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 2, 2021 Share Posted October 2, 2021 4 hours ago, andyhill said: Any progress UniHTMLFrame1.ClientEvents.UniEvents.Clear; s:= 'beforeInit=function beforeInit(sender, config)'#13#10+ '{ '#13#10+ ' config.minHeight = 3600;'#13#10+ // THIS IS A MUST FOR MY PRODUCTION PROJECT '} '; UniHTMLFrame1.ClientEvents.UniEvents.Add(s); This is the reason why scrolling does not work. You need to use UniHTMLFrame.AutoScroll=True instead. Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 2, 2021 Author Share Posted October 2, 2021 Yes my test case was thrown together. Actually in my real project the LeftHTMLFrame and the RightHTMLFrame have NO HEIGHT DECLARATIONS only width (they auto grow based on contents). LeftHTMLFrame.ClientEvents.UniEvents.Clear; s:= 'beforeInit=function beforeInit(sender, config)'#13#10+ '{ '#13#10+ ' config.minWidth = 149;'#13#10+ // 160 ' config.Width = 149;'#13#10+ ' config.maxWidth = 149;'#13#10+ '} '; LeftHTMLFrame.ClientEvents.UniEvents.Add(s); RightHTMLFrame.ClientEvents.UniEvents.Clear; s:= 'beforeInit=function beforeInit(sender, config)'#13#10+ '{ '#13#10+ ' config.minWidth = 149;'#13#10+ // 160 ' config.Width = 149;'#13#10+ ' config.maxWidth = 149;'#13#10+ '} '; RightHTMLFrame.ClientEvents.UniEvents.Add(s); In code I want to scroll to the BOTTOM of the HTMLFrame canvas (horz scrollbar auto shows when canvas contents is longer than the visible parent panel). Using similar code RightHTMLFrame.JSInterface.JSCall('body.setScrollTop', [0]); ---> (body.setScrollBottom' ... Quote Link to comment Share on other sites More sharing options...
andyhill Posted October 6, 2021 Author Share Posted October 6, 2021 Sherzod, any progress ? Quote Link to comment Share on other sites More sharing options...
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.