Jump to content

Эффект сворачивания/разворачивания unimPanel


x11

Recommended Posts

У компоненты TunimPanel можно включить в заголовке кнопку сворачивания/разворачивания панели. Это свойства Collapsible и CollapseDirection.

Так вот, эффект сворачивания/разворачивания не очень приятный визуально, т.к. панель или заголовок мелькает через весь экран особенно, если панель находится внизу экрана. Т.е. как будто-то панель быстро падает сверху вниз или подпрыгивает вверх, что создает неприятное мелькание на экране.

Нельзя ли как-то упростить эффект, чтобы панель просто на месте сворачивалась/разворачивалась, чтобы панель никуда не улетала, не падала, и не подпрыгивала?

Спасибо.

Link to comment
Share on other sites

On 9/28/2020 at 12:03 PM, x11 said:

Нельзя ли как-то упростить эффект, чтобы панель просто на месте сворачивалась/разворачивалась, чтобы панель никуда не улетала, не падала, и не подпрыгивала?

procedure TMainmForm.UnimFormCreate(Sender: TObject);
begin
  with UnimPanel1 do
    if Collapsible then
      JSInterface.JSAddListener('painted', 'function(){this.getCollapsible().setAnimation(null)}');
end;

 

  • Like 1
Link to comment
Share on other sites

  • 4 months later...
On 9/29/2020 at 10:29 PM, Sherzod said:

procedure TMainmForm.UnimFormCreate(Sender: TObject);
begin
  with UnimPanel1 do
    if Collapsible then
      JSInterface.JSAddListener('painted', 'function(){this.getCollapsible().setAnimation(null)}');
end;

 

Sorry,No effects.

Link to comment
Share on other sites

  • 2 years later...

It works well, but not when i assign property collapsed = true in design. if i do this, it animate collapse on show of the form. 

Is there any solution for this ?

Link to comment
Share on other sites

Yes.

The solution works ok when panel at design time have property "collapsed" set to false.

But when you set collapsed = true, it starts animation of collapsing when you show the form.

Even without this solution unimpanel is doing it ^.

 

To test this you can just add unimpanel on form, and set collapsible=true and collapsed=true.

Link to comment
Share on other sites

19 hours ago, PS1 said:

The solution works ok when panel at design time have property "collapsed" set to false.

But when you set collapsed = true, it starts animation of collapsing when you show the form.

I couldn't reproduce, works for me.

Link to comment
Share on other sites

4 hours ago, PS1 said:

testCase_UnimPanel_collapse.zip 94.3 kB · 0 downloads

As a workaround for now, try this:

procedure TUnimForm2.UnimFormCreate(Sender: TObject);
begin
  with UnimPanel1 do
    if Collapsible then
      ClientEvents.UniEvents.Values['afterCreate'] := 'function afterCreate(sender){sender.getCollapsible().setAnimation(null)}';
end;

 

Link to comment
Share on other sites

ok, it works. But in a meantime i found a bug.

if you click on the ARROW on the panel's title it expands correctly, but if you click on panel's TITLE it expands like in image below.

You can test it on the previous testcase. 

image.png.1696cbe520d3dae9677378f85a3c8f59.png

Link to comment
Share on other sites

51 minutes ago, PS1 said:

if you click on the ARROW on the panel's title it expands correctly, but if you click on panel's TITLE it expands like in image below.

Ok, I have a workaround I will post now...

  • Like 1
Link to comment
Share on other sites

Try this solution for all UnimPanels, and for both cases:

1. 

unit MainModule;

2. 

uses ..., unimPanel;

3. OnNewComponent event ->

procedure TUniMainModule.UniGUIMainModuleNewComponent(AComponent: TComponent);
var
  PnlJSName: string;
begin
  if (AComponent is TUnimPanel) then
  begin
    PnlJSName := (AComponent as TUnimPanel).JSName;
    UniSession.JSCode(
     '  try {'+
          PnlJSName + '.setTitleCollapse(true);'+
          PnlJSName + '.getCollapsible().setAnimation(null);'+
     '  }'+
     '  catch(err){};'
     );
  end;
end;

 

  • Like 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...