Jump to content

Recommended Posts

Posted

Hi

 

I'm using a TUnimPanel included in a TUnimScrollBox.

When I scroll down, it automatically scrolls up !!!

 

Did someone can explain me what's wrong ?
Was it a configuration problem ?

 

Thanks

 

Fred

Posted
For developers who want and can help me, you can find a simply test case that show my problem following the link http://www.atout-logiciel.com/TestCase_UniMScrollPb.zip
 
Hi,
 
For now can you try this? (quick and dirty workaround):
 
1.
  public
    { Public declarations }
    scrlHeight: integer;  // <-------
    procedure _setHeight(AScrollBox: TUnimScrollBox; AHeight: Integer);
  end;

2.

...
  if scrlHeight < scrlPanier.Height then
    begin
        pnlDetailCommande.Height := scrlPanier.Height - 10;
    end
    else
    begin
        //scrlPanier.SetBounds(0, 0, scrlPanier.Width, scrlHeight);
        scrlPanier.Height := scrlHeight;
        pnlDetailCommande.Height := scrlHeight;
    end;

  _setHeight(scrlPanier, scrlHeight); // <-------
...

3.

procedure TMainmForm._setHeight(AScrollBox: TUnimScrollBox; AHeight: Integer);
begin
  UniSession.AddJS('setTimeout(function(){' + AScrollBox.JSName
                   + '.scrollableBehavior.scrollView.getScroller().maxPosition.y = '
                   + IntToStr(AHeight)
                   + '}, 500)'
  );
end;

4.

procedure TMainmForm.UnimFormResize(Sender: TObject);
begin
  _setHeight(scrlPanier, scrlHeight);
end;
Best regards.
Posted

As we said at home, champion !!!

It works fine.

 

An other question, I'm using a TunimTabPanel and I want to change active page swiping left and right. Did have I to do something like you have done ?

 

An other question bis ... Where can I find any help topic about JS programming in uni gui ?

 

Thanks a lot !!!

Posted

An other question, I'm using a TunimTabPanel and I want to change active page swiping left and right. Did have I to do something like you have done ?

 

Hi,

 

For now try:

 

1. UnimTabPanel1->ClientEvents->UniEvents->... afterCreate fn:

function afterCreate(sender)
{
    sender.element.on("swipe",
        function(e) {
            if (e.direction) {
                ajaxRequest(MainmForm.form, "swipe", ["direction="+e.direction]);
            }
        }
    )
}

2. MainmForm->onAjaxEvent:

procedure TMainmForm.UnimFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'swipe' then
  begin
    if Params.Values['direction'] = 'left' then
    begin
      if UnimTabPanel1.ActivePageIndex > 0 then
        UnimTabPanel1.ActivePageIndex := UnimTabPanel1.ActivePageIndex - 1
    end
    else if Params.Values['direction'] = 'right' then
      UnimTabPanel1.ActivePageIndex := UnimTabPanel1.ActivePageIndex + 1
  end;
end;

Best regards.

Posted

Hi

 

Code tried and validated !

 

One more time, it works fine !!!

 

I would like to do another developments like this. Is there any help topic about JS programming in uni gui ?

  • 1 year later...
Posted

 

 
Hi,
 
For now can you try this? (quick and dirty workaround):
 
1.
  public
    { Public declarations }
    scrlHeight: integer;  // <-------
    procedure _setHeight(AScrollBox: TUnimScrollBox; AHeight: Integer);
  end;

2.

...
  if scrlHeight < scrlPanier.Height then
    begin
        pnlDetailCommande.Height := scrlPanier.Height - 10;
    end
    else
    begin
        //scrlPanier.SetBounds(0, 0, scrlPanier.Width, scrlHeight);
        scrlPanier.Height := scrlHeight;
        pnlDetailCommande.Height := scrlHeight;
    end;

  _setHeight(scrlPanier, scrlHeight); // <-------
...

3.

procedure TMainmForm._setHeight(AScrollBox: TUnimScrollBox; AHeight: Integer);
begin
  UniSession.AddJS('setTimeout(function(){' + AScrollBox.JSName
                   + '.scrollableBehavior.scrollView.getScroller().maxPosition.y = '
                   + IntToStr(AHeight)
                   + '}, 500)'
  );
end;

4.

procedure TMainmForm.UnimFormResize(Sender: TObject);
begin
  _setHeight(scrlPanier, scrlHeight);
end;
Best regards.

 

Is there another solution? This leaves a space of exesivo height and is very little controllable.

Posted

Hi,

 

hello

 

Is there another solution?

 This leaves a space of exesivo height and is very little controllable.

 

Which edition and build are you using ?!

 

Can you give more information, screenshots, make a testcase?!

 

Best regards,

Posted

Hi,

 

 

Which edition and build are you using ?!

 

Can you give more information, screenshots, make a testcase?!

 

Best regards,

 

 

hello,  my firend

 

I'm using version 1.0.0.1383.
I have the same problem as Newbie. You can take the same project.
look . When you solved it. Leaves an unusable height.
 
At the bottom of the page there is an ana height of 400px not used
 
I can adjust the height. But from server side to client. I would like this to be done automatically.
 
thanks !

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