Using: Delphi XE2, DBExpress, Firebird
I can’t access any VCL control outside the main thread safely, that includes forms, panels, edits, etc and the Timage and Timage descendants. I’m need to open ClientDataSet (Master/Detail) in separate Thread(different of main thread).
I’m need to create animated splash screen while accessing database
Can someone show me a simple example of how to do this?
I’m assuming that the database access in a thread is of no problem for you.For a complete example of a threaded access to a dbExpress database (including feedback to the main thread), see the examples made by Marco Cantù here: dbexpress_firebird_examples.
It involves putting all the database connection setup in a
TDataModuleand creating an instance of this datamodule for each threaded access.Anyway,
to make the GUI informed about the background thread process with an animated Gif, here is an example:
Should you have an older Delphi version than Delphi 2007, see How to use Animated Gif in a delphi form for more information about how to implement an animated GIF.
The animated GIF I used can be found here.