Heirarchy and where the mouseUp signal is detected.

dunbarx at aol.com dunbarx at aol.com
Wed May 15 16:37:59 CDT 2013


Richmond.


If you already have those buttons coded, you have locked yourself into the message hierarchy, and will have to change all the scripts. The hierarchy is fundamental, and a powerful aspect of the language. As you know.



But I don't think changing the scripts is all that onerous. Scripts are a property of an object, and you can set them (not put something into them- they are not containers) in a repeat loop.



Make a copy of your stack before you try this.




Loop through each button script, I hope you can isolate those that you are interested in. Get the script of each, and put the "pass" line into each. Then set the script to the new one.


Something like;


put return & "pass mouseUp" before line -1 of the script of btn "currentButton"


Craig




-----Original Message-----
From: Richmond <richmondmathewson at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, May 15, 2013 3:54 pm
Subject: Re: Heirarchy and where the mouseUp signal is detected.


On 05/15/2013 10:33 PM, Randy Hengst wrote:

Because my "wee stack" was a story, and what I have is my Devawriter Pro 
program where each card has about 50 buttons; and, being a lazy slob,
I have no great urge to go through the script of each and every button 
on some 15 cards putting in 1 line of code if I can circumvent that by
putting it in the cardScript.

> Hi Richmond,
>
> How about putting all this in the card script? And put nothing in the button.
>
> on kindOfAnimal
>       if fld "FF" contains "dog" then
>             put "cat" into fld "FF"
>       else
>             put "dog" into fld "FF"
>          end if
> end kindOfAnimal
>
>
> on colorOfText
>       if the textColor of fld "FF" is "green" then
>          set the textColor of fld "FF" to "red"
>     else
>          set the textColor of fld "FF" to "green"
>       end if
> end colorOfText
>
> on mouseUp
>     kindOfAnimal
>     colorOfText
> end mouseUp

That would work for this specific example.

> be well,

trying :)

> randy
> -----
> On May 15, 2013, at 2:19 PM, Richmond wrote:
>
>> The reasons for this are probably fairly basic.
>>
>> I have a wee stack that contains a fld "FF" containing the text "dog",
>>
>> and a button "Button" containing this script:
>>
>> on mouseUp
>>    if fld "FF" contains "dog" then
>>       put "cat" into fld "FF"
>>    else
>>       put "dog" into fld "FF"
>>       end if
>> end mouseUp
>>
>> [sophisticated stuff it ain't]
>>
>> and the single card contains this script:
>>
>> on mouseUp
>>    if the textColor of fld "FF" is "green" then
>>    set the textColor of fld "FF" to "red"
>> else
>>    set the textColor of fld "FF" to "green"
>>    end if
>> end mouseUp
>>
>> Now, split me, but I thought that if I clicked anywhere on the card the 
cardScript would fire, including on the button,
>>
>> BUT, deuced inconvenient, clicking on the button only fires the buttonScript, 
and clicking anywhere on the card, outwith the button fires the cardScript.
>>
>> and I was hoping that a buttonClick would fire both the cardScript and the 
buttonScript.
>>
>> Does anybody know how to effect this?
>>
>> 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


_______________________________________________
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