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

Frank Church vfclists at gmail.com
Sun Mar 13 15:50:16 CET 2011


On 13 March 2011 13:53, Frank Church <vfclists at gmail.com> wrote:

>
>
> 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
>>
>
>
>
>
More on the Application object

Will all the lines that come after Application.Run command execute only
after the Application is terminated? The ShowConnectedDatabases does not
execute if placed after the Application.Run command.

>From what you mentioned earlier is that what the event loop is about? ie
after Application.Initialize the forms can be created, then event loop
begins to process UI and other events?

Does that mean after the forms and data module objects are created, they
will not respond to GUI events until Application.Run is executed?

I suspect that non GUI events can still be processed, without the
Application.Run command such as webservers and other data module
activities??



> --
> Frank Church
>
> =======================
> http://devblog.brahmancreations.com
>



-- 
Frank Church

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


More information about the Lazarus mailing list