Re: File I/O problems?
Posted by webmaster Guido on June 26, 2003 at 15:16:04:
In Reply to: File I/O problems? posted by El+p12333 on June 25, 2003 at 03:15:48:
: [for entire code: see previous message]
: procedure TFormRangeSelectorTest.NFETRangeClick(Sender: TObject);
I assume that your problem is as follows: something is written to file if the groupbox itself is clicked (a click on an open spot in the groupbox), but not when a checkbox is clicked.
Solution: write an onclick event handler for the checkboxes, not for the groupboxes.
So the first thing to do: create an onclick event handler for a checkbox, say for CheckBoxTypicalN, and copy the code from procedure TFormRangeSelectorTest.NFETRangeClick to it:
procedure TFormRangeSelectorTest.CheckBoxTypicalNClick(Sender: TObject); var NFile:TextFile; begin AssignFile(NFile,'C:\Proj\Delphi\delphi6\RangeSelTest\Run0.cir'); // and so on... end;
Next, assign that same event handler to all the checkboxes of the same group. Do this
Next, expand the code in CheckBoxTypicalNClick with some "if" instructions, so that a different thing is written for each checkbox that was clicked:
if CheckBoxTypicalN.Checked then begin ...code for CheckBoxTypicalN end else if CheckBoxFastN.Checked then begin ...code for CheckBoxTypicalN end else if... and so on...
Finally, delete the OnClick handlers of the groupboxes.
[ DelphiLand: free Delphi source code, tips, tutorials ]