Selecting an object

J. Landman Gay jacque at hyperactivesw.com
Mon Mar 14 00:50:43 EDT 2011


On 3/13/11 11:43 PM, J. Landman Gay wrote:
> On 3/13/11 7:45 PM, Peter Haworth wrote:
>> I know that was suggested and I can't remember why it didn't work for
>> me - I think it may have been because the group may not exist. Or
>> maybe it's because I'm copying the control into the group, not
>> creating it?
>
> For copying, use this:
>
> copy button "myButton" to grp "mygroup" of cd "thatCard"

Oops, this will fail if you aren't on that card. I should have said:

   copy button "myButton" of cd "thatCard" to grp "mygroup" of cd "thatCard"

But there's a shorter way using the "currentCard" syntax. That's sort of 
like defaultstack, only for cards. So you could set that first, do the 
work, then set it back:

put the number of this cd into tOrigCard
set the currentcard of this stack to "thatCard"
copy btn "myButton" to grp "mygroup"
... anything else you need to do there
set the currentcard of this stack to tOrigCard

So all the work gets done without the user ever changing cards.

>
> If you no longer want the original, you'd need to delete it after that:
>
> delete button "myButton" of cd "thatCard"
>
> If the group doesn't exist then you'd need to create one first. You can
> do that remotely too:
>
> create grp "new group"
> place grp "new group" onto cd "thatCard"
> remove grp "new group" from this cd
>


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list