"Command" vs "On" command

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
raugert
Posts: 113
Joined: Thu May 26, 2016 9:30 pm

"Command" vs "On" command

Post by raugert »

What's the difference between the following for creating custom commands ?

Code: Select all

command doSomething
-- code
end doSomething
VS

Code: Select all

on doSomething
--code
end doSomething
Is is something to do with the message path ? The reason I ask is because my app was crashing occasionally when I was using "command" in a button script. I changed it to "on" and it seems much more stable ...

I still use "command" for custom commands in the card script. It doesn't seem to affect anything.

Can anyone clarify,
thanks,
Ricard
Livecode 10.0.3 (Stable)
MacOS Sonoma 14.7.2
Xcode 15.0.1 SDK 17.0
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: "Command" vs "On" command

Post by FourthWorld »

Switching between "on" and "command" should make no functional difference. Please post the code in question and we may be able to help figure out what you're seeing.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: "Command" vs "On" command

Post by Klaus »

Hi Ricard,

what Richard said!

Once upon a time (some years ago) Livecode advised use to use COMMAND for custom handlers to differ them from the build-in commands like "on mouseup" etc.

They said that at some point in the future this would really matter.
This day did not arrive yet, however! :D


Best

Klaus
raugert
Posts: 113
Joined: Thu May 26, 2016 9:30 pm

Re: "Command" vs "On" command

Post by raugert »

Thanks Klaus and Richard. That answers my question. I didn't think it made any difference. The crashing issue I had, thats now fixed, must be something else I did. :shock:

cheers,
Richard
Livecode 10.0.3 (Stable)
MacOS Sonoma 14.7.2
Xcode 15.0.1 SDK 17.0
Post Reply