samedi 8 juillet 2017

select more than one checkbox to execute condition

I want a text file to show contents in memo1 once I have selected 2 checkboxes. How would I do this?

I tried the code below but I can't seem to get it right.

if CheckBox1.Checked and CheckBox2.Checked then
begin
memo1.lines.LoadFromFile('files\RS.txt');
end;

I also want to be able to select the checkboxes individually Like: (pointing this out in case combining them prevents checking them individually)

Checkbox1:

procedure TForm1.CheckBox1Change(Sender: TObject);
begin
   memo1.lines.LoadFromFile('files\R.txt');
end;

Checkbox2:

procedure TForm1.CheckBox2Change(Sender: TObject);
begin
   memo1.lines.LoadFromFile('files\S.txt');
end;

Any suggestions/Improvements will be appreciated.

Running Lazarus IDE v1.6.4

Windows 10 x64




Aucun commentaire:

Enregistrer un commentaire