How to disable a TTimer object when you click a button that opens another form and enable it again when the other form is closed?

2

Good morning. I have a timer running on a form that calls several others. When this form opens another the timer should be stopped and when the form that was opened is closed the timer must be enabled again. However, I can only do this in just one form. Is there any way to do this? Call the onclose of the forms closed directly in the form that opens the others? I'm using Delphi 4.

I thought of putting it this way, but I do not know where to put this code so that it runs at all times.

if Assigned(TForm1) then
  //Criado
else
  //Não criado

Would another TTimer object be needed?

    
asked by anonymous 20.11.2018 / 13:34

1 answer

2

The timer has the property Enabled , only mark as false and then return to true

and in the main form you invoke the second with showmodal , doing so the form back is held until the front close. can do this:

timer.enabled: false;

Form2:= TForm2.Create;
Form2.Showmodal;
freeanil(fomr2);

timer.enabled := true;
    
20.11.2018 / 13:57