picyka Posted March 31, 2023 Share Posted March 31, 2023 Is there a way to know if a given form is open? if UniMainModule.GetFormInstance(TUniFormVisualizarTarefa, false) then I tried this rule but it didn't work. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 1, 2023 Share Posted April 1, 2023 Hi, 5 hours ago, picyka said: if UniMainModule.GetFormInstance(TUniFormVisualizarTarefa, false) then This should work. Where and how do you call this method? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 1, 2023 Share Posted April 1, 2023 This may also be the reason: Quote Link to comment Share on other sites More sharing options...
Tokay Posted April 1, 2023 Share Posted April 1, 2023 13 hours ago, picyka said: Is there a way to know if a given form is open? if UniMainModule.GetFormInstance(TUniFormVisualizarTarefa, false) then I tried this rule but it didn't work. I think it could possible do additional check: Form := UniMainModule.GetFormInstance(TUniFormVisualizarTarefa, False); if (not Assigned(Form)) and (not Form.Visible) then ..... form closed Quote Link to comment Share on other sites More sharing options...
picyka Posted April 1, 2023 Author Share Posted April 1, 2023 procedure TMainForm.UniTimerTarefasTimer(Sender: TObject); begin UniTimerTarefas.Enabled := False; if UniMainModule.GetFormInstance(TUniFormVisualizarTarefa, False) = nil then Self.LoadTarefas(False); end; This validation is done within the timer, the FreeOnClose is already set to false. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 1, 2023 Share Posted April 1, 2023 31 minutes ago, Tokay said: I think it could possible do additional check I guess he knows it... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 1, 2023 Share Posted April 1, 2023 4 minutes ago, picyka said: the FreeOnClose is already set to false. Need to set to True... Quote Link to comment Share on other sites More sharing options...
picyka Posted April 1, 2023 Author Share Posted April 1, 2023 with TUniFormVisualizarTarefa.Create(UniApplication) do begin try ShowForm(lTarefa,lTarefaController); finally Free; end; end; Quote Link to comment Share on other sites More sharing options...
picyka Posted April 1, 2023 Author Share Posted April 1, 2023 4 minutes ago, Sherzod said: Need to set to True... Doesn't work either, well I'll keep using my workaround. 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.