I've converted the example delphi project below (and also typed it in by hand) however ater compiling it gives the above error and states it is "in file win32controls.pp at line 259." The idea of the program is to display a login in form before the main application form is created and displayed. The example is taken from the follow site:
http://delphi.about.com/od/windowsshellapi/a/password_login.htmIs there a way to do this in Lazarus?
program PasswordApp;
{$MODE Delphi}
uses
Forms, Interfaces, LCLType,
main in 'main.pas' {MainForm},
login in 'login.pas' {LoginForm};
{$R *.res}
begin
if TLoginForm.Execute then
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end
else
begin
Application.MessageBox('You are not authorized to use the application. The password is "delphi".', 'Password Protected Delphi application', MB_ICONQUESTION + MB_YESNO);
end;
end.
--------------------
unit login;
{$MODE Delphi}
interface
uses
LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TLoginForm = class(TForm)
LogInButton: TButton;
pwdLabel: TLabel;
passwordEdit: TEdit;
procedure LogInButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
public
class function Execute : boolean;
end;
implementation
{$R *.lfm}
procedure TLoginForm.LogInButtonClick(Sender: TObject);
begin
if passwordEdit.Text = 'delphi' then
ModalResult := mrOK
else
ModalResult := mrAbort;
end;
class function TLoginForm.Execute: boolean;
begin
with TLoginForm.Create(nil) do
try
Result := ShowModal = mrOk;
finally
Free;
end;
end;
procedure TLoginForm.FormCreate(Sender: TObject);
begin
passwordEdit.Text := '';
end;
end.
--------------
unit main;
{$MODE Delphi}
{
Display a LogIn Dialog Before the Main Form of an Application is Created
http://delphi.about.com/od/windowsshellapi/a/password_login.htm}
interface
uses
LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMainForm = class(TForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.lfm}
end.