ASSIGN operator <= vs :=
ASSIGN operator <= vs :=
Maybe I am just being daft, but can someone help give a bit more of an explanation as to when or why it is better to use the ASSIGN operator '<=' instead of the simple ':=' '?
Arlyn Dale
Servias Development & Support
Intelliware, Inc.
Servias Development & Support
Intelliware, Inc.
Re: ASSIGN operator <= vs :=
I guess all begin with C, but basically it depends on what the "parameter" (or the property or the attribute) it is calling for.
It can call for a reference (to another component, a "pointer") <=
or a plain simple value (string, number, Boolean, etc.). :=
So, for example if you use an "Alert control" in a Web Page (I called it #TEST555), properties like Width, Height, Top, Opacity, are expecting a Value and nothing more complex than that. You could use Intrinsics over that value to convert the numeric value to a String value using .AsString for example, you could perform calculations to obtain that value, but the value, let's say 400, at the end is just a value.
On the other hand, the property Parent, that one is not expecting a string value with the name of the Parent (which we could obtain with something like #TEST555.Name) but is expecting instead a reference to the Actual Parent. Is like a teacher asking a child for his Parent and the child only gives the name. We don't want just the name, we want access to the whole enchilada, name, phone, address, where he is now, what he looks like, etc. For that, this property Parent, is expecting a reference, call it, a child pointing to the actual Parent. that one. then, we can make the connection and talk with it and have access to whatever we need from that Parent.
Notice in the example code below, using the property Parent in Alert, I can access Parent properties and navigate thru them.
It can call for a reference (to another component, a "pointer") <=
or a plain simple value (string, number, Boolean, etc.). :=
So, for example if you use an "Alert control" in a Web Page (I called it #TEST555), properties like Width, Height, Top, Opacity, are expecting a Value and nothing more complex than that. You could use Intrinsics over that value to convert the numeric value to a String value using .AsString for example, you could perform calculations to obtain that value, but the value, let's say 400, at the end is just a value.
On the other hand, the property Parent, that one is not expecting a string value with the name of the Parent (which we could obtain with something like #TEST555.Name) but is expecting instead a reference to the Actual Parent. Is like a teacher asking a child for his Parent and the child only gives the name. We don't want just the name, we want access to the whole enchilada, name, phone, address, where he is now, what he looks like, etc. For that, this property Parent, is expecting a reference, call it, a child pointing to the actual Parent. that one. then, we can make the connection and talk with it and have access to whatever we need from that Parent.
Notice in the example code below, using the property Parent in Alert, I can access Parent properties and navigate thru them.
Code: Select all
#Alert.Width := 400
#STD_TEXT := #Alert.Width.AsString
#Alert.Parent <= #TEST555
#STD_TEXT := #Alert.Parent.DisplayPosition.AsDisplayString
#STD_TEXT := #Alert.Parent.HintTitle
#Alert.Parent.Rotation := 90
Re: ASSIGN operator <= vs :=
That helps.
As always, thanks for the explanation and example.
As always, thanks for the explanation and example.
Arlyn Dale
Servias Development & Support
Intelliware, Inc.
Servias Development & Support
Intelliware, Inc.