Is a widget not an object?

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
marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Is a widget not an object?

Post by marksmithhfx » Tue Feb 28, 2023 3:15 pm

LC is complaining and won't allow me to write...

Code: Select all

copy widget "first" from cd "Home" to this cd
Any other approach to copying a widget from 1 cd to another?

Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Is a widget not an object?

Post by Klaus » Tue Feb 28, 2023 3:30 pm

Hi Mark,

this works:

Code: Select all

copy widget "first" OF cd "Home" to this cd
Probably because of the exact indentifier -> widget "first" of cd "Home"

Best

Klaus

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

Re: Is a widget not an object?

Post by dunbarx » Tue Feb 28, 2023 3:55 pm

Mark.

What Klaus said. But it is important to "parse" what you thought was the correct syntax in the first place. When you tried to identify the source object and its current location, you used "from". If you think about it, that would not make LC particularly happy. But:
copy widget "first" OF cd 1
Identifies the target object and its location properly and fully. To substitute "from" for "of" is jumping the gun, mixing a description of the location of that target with the desire to set up a source/destination construct.

One at a time is the answer here. The "to this cd" is all that is needed to specify the destination, and it is a separate clause.

Craig

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Is a widget not an object?

Post by marksmithhfx » Wed Mar 01, 2023 4:39 pm

Thanks guys!! Probably me just getting into the "natural" language thing a bit too much and forgetting, yes, LC does have its own particular brand of English. 😊
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Post Reply