Page 1 of 1
setProp Clarification
Posted: Tue Apr 16, 2013 2:55 am
by CenturyMan1979
Hey All,
Here is the code in my custom group
Code: Select all
setProp cSelected pValue
put pValue = true into sSelected
set the visible of graphic "_bg" of me to sSelected
end cSelected
I can call the setProp within the group by using this,
Now the question I have is it possible to call this method from the card script. I tried this because it seems like it should work but it does not,
Code: Select all
set the cSelected of group id 1234 to false
Re: setProp Clarification
Posted: Tue Apr 16, 2013 3:32 am
by dunbarx
Sure. Make a button. In the button script:
Code: Select all
on mouseUp
set the yourProp of me to random(99)
end mouseUp
And in the card script:
Code: Select all
setprop yourProp newVal
answer newVal
end xxx
SetProp passes through the message hierarchy just like any message.
Craig Newman
Re: setProp Clarification
Posted: Tue Apr 16, 2013 3:53 am
by CenturyMan1979
dunbarx wrote:Sure. Make a button. In the button script:
Code: Select all
on mouseUp
set the yourProp of me to random(99)
end mouseUp
And in the card script:
Code: Select all
setprop yourProp newVal
answer newVal
end xxx
SetProp passes through the message hierarchy just like any message.
Craig Newman
I am trying to do the opposite. I would want the setProp in the button and want to set it from the card script.
Re: setProp Clarification
Posted: Tue Apr 16, 2013 4:11 am
by dunbarx
Ah.
Well, if you switch the scripts, so in the card script you have:
Code: Select all
on mouseUp
set the yourProp of btn "b1" to random(99)
end mouseUp
And in the button (named "b1") script:
Code: Select all
setprop yourProp newVal
answer newVal
end yourProp
Since the property you are setting is directed to the button, it will trigger a setProp control structure and be trapped by the handler in that button. In a sense, you might think of it as "sending" the setProp trigger to the button by setting the property of that button, down the message path (from card down to button) instead of up.
Craig Newman