Page 1 of 1
Setting a property of one group member inside another group
Posted: Tue Jan 24, 2017 6:01 pm
by simon.schvartzman
I have a card with one "big" group named BigGroup that consists of 5 small groups called SmallGroup including one graphic (Rounded Rectangle) and one label each (Label).
Who can show me the best way to write the script that will let me set the linesize property of the Rounded Rectangle over which the user has clicked (or tapped).
As always, many thanks in advance
Re: Setting a property of one group member inside another gr
Posted: Tue Jan 24, 2017 6:17 pm
by bn
Hi Simon,
try this as script of the BigGroup
Code: Select all
on mouseUp
put the target into tTarget
put the long id of the owner of the target into tOwner
if the owner of tOwner is me then
lock screen
repeat with i = 1 to the number of groups of me
set the lineSize of grc 1 of group i of me to 1
end repeat
set the lineSize of grc 1 of tOwner to 4
unlock screen
end if
end mouseUp
This works as long as there is only one graphic in the smallGroups.
Kind regards
Bernd
Re: Setting a property of one group member inside another gr
Posted: Tue Jan 24, 2017 6:27 pm
by dunbarx
Perhaps I am misunderstanding.
What is wrong with:
Code: Select all
on mouseUp
ask "Enter lineSize"
set the lineSize of the target to it
end mouseUp
Now you could always first check the target to make sure it is a graphic, or even a particular graphic. Grouping, however nested, is transparent to "the target".
Craig Newman
Re: Setting a property of one group member inside another gr
Posted: Tue Jan 24, 2017 6:49 pm
by simon.schvartzman
Craig and Bernd, many thanks to both of you for your answers.
Bernd, the script never gets into the repeat loop because it seems "the owner of tOwner" is never equal to "me".
Re: Setting a property of one group member inside another gr
Posted: Tue Jan 24, 2017 7:03 pm
by bn
Simon
try this stack. It works for me.
Kind regards
Bernd
Re: Setting a property of one group member inside another gr
Posted: Tue Jan 24, 2017 7:24 pm
by simon.schvartzman
Dear Bernd, works like a charm, many thanks!