eduardosuruagy Posted December 28, 2019 Share Posted December 28, 2019 I would like to execute a query in my background bank, when the user confirms his login the system executes this query to show statistics to the user, and this query can take a long time leaving my application frozen, it can be done without my screen freezing ? Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted December 28, 2019 Share Posted December 28, 2019 Before query you can call showmask and syncronize and end of the query you can call hide mask Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted December 28, 2019 Author Share Posted December 28, 2019 32 minutes ago, Hayri ASLAN said: Antes da consulta, você pode chamar showmask e sincronizar. No final da consulta, você pode chamar hide mask I did so, put a UniTimer in my MainForm, when I enter my MainForm I activate my UniTimer in the MainForm.UniFormActivate event. Inside UniTimer I make my select and update some information on the screen. But I realize that my screen freezes for a while even the SQL command inside UniTimer. This way I made this correct? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 28, 2019 Share Posted December 28, 2019 20 minutes ago, eduardosuruagy said: Inside UniTimer I make my select and update some information on the screen. But I realize that my screen freezes for a while even the SQL command inside UniTimer. This way I made this correct? Please see this demo: \FMSoft\Framework\uniGUI\Demos\Desktop\ThreadTimer-2 Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted December 29, 2019 Author Share Posted December 29, 2019 On 28/12/2019 at 12:42, Sherzod said: Por favor, veja esta demonstração: Using the example you indicated I made a change, I put UniThreadTimer1 in MainForm, but it crashes when trying to access some information from UniMainModule. How can I access a variable that is in UniMainModule? procedure TMainForm.UniThreadTimer1Timer(Sender: TObject); var FS : TUniGUISession; B : TBookmark; begin if Assigned(UniMainModule.UniApplication) then begin FS := (UniMainModule.UniApplication as TUniGUIApplication).UniSession; // This is the uniSession instance which is the owner of this UniMainModule FS.LockSession; // make sure session is not busy try B := UniMainModule.ClientDataSet1.GetBookmark; try UniMainModule.ClientDataSet1.Append; UniMainModule.ClientDataSet1.FieldByName('F1').AsInteger := UniMainModule.ClientDataSet1.RecordCount; UniMainModule.ClientDataSet1.FieldByName('F2').AsString := TimeToStr(Now); UniMainModule.ClientDataSet1.Post; UniMainModule.ClientDataSet1.GotoBookmark(B); finally UniMainModule.ClientDataSet1.FreeBookmark(B); end; finally FS.ReleaseSession; end; end; end; Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted January 2, 2020 Share Posted January 2, 2020 Can I pass a reference to a UniSession into a Thread so I can update forms and stuff from inside the thread ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.