Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Animation move issue
Tue, Feb 18 2014 5:22 AMPermanent Link

Matthew Jones

Am I right in thinking that the asMove animation won't work in all directions? I'd
like a panel to "fly down" from the top, like the Apple installer confirmation does.
So I set the panel to above the form, which is negative, and ask for an animation,
and then animate it, but it never moves. If I set it below, then it moves up just
fine.

I think that what is happening is that the line:
  if (FEndTop <> NO_CHANGE) and (FNewTop > FEndTop) then
is not taking into consideration the direction, but I'm perhaps not sure if I'm
even doing it right.

procedure TfrmAccount.ShowEditor;
begin
   pnlEdit.Top := - pnlEdit.Height; // NEGATIVE HERE
   pnlEdit.Left := (ClientWidth - pnlEdit.Width) div 2;

   pnlEdit.Visible := true;
   pnlEdit.Animate(asMove, 20, 4, true, false, false, false,
       20, NO_CHANGE, NO_CHANGE, NO_CHANGE);
end;

If I remove the negative on the first line, it moves up just fine. If I try setting
the Amount (step in the framework code) to -4, it still doesn't appear.

I'd welcome input.

/Matthew Jones/
Tue, Feb 18 2014 6:53 AMPermanent Link

Matthew Jones

Further experiments show that Animation is odd!

I can get it to slide in from the right, but trying to slide it back out again is
interesting. Either it just doesn't move, or it slides off and never stops. I was
able to get it so it whizzes past the visible area. The code as below runs and the
hide mode has it incrementing away and currently at .Left of over 310000 (my screen
isn't that big! 8-).

procedure TfrmAccount.ShowEditor(bShow : Boolean);
var
   nTarget : Integer;
begin
   if bShow then
   begin                                        
       lnkPurchase.Caption := 'Show';
       nTarget := (ClientWidth - pnlEdit.Width) div 2;
pnlEdit.Animate(asMove, 10, 20, false, true, false, false, NO_CHANGE,
nTarget, NO_CHANGE, NO_CHANGE);
   end
   else
   begin
       lnkPurchase.Caption := 'Hide';
//        nTarget := {ClientWidth +} 200;
       nTarget := - pnlEdit.Width - 2;
pnlEdit.Animate(asMove, 10, -20, false, true, false, false, NO_CHANGE,
nTarget, NO_CHANGE, NO_CHANGE);
   end;
end;

procedure TfrmAccount.Timer1Timer(Sender: TObject);
begin
   lblPosition.Caption := IntToStr(pnlEdit.Left);
end;


/Matthew Jones/
Tue, Feb 18 2014 11:41 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Am I right in thinking that the asMove animation won't work in all
directions? >>

Correct.  Moving only affects the Top/Left coordinates.

<< I think that what is happening is that the line:
  if (FEndTop <> NO_CHANGE) and (FNewTop > FEndTop) then
is not taking into consideration the direction, but I'm perhaps not sure if
I'm even doing it right. >>

Yep, that's the issue.  I'll make sure that it's fixed.

Tim Young
Elevate Software
www.elevatesoft.com
Image