Hello,
I want to make a kind of data validation procedure, in which i want to pass the text stored in a TextBox and also pass the property that needs to be set of a particular object.
Example:
procedure ValidateEntry(Sender1 :TObject; Sender2:TObject);
var
TheBox: TEdit;
TheLabel: TLabel;
DefaultValue: Integer;
begin
TheBox:= Sender1 as TEdit;
TheLabel:=Sender2 as TLabel;
DefaultValue:=100;
if TheBox.Text<>'' then TheLabel.Left:=StrToInt(TheBox.Text) else TheLabel.Left:=DefaultValue;
end;
Above procedure works ok and can be called by main program using something like
ValidateEntry(Edit1,Label1)
But i would like to be possible to call the same procedure ValidateEntry by passing also the Label1 property that needs to be adjusted every time
For example i have imagined something like
ValidateEntry(Edit2,Label1,Width) //to adjust the Label1.Width property based on the Edit5.Text value.
ValidateEntry(Edit3,Label1,Height) //to adjust Label1.Height , and so on
But i can not figure out how to write the code inside ValidateEntry procedure in order to pass and handle the required property like
TheLabel.property_passed:=......