Move the ShowModal
from the initialization part of the frmAbb
to the end of the code, just before the finally
statement.
procedure TForm1.Button1Click(Sender: TObject);
var
frmAbb: TForm;
redAbbreviations: TRichEdit;
begin
//opens abbreviations
frmAbb := TForm.Create(nil);
try
redAbbreviations := TRichEdit.Create(frmAbb);
with frmAbb do
begin
Width := 400;
Height := 400;
Caption := 'Abbreviations';
Position := poOwnerFormCenter;
end;
with redAbbreviations do
begin
Parent := frmAbb;
Width := 300;
Height := 353;
redAbbreviations.Paragraph.TabCount := 2;
redAbbreviations.Paragraph.Tab[0] := 30;
redAbbreviations.Paragraph.Tab[1] := 60;
Lines.Add('DEV'+#9+'='+#9+'SWD Development');
Lines.Add('1660'+#9+'='+#9+'1660s');
Lines.Add('2.1'+#9+'='+#9+'2.1s');
Lines.Add('MIN'+#9+'='+#9+'Minis');
Lines.Add('SR'+#9+'='+#9+'Stockrods');
Lines.Add('PR'+#9+'='+#9+'Pinkrods');
Lines.Add('HR'+#9+'='+#9+'Hotrods');
Lines.Add('HM'+#9+'='+#9+'Heavy Metals');
Lines.Add('V8'+#9+'='+#9+'V8s');
Lines.Add('MA'+#9+'='+#9+'Midgets A');
Lines.Add('MB'+#9+'='+#9+'Midgets B');
Lines.Add('SP'+#9+'='+#9+'Sprints');
Lines.Add('CRO'+#9+'='+#9+'Crosskarts');
Lines.Add('LM'+#9+'='+#9+'Late Models');
Font.Size := 13;
end;
frmAbb.ShowModal;
finally
frmAbb.Free;
end;
end;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…