Answer the question
In order to leave comments, you need to log in
How to create form close event from another Unit?
The bottom line is this: in Delphi (and don't ask why in Delphi) you need to create a form from another in one unit. This is done by connecting the appropriate Unit.
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, LView;
...
procedure TForm2.ButtonForwardClick(Sender: TObject);
begin
LView.name := 'l'+Form2.RadioGroup1.ItemIndex+'.rtf'; // LView - 3-й юнит
Form3.Create(self);
Form2.Enabled := false;
end;
Answer the question
In order to leave comments, you need to log in
1. Move the " uses
appropriate form" from interface to implementation. Such cyclic calls are allowed.
A good rule of thumb: anything - uses, const, var - is desirable to keep in the implementation, unless they are needed by the interface.
However, such a cyclic "lump of dirt" suggests that the architecture of the program is poorly thought out, and this is undesirable for large programs.
2. Explicitly incorrect code Form3.Create(self);
If you create a form, then it is correct Form3 := TForm3.Create(self);
. If someone created it, and you called the constructor again, why is this?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question