"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: 112
Joined: Thu May 26, 2016 9:30 pm
Location: Winnipeg, Canada

"Command" vs "On" command

Post by raugert » Mon May 21, 2018 9:33 pm

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 Indy 9.6.11 (Stable)
MacOS Sonoma 14.2
Xcode 15.0.1 SDK 17.0

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9834
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: "Command" vs "On" command

Post by FourthWorld » Mon May 21, 2018 11:25 pm

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: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: "Command" vs "On" command

Post by Klaus » Tue May 22, 2018 1:38 pm

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: 112
Joined: Thu May 26, 2016 9:30 pm
Location: Winnipeg, Canada

Re: "Command" vs "On" command

Post by raugert » Tue May 22, 2018 1:50 pm

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 Indy 9.6.11 (Stable)
MacOS Sonoma 14.2
Xcode 15.0.1 SDK 17.0

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”