Inno Setup - Animate a control roll out from right in a determinate page

元气小坏坏 提交于 2019-12-10 00:18:21

问题


I am trying to use this code (with InnoCallback DLL library):

[Code]

var
  MainPanelAnimated: Boolean;
  AnimationTimer: LongWord;

procedure AnimationTimerProc(
  H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
var
  L: Integer;
begin
  L := WizardForm.MainPanel.Left + ScaleX(5);
  if L > 0 then
  begin
    L := 0;
    KillTimer(0, AnimationTimer);
  end;
  WizardForm.MainPanel.Left := L;
end;

procedure CurPageChanged(CurPageID: Integer);
var
  HoverTimerCallback: LongWord;
begin
  if WizardForm.OuterNotebook.ActivePage = WizardForm.InnerPage then
  begin
    if not MainPanelAnimated then
    begin
      HoverTimerCallback := WrapTimerProc(@AnimationTimerProc, 4);
      AnimationTimer := SetTimer(0, 0, 5, HoverTimerCallback);
      WizardForm.MainPanel.Left := -WizardForm.MainPanel.Width;
      MainPanelAnimated := True;
    end;
  end;
end;

from How to animate a control roll out in Inno Setup (answer of Martin Prikryl), to show the same effect but from right to left and in a determinate page of setup. How to do this?


回答1:


Use CurPageID in CurPageChanged to select on what page to show the animation.

[Code]

function SetTimer(hWnd: longword; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord):
  LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord;
  external 'KillTimer@User32.dll stdcall';

var
  AnimationTimer: LongWord;

procedure AnimationTimerProc(
  H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
var
  L: Integer;
begin
  L := WizardForm.MainPanel.Left - ScaleX(5);
  if L < 0 then
  begin
    L := 0;
    KillTimer(0, AnimationTimer);
  end;
  WizardForm.MainPanel.Left := L;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpReady then
  begin
    AnimationTimer := SetTimer(0, 0, 5, CreateCallback(@AnimationTimerProc));
    WizardForm.MainPanel.Left := WizardForm.MainPanel.Width;
  end;
end;

For CreateCallback function, you need Inno Setup 6. If you are stuck with Inno Setup 5, you can use WrapCallback function from InnoTools InnoCallback library.



来源:https://stackoverflow.com/questions/48027572/inno-setup-animate-a-control-roll-out-from-right-in-a-determinate-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!