[Lazarus] Fwd: Help clarify use of TApplication with tiOPF example.

Frank Church vfclists at gmail.com
Sun Mar 13 14:53:46 CET 2011


On 13 March 2011 08:43, Sven Barth <pascaldragon at googlemail.com> wrote:

> Am 13.03.2011 00:22, schrieb Frank Church:
>
>  I am using 0.9.28,3 with FPC 2,4,0 on Window.
>>
>> I further reduced it to this
>>
>>    program Demo_LoadPersistenceLayerIfDef_Laz;
>>
>>    {$mode objfpc}{$H+}
>>
>>    uses
>>       {$IFDEF UNIX}{$IFDEF UseCThreads}
>>       cthreads,
>>       {$ENDIF}{$ENDIF}
>>       Interfaces, // this includes the LCL widgetset
>>       Forms, //frmMain,
>>       //LResources,
>>
>>       DemoDBUtils in '..\Common\DemoDBUtils.pas';
>>
>>    {$IFDEF WINDOWS}{$R Demo_LoadPersistenceLayerIfDef_Laz.rc}{$ENDIF}
>>
>
> You can disable this one, too.
>
>
>
>>    begin
>>       //{$I Demo_LoadPersistenceLayerIfDef_Laz.lrs}
>>       Application.Initialize;
>>       //Application.CreateForm(TForm1, Form1);
>>       //Application.Run;
>>       ShowConnectedDatabases;
>>    end.
>>
>>
>> Thanks for your response.
>>
>> And it looks like Application requires Interfaces and Forms, and from
>> what you describe the ShowConnectedDatabases is probably only working at
>> the end of the program's execution.
>>
>
> As you've disabled the "Application.Run" call it will work immediatly (if
> at all), because the potentially endless main loop is not started.
>
>
>  Is it possible that a GUI app will
>> work without TApplication on Windows, or at the least one that requires
>> only the dialog?
>>
>
> You can try to disable the "Application.Initialize" call as well to see
> what happens, but I can't tell what the Win32 LCL needs to show a simple
> dialog...
>
> Note: If you can successfully remove this call, you can remove the usage of
> unit "Forms" as well. The unit "Interfaces" must be kept though and if you
> don't need threads (on non-Windows) you can remove the part containing
> "cthreads" as well.
>
>
Application.Initialize is necessary in this case. The dialog does not come
up unless it is executed.

I will try it in 0.9.31 and FPC 2.5.1 on both Windows and Win32 to find out.




> Regards,
> Sven
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110313/bcf87834/attachment-0003.html>


More information about the Lazarus mailing list