Hello,
I am trying to convert a simple method to a procedure with parameters, I need help with the calling statement as it is giving errors when i try to compile.
Code below:
unit Ass13;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Samples.Spin,
Vcl.Buttons;
type
TfrmFee = class(TForm)
btnLoss: TButton;
sedCycle: TSpinEdit;
sedRun: TSpinEdit;
gpbLossResults: TGroupBox;
lblFee: TLabel;
Label1: TLabel;
Label2: TLabel;
BitBtn1: TBitBtn;
procedure btnLossClick(Sender: TObject);
private
procedure GramsOff(HourRun, HourCycle : Integer; var GramOff : String);
public
{ Public declarations }
end;
var
frmFee: TfrmFee;
implementation
{$R *.dfm}
procedure TfrmFee.GramsOff(HourRun, HourCycle : Integer; var GramOff : String);
Var
TotalCal, GramsLost : Integer;
Begin
HourRun := (sedRun.Value * 475);
HourCycle := (sedCycle.Value * 200);
TotalCal := (HourRun + HourCycle);
GramsLost := (TotalCal * 10 DIV 77);
GramOff := 'Weight loss: ' + IntToStr(GramsLost) + ' grams';
end;
procedure TfrmFee.btnLossClick(Sender: TObject);
var
GramsOff : string;
begin
GramsOff (HourRun, HourCycle: Integer; GramOff : String);
lblResults.Caption := GramOff;
end;
end.
Working simple Method that I am trying to convert to a procedure/ function:
procedure TfrmBurningCalories.btnLossClick(Sender: TObject); var
TotalCal, GramsLost : Integer; begin
TotalCal := (sedCycle.Value * 200) + (sedRun.Value * 475);
Gramslost := TotalCal * 10 DIV 77;
lblLoss.Caption := 'Weight loss: ' + IntToStr(GramsLost) + ' grams';
end;