[-hh] wrote:Hi all,
one more question in the same direction.
Often I use (try to use) constructs like
- put "field (" & quote & "myField" & quote && "tVal)" into obj1
(yes, with variable name in there) and then
- put "text" into obj1
- set lockText of obj1 to not the lockText of obj1
and so on.
With some controls this works, with other's not.
The text we put into fields, buttons, etc. is a property of those objects, and when we use property-setting syntax you should always get what you want provided the variable resolves to a valid object reference, e.g.:
Code: Select all
put the long id of fld 1 into tFld
set the text of tFld to "Some Text"
LiveCode also graciously allows us to use container syntax in addition to property syntax in some circumstances, so we can do things like this:
Where things get challenging is when we use container syntax ("put") on object references stored in variables. In that case we have things like one of your examples above:
Code: Select all
put the long id of fld 1 into tObj
put "Some Text" into tObj
...in which the engine sees:
Code: Select all
put something into the variable tObj
put something else into the variable tObj
When in doubt about using object references in variables, using property syntax ("set") rather than container syntax ("put") should provide reliable results.