Jump to content
PatV

mutliple forms with thread in each

Recommended Posts

Hi All

 

Delphi 10.3  / OmniThread 3.07.7

 

I'm playing with forms and threads and I'm a little lost...

 

From a main form  (FormMaster) , I have a button, when I click on it , it create another form (FormGrid)

 

in FormGrid (1), I create a class (TFOmniDb) and create everything within the Thread (as the two fish sample)  and update a grid on (1).

 

now, If I create another FormGrid (2),  and launch  also the thread, then eveything on (1) stop instead of running in background)

 

Could yoy help me to find the way of doing it ?

 

Regards

 

Patrick

 

TFOmniDb = class
  private
    FId         : string;
    FDo         : TpDo;
    FDm         : TDM;
    FWorker     : IOmniBackgroundWorker;
    FRConfig    : RConnectionConfig;
    FPrcDone    : TOmniWorkItemDoneDelegate;
    FPrcToDo    : TPrcLoadData;

    FOnConnectionOpen : TNotify;

    procedure InitializeDatabase(var taskState: TOmniValue);
    procedure FinalizeDatabase(const taskState: TOmniValue);
    procedure ConnectToDatabase(const workItem: IOmniWorkItem);

    procedure FirstStage(dataModule : TDM);

    procedure LoadData(const workItem : IOmniworkItem);
    Procedure WorkOnData(const Sender: IOmniBackgroundWorker; const workItem: IOmniWorkItem);
  public

  ...
  end;

 

{------------------------------------------------------------------------------}

procedure TFOmniDb.AfterConstruction;
begin
  inherited;
  then  FWorker := Parallel.BackgroundWorker
              .Initialize(InitializeDatabase)
              .Finalize(FinalizeDatabase)
              .Execute:
 

 

Edited by PatV
correction

Share this post


Link to post
Guest

BTW

 

You can edit your post up to 24 hours after creating. If you have forgotten something you do not have to add another post.

 

We have an excellent syntax highlighting for posted code but you have to help the system and surround the code with the code tags.

procedure bla;
begin
  blup();
end;

Do you think you can improve your post?

Share this post


Link to post

At the end, it has nothing to do with omnithread, I have the same result with the thread class itself.

 

I'll move my question (and provide sample)  to General Help

 

Patrick

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×