PatV 1 Posted July 12, 2019 (edited) 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 July 12, 2019 by PatV correction Share this post Link to post
PatV 1 Posted July 12, 2019 btw ... Delphi 10.3 and omnithread 3.07.7 ;-) Share this post Link to post
Guest Posted July 12, 2019 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
PatV 1 Posted July 15, 2019 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