How do I correctly use OnAfterAnimation Event

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35555
    DarrenB
    Participant

    Hi,

    Using AC 8.14

    I have the standard two form project…SkinManager, SkinProvider form1, SkinProvider form2.

    In SkinManager I have set values for AnimEffects.FormShow and AnimEffects.FormHide both to true, and given both a nominal value of 100 (value was irrelevant, as was atAero or atFading). Both SkinProviders have AllowAnimation := True.

    On form1 I place a button captioned 'Hide this form and show form2' and in it's Click event, form1.hide

    On form2 I place a button captioned 'Hide this form and show form1' and in it's Click event, form2.hide

    In the OnAfterAnimation event of both SkinProviders

    procedure TForm1.sSkinProvider1AfterAnimation(AnimType: TacAnimEvent);

    begin

    if AnimType = aeHiding then

    form2.show;

    end;

    procedure TForm2.sSkinProvider1AfterAnimation(AnimType: TacAnimEvent);

    begin

    if AnimType=aeHiding then

    form1.Show;

    end;

    What I hope is possible…because I have enabled AnimEffects for both FormShow and FormHide, I am trying to create a system that 'calls' each form…a loop, if you like, where each hide event triggers the next show event of the corresponding forms once the animation is over…and I get the beautiful effect of the fade/show methods.

    I have never used the event before and am having difficulties.

    If I place a breakpoint in the AfterAnimation event of form1, then upon running the program form1 is 'shown' and the breakpoint achieved. I can see that the value of AnimType is aeShowing as expected.

    However, if I press the button on form1, which calls form1.hide the breakpoint is not 'achieved' again. It does not look as if the AfterAnimation event is called again…which I thought it should be because it is active for FormHide as well as FormShow. Because of this, the form2.show command in

    procedure TForm1.sSkinProvider1AfterAnimation(AnimType: TacAnimEvent);

    begin

    if AnimType = aeHiding then

    form2.show;

    end;

    is never executed! Form1 disappears but Form2 is not shown! More confusing to me is that my breakpoint is on

    if AnimType = aeHiding then

    and not form2.show …program execution never reaches it after the first check for the FormShow event.

    Am I misunderstanding the logic of the event? Is my implementation wrong? Is there perhaps a 'reset' animation code I need to apply after one event has been executed? Are the FormShow AnimEffects and FormHide AnimEffects mutually exclusive…because when enabled separately they work just fine.

    Thanks again…this is such a brilliant package keeps me learning all the time!!!

    #49985
    Support
    Keymaster

    Hi!

    You are right, OnAfterAnimation with aeHiding can't be reached now, I will fix it in the nearest release.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.