robinhodemorais Posted November 11, 2019 Posted November 11, 2019 How do I set the scroll position of UniHTMLFrame? Quote
robinhodemorais Posted November 12, 2019 Author Posted November 12, 2019 Oops I found the solution ... UniSession.AddJS (UniHTMLFrame1.JSName + '. GetTargetEl (). ScrollBy (0,1500, false);'); However ... I can animate this progress of the scroll Quote
robinhodemorais Posted November 13, 2019 Author Posted November 13, 2019 Guys I need to do it another way now, because I switched to URLFrame because of some adjustments I was not able to make with HTMLFrame, so I spent scrolling from an HTML class that I set up, so I need when to open this class I set an X value on her Scroll, but how do I do that? the class is .schedule-body--helper https://codepen.io/robinhodemorais/pen/oNNPzwx?editors=1000 Quote
Sherzod Posted November 13, 2019 Posted November 13, 2019 2 hours ago, robinhodemorais said: Guys I need to do it another way now, because I switched to URLFrame because of some adjustments I was not able to make with HTMLFrame, so I spent scrolling from an HTML class that I set up, so I need when to open this class I set an X value on her Scroll, but how do I do that? Please explain in more detail. Quote
robinhodemorais Posted November 13, 2019 Author Posted November 13, 2019 1 hour ago, Sherzod said: Please explain in more detail. I set up a calendar in html, follows the code https://codepen.io/robinhodemorais/pen/oNNPzwx?editors=1000 In this schedule I have a class with sroll and an id <div id = "RobinhoTest" class = "schedule-body - helper"> So what I wanted to do is take this scroll and change its position, because then I will do a logic to check the time and thus the scroll to a certain time to focus the user. For example in image 1 is how it opens the schedule, let's suppose now it is 14hs, I would like to set the scroll to position the time as in image 2 Quote
Sherzod Posted November 13, 2019 Posted November 13, 2019 2 minutes ago, robinhodemorais said: For example in image 1 is how it opens the schedule, let's suppose now it is 14hs, I would like to set the scroll to position the time as in image 2 Can you make a simple testcase for this?! Quote
robinhodemorais Posted November 13, 2019 Author Posted November 13, 2019 yes of course follows attached Schedule.rar Quote
Sherzod Posted November 13, 2019 Posted November 13, 2019 29 minutes ago, robinhodemorais said: I would like to set the scroll to position the time as in image 2 Exactly at what moment? Quote
robinhodemorais Posted November 13, 2019 Author Posted November 13, 2019 25 minutes ago, Sherzod said: Exactly at what moment? I would have to find some way to check the current time and position logic, for example in HTMLFrame I had done this way because I used the HTMLFrame Scroll, but with URLFrame I had better results with it, including using the schedule scrool, so not missing the names of dentists _hrAtual := FormatDateTime('hh:mm',now); if (_hrAtual > '10:00') and (_hrAtual < '11:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,200, false);') else if (_hrAtual > '11:00') and (_hrAtual < '12:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,350, false);') else if (_hrAtual > '12:00') and (_hrAtual < '13:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,450, false);') else if (_hrAtual > '13:00') and (_hrAtual < '14:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,550, false);') else if (_hrAtual > '14:00') and (_hrAtual < '15:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,650, false);') else if (_hrAtual > '15:00') and (_hrAtual < '16:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,800, false);') else if (_hrAtual > '16:00') and (_hrAtual < '17:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,950, false);') else if (_hrAtual > '17:00') and (_hrAtual < '18:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,1100, false);') else if (_hrAtual > '18:00') and (_hrAtual < '19:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,1200, false);') else if (_hrAtual > '19:00') and (_hrAtual < '20:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,1350, false);') else if (_hrAtual > '20:00') then UniSession.AddJS(UniHTMLFrame1.JSName+'.getTargetEl().scrollBy(0,1500, false);'); Quote
Sherzod Posted November 13, 2019 Posted November 13, 2019 1 hour ago, robinhodemorais said: the schedule scrool For example, can you try? procedure TMainForm.UniFormReady(Sender: TObject); begin UniSession.AddJS( 'Ext.defer(function() {'+ ' var _el='+ UniURLFrame1.JSName +'.iframe.contentDocument.getElementsByClassName("schedule-body--helper");'+ ' if (_el && _el[0]) {_el[0].scrollBy(0, 500)}'+ '}, 200);' ); end; 2 Quote
robinhodemorais Posted November 13, 2019 Author Posted November 13, 2019 1 hour ago, Sherzod said: For example, can you try? procedure TMainForm.UniFormReady(Sender: TObject); begin UniSession.AddJS( 'Ext.defer(function() {'+ ' var _el='+ UniURLFrame1.JSName +'.iframe.contentDocument.getElementsByClassName("schedule-body--helper");'+ ' if (_el && _el[0]) {_el[0].scrollBy(0, 500)}'+ '}, 200);' ); end; It worked perfectly, thank you very much for your attention. 2 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.