[Lazarus] More explorations with tiOPF

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Mar 15 09:57:29 CET 2011


Op 2011-03-14 19:14, Frank Church het geskryf:
>
> Issue 3:
>
> Is there a non GUI  example that stores the data to a SQL table, and can
> create it as well?

If you only use the "core" units (and some units from Options directory) 
located in tiOPF.lpk, then they are all non-GUI. As for the demos, I 
think they are all "gui" demos simply to make it more visually pleasing 
to the end-user/developer.

The whole framework is unit tested, so you could look at that code too, 
if you want more examples of using the framework. The testing framework 
is non-gui too.


> In Demo_OneToMany I tried to test SQLite by changing these two lines:
>
> Demo_OneToMany.dpr (After Application.Initialize)
>
>    //gTIOPFManager.DefaultPersistenceLayerName := cTIPersistXMLLight;
>    gTIOPFManager.DefaultPersistenceLayerName := cTIPersistSqldbSQLLite3;

That should be all that is required, but it seems the CSV persistence 
layer is still taking priority in our code, for some reason. Maybe place 
'x' characters behind all the persistence layers you don't want - thus 
only include SQLDB_SQLLite. That's in tiOPF.lpk | Compiler Options | 
Other dialog. See what happens then.

I must add, the SqlDB persistence layer was written by Michael to 
support all backends that SqlDB (in FPC) supports, but when I tested 
Postgres via SQLDB I found lots of issues. The tiOPF's SqlDB persistence 
layer seems to need quite a bit more refactoring to work correctly with 
all SqlDB backends. The only one really tested at the moment is 
SqlDB+Firebird, as that is what I (and I believe Michael and others too) 
uses in our commercial apps.

If I can setup a SqlLite server or something, then I can start testing 
that persistence layer under tiOPF too. I'll see what I can manage.


> In the Compiler options of tioXXX I ensured that -dLINK_SQLDB_SQLLite3
> is present. Is some kind of tiQuerySQLLite required that is not yet
> implemented? I can't see a reference to SQLite in the tiOPF uses list.

The only reference to the various persistence layers should be in the 
uses clause in the implementation section of tiOPFManager.pas unit. The 
rest are all controlled by the -dLINK_xxx compiler defines.

I know nothing about SQLLite.... Is it free to use? ie, can I download 
something like a client library or server (that's if everything isn't 
included with FPC itself), and include it in my hourly build sever runs? 
  I already test 5 persistence layers like that using FPC 32bit and 
64bit... I should really include SqlLite, MySQL and Postgres in those 
runs too - at least I know the latter two are free, plus we have a spare 
linux server here, that is not doing much at the moment.


> When I try to compile tiOPFGUI it halts with this error:
>
> C:\lazarus28240\components\tiOPF2\Source\GUI\tiPerAwareCtrls.pas(157,28)
> Error: No property found to override
>
> The property in question is TtiPerAwareAbs.ParentCtl3d in unit
> tiPerAwareCtrls;

It's probably a small thing to fix (add yet another IFDEF), but I gave 
up trying to maintain the LCL & VCL custom components of tiOPF. LCL is 
just too different, causing lots of code obfuscation due to IFDEF's, or 
the Lazarus IDE Forms Designer was too buggy to justify my time. That's 
why I implemented and started using Model-GUI-Mediator (MGM) instead.

I highly recommend you use MGM for any tiOPF GUI work. It's very 
versatile, it is unit tested (mostly), and is used by a few developers 
in commercial environments, so proves to work well.


>  From what I understand from the docs the custom controls that come with
> it will not work in the IDE, but shouldn't they be able to work if they
> are createed at runtime?

That will eliminate some of the Lazarus problems yes, but you still have 
the very obfuscated GUI code to work through if anything goes wrong. 
More and more IFDEF's seem to be required to get the two (LCL and VCL) 
to work. Lazarus LCL was designed to convert Delphi code to Lazarus, not 
to have shared-code components.

LCL is not alone, I had the exact same problem with Kylix's CLX and 
Delphi's VCL in the tiOPF GUI components.


> I want to get acquainted with the non GUI aspects, such as creating
> objects and saving them, then turn to Model-Gui-Mediators later on,

OK, creating some non-gui demos will be easy to do... plus the code 
should work as-is with both FPC and Delphi. I'll see what I can put 
together. I wouldn't discard the "gui" demos though, the code inside 
OnClick even handlers should be the same for gui or non-gui apps.


For any further tiOPF specific help, can you please move your 
discussions to the dedicated tiOPF support channels. This will then 
benefit other future tiOPF users too. There is a tiOPF NNTP news server 
(see the website for details), or the tiOPF mailing list (see the 
SourceForge project page for details).


Regards,
   - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/





More information about the Lazarus mailing list