Goofy question #7234

Richmond Mathewson richmondmathewson at gmail.com
Mon Jul 10 04:14:05 EDT 2017


It does help a lot: even if only to stop me looking totally 'Stoooopid' 
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 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 
> causes an error because you haven't told it what to do with the info 
> being returned. So you need "put data()" and then the info will go to 
> the message box.
>
> Your function doesn't return any data. That's your choice when you 
> write it. But the engine is still expecting a function to return info, 
> so you still have to say "put" trigger the function.
>
> You could write your function with a parameter:
> function goRed foo
> set the backGroundColor of foo to red
> end goRed
>
> Then call the function like this:
> put goRed("card 1")
> put goRed("card 3")
> etc., and the one function can be used to turn both card 1 and card 3 
> (and any other object you specify in foo) red.
>
> Hope that helps.
>
> Tim Selander
> Tokyo, Japan
>
>
>
>
>
> On 7/10/17, 15:48, Richmond Mathewson via use-livecode wrote:
>> 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
>> end mouseUp
>>
>> and one can set up a custom function:
>>
>> function GoRed
>>   set the backGroundColor of card 1 to red
>> end function
>>
>> Now: is the reason I cannot call that function because it takes NO 
>> parameters?
>>
>> Richmond.
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your 
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list