What the (*%*

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

What the (*%*

Post by dunbarx » Thu Jun 13, 2024 6:12 pm

I use this sort of method all the time.

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:

Code: Select all

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".

Can't wait to hear this one. :cry:

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: What the (*%*

Post by FourthWorld » Thu Jun 13, 2024 7:20 pm

What happens when you change the test to reverse the lines being tested?

How many lines are in the value returned from "the target"?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: What the (*%*

Post by bn » Thu Jun 13, 2024 10:43 pm

Craig,

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

Code: Select all

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"

Code: Select all

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.

Kind regards
Bernd

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: What the (*%*

Post by dunbarx » Fri Jun 14, 2024 2:58 am

@Richard.

- 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 was certain this was a no-brainer.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: What the (*%*

Post by dunbarx » Fri Jun 14, 2024 3:02 am

Bernd.

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. :twisted:

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".

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: What the (*%*

Post by dunbarx » Fri Jun 14, 2024 3:10 am

Bernd.

Thinking about what you said, there really is no issue at all.

Code: Select all

on mouseEnter
   if "field" is in the target then answer line 2 of the target
end mouseEnter
Returns empty, as it should. Many ways to actually make that work...

My fault.

Craig

Post Reply