Jump to content

Recommended Posts

Posted

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

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

Posted
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

 

img1.png

img2.jpg

Posted
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?!

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

 

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

 

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

  • Like 2

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