Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9059897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:05:10+00:00 2026-06-16T15:05:10+00:00

Using: Delphi XE2, DBExpress, Firebird I can’t access any VCL control outside the main

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:05:11+00:00Added an answer on June 16, 2026 at 3:05 pm

    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 TDataModule and 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:

    enter image description here

    unit TestAnimatedScreen;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Imaging.GIFImg,
      Vcl.ExtCtrls;
    
    type
      TMyEndNotify = procedure (value: Boolean) of object;
    
    type
      TMyThread = class(TThread)
      private
        fEndNotification : TMyEndNotify;
        procedure NotifyEndOfThread;
      protected
        procedure Execute; override;
      public
        Constructor Create(endNotification : TMyEndNotify);
      end;
    
    type
      TMainForm = class(TForm)
        Image1: TImage;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
        FShowAnimation : Boolean;
        procedure SetShowAnimation(value : Boolean);
      public
        { Public declarations }
        property ShowAnimation : Boolean read FShowAnimation write SetShowAnimation;
      end;
    
    var
      MainForm: TMainForm;
    
    implementation
    
    {$R *.dfm}
    
    procedure TMyThread.NotifyEndOfThread;
    begin
      if Assigned(fEndNotification) then
        fEndNotification(False);
    end;
    
    constructor TMyThread.Create(endNotification: TMyEndNotify);
    begin
      Inherited Create(false);
      fEndNotification := endNotification;
      Self.FreeOnTerminate := True; // Free automatically
    end;
    
    procedure TMyThread.Execute;
    begin
      try
        {Add your database access code here}
        Sleep(5000); // Simulate lengthy process
      finally
        Synchronize(NotifyEndOfThread);
      end;
    end;
    
    { TMainForm }
    
    procedure TMainForm.Button1Click(Sender: TObject);
    begin
      ShowAnimation := True;
      TMyThread.Create(Self.SetShowAnimation);
    end;
    
    procedure TMainForm.SetShowAnimation(value: Boolean);
    begin
      FShowAnimation := Value;
      if FShowAnimation then
      begin
        {Add animation code here}
        Button1.Enabled := false;
        Button1.Caption := 'Processing, please wait ...';
        (Image1.Picture.Graphic as TGIFImage).AnimateLoop := glEnabled;
        (Image1.Picture.Graphic as TGIFImage).Animate := true;
      end
      else
      begin
        {Stop animation}
        (Image1.Picture.Graphic as TGIFImage).Animate := false;
        Button1.Caption := 'Start lengthy process';
        Button1.Enabled := True;
      end;
    end;
    
    end.
    

    object MainForm: TMainForm
      Left = 0
      Top = 0
      Caption = 'MainForm'
      ClientHeight = 265
      ClientWidth = 236
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      PixelsPerInch = 96
      TextHeight = 13
      object Image1: TImage
        Left = 8
        Top = 8
        Width = 200
        Height = 200
        AutoSize = True
        IncrementalDisplay = True
      end
      object Button1: TButton
        Left = 8
        Top = 224
        Width = 200
        Height = 25
        Caption = 'Start lengthy process'
        TabOrder = 0
        OnClick = Button1Click
      end
    end
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an database application with Delphi XE2 using an Access DB, now
I'm working with Embarcadero Delphi XE2 and Firebird DB, using TIBDatabase , TIBTransaction and
I am using Delphi XE2 to write a VCL win32 application. Delphi XE2 support
I am using Orpheus control v4.08 along with Delphi XE2 and I am facing
I am using Delphi XE2 with Indy 10 to access the Ubuntu One API.
Using Delphi XE2 on Win 7 64 bit creating a 32 bit app... In
I am using Delphi XE2 and attempting to upgrade our usb comms dll to
I'm currently using delphi xe2. well the firemonkey part of it. I use to
I am using Delphi XE2 to communicate with a fairly large SOAP service. I've
I'm using Delphi XE2 with FireMonkey. I have read many other questions about MD5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.