I am trying to write a procedure in delphi.
This procedure gets the name of TControl
descendent element and then try to change some properties.
But when i try to do it, Delphi gives an error like:
E2033 Types of actual and formal var parameters must be identical
Procedure:
procedure Change_prop(var Control: TControl;height:integer;width:integer);
begin
//......
end;
Usage Example : Change_prop(Label1, 50,200);
What can be the solution of that error..Thanks.
You just need to remove the var in the Control parameter and make it a value parameter. Because Delphi objects are actually implemented as reference types, you can call methods on them, change member fields etc. even if you pass them to a procedure as a value or const parameter.