backscript and custom properties

Jacques Hausser jacques.hausser at unil.ch
Tue Dec 23 18:18:58 EST 2008


Thank you Mark,

I didn't speak about setprop (it's perfectly logic, even if not  
compulsory, that a setprop would modify a property) , but about a  
getprop, which, in this case, doesn't change the CP - I tried that:  a  
CP consisting of a basic sentence in a first line, say "xxxx is living  
in yyyy - right or false ?", a second line with a list of species  
names sparated by comma and a third line with a list of biotops  
separated by comma. The getprop takes randomly an item in the second  
line to replace xxxx and an item in the third line to replace yyyy.  
And when you look at the property in the inspector you read at the  
first line something (different each time) like
"Microtus agrestis is living in marshy meadows - right or false ?".  
That's exactly what I want when running the stack, but I would like to  
see "xxxx is living in yyyy - right or false ?" in the inspector -  
that is the real content of the CP (the "pure" CP ;o))

My example is perfectly stupid, because it would be far simpler to  
drop the getprop and to put it's statements into the function but  
well, it's only an example, and it works... the button's back script is:

function DisplayQuestion
    return the question of me
end displayquestion

getprop the question
     put line 1 of the question of me into laquestion
     put item (random(30)) of line 2 of the question of me into word 1  
of laquestion
     put item (random(21)) of line 3 of the question of me into word 5  
of laquestion
     return laquestion
end the question

and anywhere in the stack:

     put DisplayQuestion() into fld "SuchAndSuch"

I was just amazed to discover it was possible to use CPs and getprop  
in a backscript... after all, the command is not "Insert button "truc"  
into back" but "Insert the script of button "truc" into back"...

Jacques

Le 23 déc. 2008 à 20:51, Mark Smith a écrit :

> Jaques, you're right - the script can still refer to 'me'. I use  
> buttons as libraries quite often, and the fact that a button's CPs  
> are available can be very useful.
>
> I don't tend to use getProp and setProp handlers in those 'button'  
> libraries much - you'd still have to refer to the button's name or  
> ID, and I generally just want a libraries commands and function  
> available.
>
> I'm not sure what you'd expect a setProp handler to do other than  
> modify a property, so I don't think I understand what you mean by a  
> 'pure' custom property...
>
> Best,
>
> Mark
>
> On 23 Dec 2008, at 17:45, Jacques Hausser wrote:
>
>> Hello everybody
>>
>> I just discovered accidentally that when a button's script is  
>> inserted as a backscript, it doesn't go there alone, but takes with  
>> it its custom properties, getprop and tutti quanti.
>> That could be very useful... Has somebody some experience with this  
>> feature ?
>> (I discovered also that the inspector doesn't display the "pure"  
>> custom property, but the property as modified by the getprop...  
>> that is perhaps not so good).
>> Happy Christmas (or any other solstice-linked celebration) to you.
>>
>> Jacques
>>
>> ******************************************
>> Prof. Jacques Hausser
>> Department of Ecology and Evolution
>> Biophore / Sorge
>> University of Lausanne
>> CH 1015 Lausanne
>> please use my private address:
>> 6 route de Burtigny
>> CH-1269 Bassins
>> tel/fax: 	++ 41 22 366 19 40
>> mobile:	++ 41 79 757 05 24
>> E-Mail:	jacques.hausser at unil.ch
>> *******************************************
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

******************************************
Prof. Jacques Hausser
Department of Ecology and Evolution
Biophore / Sorge
University of Lausanne
CH 1015 Lausanne
please use my private address:
6 route de Burtigny
CH-1269 Bassins
tel/fax: 	++ 41 22 366 19 40
mobile:	++ 41 79 757 05 24
E-Mail:	jacques.hausser at unil.ch
*******************************************




More information about the use-livecode mailing list