Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 20 total
Thread Animation TSizer effect
Fri, Apr 15 2016 6:02 PMPermanent Link

Trinione

Hi:
How can the effect of adjusting the Width of a panel be animated? I have a form with two panels and a TSizer in the middle.

At design-time BasicPanelRight := 300.

The following code has no effect when the TSizer is on the form.

with BasicPanelRight do
    begin
    BeginUpdate;
    try
       Animations.Width.Style:=asQuadEaseOut;
       Animations.Width.Duration:=500;
       Width:=500;
    finally
       EndUpdate;
    end;
end;
Sat, Apr 16 2016 3:52 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

What is the actual effect you are looking for? It "works" for me, but it depends what you are trying to achieve.

I did this :

BasicLeftPanel -
consumption : right
position : left
stretch : right

BasicRightPanel -
position : left

Sizer -
inside BasicPanelRight and positioned left
control : BasicPanelLeft

I put your code in a button click event and the width of BasicPanelRight increased with animation.

But I'm guessing that's not the effect you are looking for?
Sat, Apr 16 2016 10:32 AMPermanent Link

Trinione

Hi:
No. That didn't work.

I have attached a focused demo on this issue.



Attachments: Panel_Sizer.zip
Sat, Apr 16 2016 10:59 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Try this. Quick & dirty and might need refining :

procedure TForm1.Button1Click(Sender: TObject);
begin
  BasicPanelLeft.Animations.Width.Style:=asLinear;
  BasicPanelLeft.Animations.Width.Duration:=500;
  BasicPanelRight.Animations.Left.Style:=asLinear;
  BasicPanelRight.Animations.Left.Duration:=500;
  BasicPanelLeft.Width:=250;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  BasicPanelLeft.Animations.Width.Style:=asLinear;
  BasicPanelLeft.Animations.Width.Duration:=500;
  BasicPanelRight.Animations.Left.Style:=asLinear;
  BasicPanelRight.Animations.Left.Duration:=500;
  BasicPanelLeft.Width:=500;
end;
Sat, Apr 16 2016 11:08 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

To make it smoother -
change the right panel Layout.Stretch to Bottom only and set its width high (something like 500)

The container it's wrapped in will prevent the extra width being visible, and you won't get that odd effect on sizing right.

Try it, you'll see what I mean Smile
Sat, Apr 16 2016 12:06 PMPermanent Link

Trinione

squiffy wrote:
Try it, you'll see what I mean Smile

Squiffy:
Great! Thanks. Works perfectly except for the 'glitch' on animating right.

I have attached an updated demo file. Hopefully Tim or another user can resolve that remaining issue. Thanks again.



Attachments: Panel_Sizer.zip
Sat, Apr 16 2016 12:17 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

You missed out my last bit -

change the layout stretch value on the right panel from bottomright to just bottom, and increase the right panle width to 500. That glitch goes away.

Bit of a hack but it works .
Sat, Apr 16 2016 12:30 PMPermanent Link

Trinione

<< You missed out my last bit - change the layout stretch value on the right panel from bottomright to just bottom, and increase the right panle width to 500. That glitch goes away. Bit of a hack but it works . >>

I saw it and tested by setting it to ClientWidth, but doing so makes the panel too wide and the content would not be visible.
Sat, Apr 16 2016 12:33 PMPermanent Link

Trinione

Perhaps a better way to explain what I need to happen is to say Animate the Slider itself.

Animating the panel gives that impression, yes. But, before clicking any of the buttons in the second demo I attached , moving the Sizer keeps everything in place properly. This is the effect I want.

I wonder if the Sizer itself can be slid progmatically?
Sat, Apr 16 2016 12:42 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

I tried a few options for the slider, but none seemed to work.

Think Tim may have to pick this one up Smile
Page 1 of 2Next Page »
Jump to Page:  1 2
Image