All pastes #18843 Raw Edit

Untitled

public text v1 · immutable
#18843 ·published 2005-07-30 09:25 UTC
rendered paste body
a form, memo, 3 buttons

button1 is save, button 2 is load, button 3 add lines to memo

type
 TForm1
 //.... other TForm1 declarations
 public
  x : integer;
 end;


procedure TForm1.OnCreate(blabla);
begin
 x := 0;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 if (not SaveDialog1.Execute()) then exit;
 memo1.Lines.SaveToFile(savedialog1.FileName); 
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
 memo1.Lines.Add(inttostr(x));
 inc(x);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 if (not opendialog1.Execute()) then exit;
 memo1.Lines.LoadFromFile(opendialog1.FileName);
end;