Old question but.. since its a function, whether you use do or not, gotta
have the () at the end.
On Wed, Aug 23, 2017 at 8:57 AM, Jonathan Lynch via use-livecode <
use-livecode@lists.runrev.com> wrote:
> Sorry - old message that randomly popped up in my email!
>
> Sent from my iPhone
>
> > On
Sorry - old message that randomly popped up in my email!
Sent from my iPhone
> On Aug 23, 2017, at 10:53 AM, jonathandly...@gmail.com wrote:
>
> The "do" command converts text into a command. Like this:
>
> Put "answer 5" into tcommand
> Do tcommand
>
> This is useful in some situations, but
The "do" command converts text into a command. Like this:
Put "answer 5" into tcommand
Do tcommand
This is useful in some situations, but usually it is more efficient to just say:
Answer 5
Sent from my iPhone
> On Jul 10, 2017, at 11:23 AM, J. Landman Gay via use-livecode
>
I wrote this explanation a long time ago for someone else:
http://www.hyperactivesw.com/resources_function.html
Also, in your command handler example, you don't need "do" which adds
unnecessary overhead. This is enough:
on mouseUp
GoRed
end mouseUp
--
Jacqueline Landman Gay |
That is cool. As soon as 9 release candidates are released I will have to look
hard at v9. Unfortunately I do not develop for a living (exactly) so I do not
have a lot of time for running a DP through it's paces.
Bob S
> On Jul 10, 2017, at 06:01 , Mike Kerner via use-livecode
>
In the newfangled LC world, you can even do things the way the engine can -
using "return for value" (or just "return") and "return for error" to allow
commands to return values, too. Then "it" gets values that are returned,
and "the result" gets errors that are returned. 9 is fun.
Here is what I teach my students:
Use the function to return a value to the calling handler, set the properties
in the handler, not in the function itself, like this:
on mouseUp
set backgroundColor of this card to goRed()
end mouseUp
function goRed
return “red”
end goRed
The benefit of
It does help a lot: even if only to stop me looking totally 'Stpid'
in front
of the kids in my Summer classes.
Thanks.
Richmond.
On 7/10/17 11:09 am, Tim Selander via use-livecode wrote:
Hi Richmond
This works (both scripts in the button):
on mouseUp
put goRed()
end mouseUp
function
Hi Richmond
This works (both scripts in the button):
on mouseUp
put goRed()
end mouseUp
function goRed
set the backGroundColor of card 1 to red
end goRed
I think the general idea is that a function returns information. So
date() returns the date. But just having a line "date()" in the script
I am obviously missing something . . .
. . . so badly so that I've been trawling Danny Goodman's "Complete" HC
2 . . .
and NOT getting 'it' . . .
SO: one can set up a custom command:
on GoRed
set the backGroundColor of card 1 to red
end GoRed
and one can call it:
on mouseUp
do GoRed
10 matches
Mail list logo