Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
I have a field "F1" with some text properties set. I have a bunch of other fields that I want to mimic those properties. I could write a loop to do so, but I often use a mouseEnter handler to manually select certain of those other fields:
on mouseEnter
if the optionkey is down and "field" is in the target then
set the textSize of (line 1 of the target) to the textSize of line 1 of fld "F1" --works fine
set the textSize of (line 2 of the target) to (the textSize of line 2 of fld "F1") --fails
The second line fails with "error in object expression". I copied the last line directly from the one above, just changing the '1" to a "2".
Your syntax can not resolve the target in the way you want it to
Run this code and see what it resolves to in the debugger by inspecting variables tLine1 and tLine2
on mouseEnter
if the optionkey is down and "field" is in the target then
put (line 1 of the target) into tLine1 -- the target itself
put (line 2 of the target) into tLine2 -- empty
breakpoint
-- set the textSize of (line 1 of the target) to the textSize of line 1 of fld "F1" --works fine
-- set the textSize of (line 2 of the target) to (the textSize of line 2 of fld "F1") --fails
set the textSize of line 1 of me to the textSize of line 1 of field "f1"
set the textSize of line 2 of me to the textSize of line 2 of field "f1"
end if
end mouseEnter
However this works if you want to go with "the target"
on mouseEnter
if the optionkey is down and "field" is in the target then
put the long id of the target into tID
set the textSize of line 1 of tID to the textSize of line 1 of field "f1"
set the textSize of line 2 of tID to the textSize of line 2 of field "f1"
end if
end mouseEnter
I can not explain why the long id is differently resolved.
- Reversing the lines is not pertinent, since having only the single line addressing line 2 fails all on its own.
-
How many lines are in the value returned from "the target"?
Not sure what you mean. All I wanted to do with this was to be able to drag the cursor through certain of the many fields on a card, and have certain properties change to that of a certain card I painstakingly set up.
I will try this tomorrow, but do not see why the two lines are so (can be so) different. I had a hard time believing it at all. God knows what might happen if I ever dared to try this with line 3.
Anyway, after I posted, I made another gadget to do the work. But this seems so odd; the only difference is the "1" and the "2".