What is wrong? (Lazarus)

General
Slava
2012-05-25
2013-05-14
  • Slava
    Slava
    2012-05-25

    This is my code (from http://andorra.sourceforge.net/index9b91.html?bb=lazarus1eng):

    unit Unit1; 
    {$mode DELPHI}
    interface
    uses
      Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, AdDraws,
      AdClasses, AdTypes;
    type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
      private
        { private declarations }
      public
        { public declarations }
        AdDraw:TAdDraw;
        procedure Idle(Sender:TObject;var Done:boolean);
      end; 
    var
      Form1: TForm1; 
    implementation
    {$R *.lfm}
     procedure TForm1.FormCreate(Sender: TObject);
    begin
      AdDraw := TAdDraw.Create(self);
      AdDraw.DllName := 'AndorraOGLLaz.dll';
      Application.OnIdle := Idle;
      AdDraw.Initialize;
    end;
    procedure TForm1.FormDestroy(Sender: TObject);
    begin
      AdDraw.Free;
    end;
    procedure TForm1.Idle(Sender: TObject; var Done:boolean);
    begin
      AdDraw.ClearSurface(0);
      AdDraw.BeginScene;
      with AdDraw.Canvas do
      begin
        Font := AdDraw.Fonts.GenerateFont('Arial', 24, []);
        TextOut(0,0,'Andorra 2D...');
        Font := AdDraw.Fonts.GenerateFont('Arial', 10, []);
        TextOut(0,30,'...works with Lazarus too');
      end;
      AdDraw.EndScene;
      AdDraw.Flip;
      Done := False;
    end;
    end.
    

    But Lazarus doesn't do anything. It compile the code but form window is empty.

     
  • Please check the following points:

    1. Is the initialization successfull?
    2. Does the Idle function get called, if yes, use the debugger and step through the code.