1
How to reference the property of a purpose created with with TEdit.Create(Self)
, and the use of this will be used in another object that is also being created as with TSpeedButton.Create(Self)
?
Follows the code:
with TEdit.Create(Self) do
begin
Name := 'ed'+IntToStr(i);
Parent := Self;
Top := 0;
Left := 0;
Width := 50;
with TSpeedButton.Create(Self) do
begin
Name := 'sb'+IntToStr(i);
Parent := Self;
Top := 0;
//Left := TEdit().Left + TEdit().Width; //Como referenciar o TEdit?
Width := 20;
end;
end;
What is the need to use this waterfall?
– Junior Moreira
Because you don’t create a Tedit type variable, feed it with the respective Tedit you want to call, it gets easier. It is not very advisable to use the with, then it becomes difficult to analyze the source and give maintenance.
– Jefferson Rudolf
Actually, I was already aware of this way of referencing. The cascading mode is because I’m kind of doing a framework. All objects will be created at runtime according to the records in the database tables. The doubt was more focused on the use of with cascading, in this case I will even have to create variables right.
– Carlos Andrade