Page 1 of 1

How to copy nested groups?

Posted: Wed Jul 31, 2013 1:27 pm
by MaxV
Hi all,
I have a very complex group. This group contains a button that it shows/hide a nested group inside it ("fromDatePicker").
Button code:

Code: Select all

on mouseUp
if the Visible of group "fromDatePicker"  = false then
      set the Visible of group "fromDatePicker"  to true      
   else 
      set the Visible of group "fromDatePicker"  to false
   end if  
end mouseUp
I need to duplicate it many time in the same card, but all the new button show/hide always "fromDatPicker" of the first group.

Is there any syntax like "button Hello of this group"?

Re: How to copy nested groups?

Posted: Wed Jul 31, 2013 2:26 pm
by dunbarx
I am not sure what you need.

Do you want to duplicate the button itself? Why? What would more buttons do for you? Would each new one hide/show a different group? To distinguish one button from another you can change their names, of course, and refer to them in that way.

You can shorten your script:

Code: Select all

on mouseup
set the visible of group "fromDatepicker" to not the visible of group "fromDatePicker"
end mouseup
But that was not your problem. Please write back with more details.

Craig Newman

Re: How to copy nested groups?

Posted: Wed Jul 31, 2013 2:27 pm
by Mark
Hi,

I'd make a template group in a different stack (not protected by a password) and use syntax such as

Code: Select all

copy grp id 1234 of stack "Your Template Stack" to cd 1 of stack "Your Destination Stack"
put it into myGrp
hide grp "FromDatePicker" of myGrp
This syntax assumes that group "FromDatePicker" is part of another group. (I'm not sure if I understand that correctly).

Edit:
Reading Bernd's solution, I think he understands what the problem is and his solution will work.

Kind regards,

Mark

Re: How to copy nested groups?

Posted: Wed Jul 31, 2013 2:40 pm
by bn
Hi Max,

if the button is in the same group as the datePicker then

Code: Select all

on mouseup
set the visible of group "fromDatepicker" of the owner of me to not the visible of group "fromDatePicker" of the owner of me
end mouseup
owner of me tells the button to operate on group "fromDatePicker" that belongs to the same group as the button you are clicking.
this is the equivalent of "like "button Hello of this group"?"

Kind regards
Bernd

Re: How to copy nested groups?

Posted: Wed Jul 31, 2013 3:09 pm
by MaxV
THANK YOU!
On the owner of me is what I was looking for! :-)