On 12.03.2011 16:01, Frank Church wrote:
Here is the pared down Lazarus equivalent
program Demo_LoadPersistenceLayerIfDef_Laz;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, //frmMain,
This does not include frmMain, but the common form ancestor TForm and
also the global Application variable and its TApplication type.
LResources,
This is needed for the inclusion of LRS files. This is not needed if RES
files are used (don't know whether your version of Lazarus supports that
already).
{ you can add units after this }
DemoDBUtils in '..\Common\DemoDBUtils.pas';
{$IFDEF WINDOWS}{$R Demo_LoadPersistenceLayerIfDef_Laz.rc}{$ENDIF}
begin
{$I Demo_LoadPersistenceLayerIfDef_Laz.lrs}
Application.Initialize;
//Application.CreateForm(TForm1, Form1);
//Application.Run;
DemoDBUtils.ShowConnectedDatabases;
end.
I want to know if in order to display the dialog the project could be
pared down further.
Is there some way to get the dialog to show if the project did not use
TApplication?
You need to initialize and maybe also run the Application so that the
main loop is executed and thus events are passed to the dialog.
Note: when you put DemoDBUtils.ShowConnectedDatabases below
Application.Run the call won't be executed until the application is
terminated, because the main event processing loop is running in there.
Are the .rc files and .lrs files also required?
If you don't need an application icon, version info or a manifest (on
Windows XP and newer) then you don't need these resources.
The following is the main project source if you create a new application
in Lazarus 0.9.31 (please note, that Lazarus does not use LRS resources
by default anymore).
==== source begin ====
program Project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
==== source end ====
I personally would suggest you to put a startup dialog into the
applications OnShow or OnActivate event, because this is guarantied to
be cross platform, while showing a dialog without the main loop might
only work on Windows.
Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus