Jump to content


Photo

Destroy TuniFrame


  • Please log in to reply
3 replies to this topic

#1 herculanojs

herculanojs

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 458 posts
  • LocationCuiabá-Brasil

Posted 10 January 2018 - 05:28 PM

He experimented using TuniFrame to use some reports that have visual interaction screen with the user.
However, I have some difficulties when there is a failure to prepare the report.
 
In Tuniframe, there is a method that will prepare the report, and if so, preview the file and successively destroy the frame. This works perfectly
 
However, when the preparation method fails, the frame is not being destroyed.
If an attempt is made to run the report again, we received an error that the frame already exists.
 
 
How should we proceed in such a situation?
 
 
procedure TfrmFinanceiro_Associado.UniSpeedButton3Click(Sender: TObject);
var FrC : TUniFrameClass;
    Fr : TUniFrame;
begin
     if qrydados.IsEmpty then
        exit;
 
     FrC := TUniFrameClass(FindClass('TFrameEmissaoBoleto'));
     if frc <> nil then
     begin
          fr := TUniFrameClass(FindClass('TFrameEmissaoBoleto')).Create(self);
          if fr <> nil then
          begin
               datamodel.link.Util.PassaObject(fr,'SelectedFields',qryDados.Fields);
               if not datamodel.link.util.ExecutaMetodo(fr,'prepara') then
                  FreeAndNil(fr);         
          end;
     end;
end;

 


  • 0

#2 herculanojs

herculanojs

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 458 posts
  • LocationCuiabá-Brasil

Posted 10 January 2018 - 05:37 PM

Solution:
 
Try
   ....
finally
    Freeandnil (fr);
end;
 
tanks

  • 0

#3 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5011 posts

Posted 10 January 2018 - 05:52 PM

Hi,

 

Before creating, you need to check the existence of a frame by using Assigned


  • 0

#4 herculanojs

herculanojs

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 458 posts
  • LocationCuiabá-Brasil

Posted 10 January 2018 - 05:53 PM

ok


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users