what is the difference between command and own on ...

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
fhs14647
Posts: 21
Joined: Sat May 16, 2020 11:40 am

what is the difference between command and own on ...

Post by fhs14647 » Sat Feb 13, 2021 11:22 pm

Dear Experts

What is the difference/benefit between an own message handler or a command for using them. I made this coding just for demonstrating my question.

Code: Select all

on mouseUp
   ## own message with same output
   informing
   ## command with same output
   inform
end mouseUp

on informing
   answer "This is an information about 'on informing'"
end informing

command inform
   answer "This is an information with command 'informing'"
end inform

Thanks a lot
Mike

Davidv
Posts: 77
Joined: Sun Apr 09, 2006 1:51 am

Re: what is the difference between command and own on ...

Post by Davidv » Sat Feb 13, 2021 11:51 pm

They are synonyms.

adding... I have been using Livecode and its predecessors "forever" and I had never noticed that command existed. Given on has near a quarter the characters, I think I will keep using that. :)

fhs14647
Posts: 21
Joined: Sat May 16, 2020 11:40 am

Re: what is the difference between command and own on ...

Post by fhs14647 » Sun Feb 14, 2021 12:05 am

Davidv wrote:
Sat Feb 13, 2021 11:51 pm
They are synonyms.

adding... I have been using Livecode and its predecessors "forever" and I had never noticed that command existed. Given on has near a quarter the characters, I think I will keep using that. :)
:D :)

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: what is the difference between command and own on ...

Post by SparkOut » Sun Feb 14, 2021 12:29 am

They are synonyms to all intents and purposes that I know, but once upon a time, there was a suggestion that "on" be used for system messages (eg on mouseUp) and "command" be used for custom handlers.
There was an implication that maybe one day there would be a use case where this mattered beyond styling.
I don't think that use case ever raised its head so far. I did once answer a similar question thinking that you couldn't define a private handler with "on" but even that was debunked.

fhs14647
Posts: 21
Joined: Sat May 16, 2020 11:40 am

Re: what is the difference between command and own on ...

Post by fhs14647 » Sun Feb 14, 2021 9:54 am

OK, thanks for your answer!

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

Re: what is the difference between command and own on ...

Post by dunbarx » Sun Feb 14, 2021 5:16 pm

What Sparkout said.

I am too old to use "command" for my own handlers, sticking with "on" everywhere. I am not sure I would notice any advantage to separating these, since I cannot even understand my own code ten minutes after I write it.

Craig

fhs14647
Posts: 21
Joined: Sat May 16, 2020 11:40 am

Re: what is the difference between command and own on ...

Post by fhs14647 » Sun Feb 14, 2021 6:06 pm

:D :) :lol:



bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: what is the difference between command and own on ...

Post by bogs » Sun Feb 14, 2021 8:22 pm

Maybe you better quote it, SparkOut :wink:

Image
Image

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: what is the difference between command and own on ...

Post by SparkOut » Sun Feb 14, 2021 8:58 pm

????
It's not visible, because it's the Commercial forum?
Well I can't easily quote the whole thread, but anyway it just repeats much of the other thread Klaus linked. I only referenced it as that was where it was pointed out that you can actually declare a handler as "private on handlerName".

Post Reply