Group Command (not control) in script

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Group Command (not control) in script

Post by seaniepie » Wed May 02, 2012 5:06 pm

Hi all,
I'm trying to implement the group command but keep getting an error back

Code: Select all

group graphic "Dot_1" and graphic "Dot_2" 
Error:
card "PropertyDetails": execution error at line 127 (Group: bad object type), char 1

The dictionary has the syntax 'group [objectList]' and uses the example 'group field "Help" and image "Help Icon" and graphic "Outline"'
This is in v5.5. Any ideas?

Pi

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Group Command (not control) in script

Post by Klaus » Wed May 02, 2012 5:15 pm

Hi Sean,

I created two graphics "dot_1" and "dot_2" and tested with exactly your script and ended with a group, no errors!?
But I am still using LC 5.02.
Bug in 5.5?

Anyway, I never use this syntax but rather do this, which also works fine in a repeat loop:
...
## Select all objects:
set the selected of grc "dot_1" to true
set the selected of grc "dot_2" to true

## Group them
group

## Deselect them again
select empty
...


Best

Klaus

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: Group Command (not control) in script

Post by seaniepie » Wed May 02, 2012 5:26 pm

Thats brill Klaus,
That will work much better for me anyways as I am creating the dots in a repeat loop and they vary each time the card is loaded. This will be much better to manage.
Thanks. I knew you'd be the one to set me straight :)

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Group Command (not control) in script

Post by Klaus » Wed May 02, 2012 5:36 pm

Glad I didn't disappoint you :D

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: Group Command (not control) in script

Post by seaniepie » Wed May 02, 2012 5:48 pm

Just tried it. Worked a treat :D
I think the problem with the other way was that they were already part of a group which I wanted to nest. Even if I told the group command that they were part of a group or ignored that and used long id's it still caused a script error. But I'm done now so I tip my hat to you sir.
Pi

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Group Command (not control) in script

Post by Klaus » Wed May 02, 2012 6:11 pm

Hi Sean,

yep, groups and objects in groups are special kind of beasts!

I think you canot do this without messing with the "editBackground"
property somehow, which I try to avoid whenever possible 8)


Best

Klaus

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Group Command (not control) in script

Post by jmburnod » Wed May 02, 2012 7:00 pm

Hi,

The two scripts work for me in 5.5.1. (- dp-1 build 1480)

Best

Jean-Marc
https://alternatic.ch

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Group Command (not control) in script

Post by Klaus » Wed May 02, 2012 7:01 pm

Jean-Marc,

please read Sean's last posting...

Post Reply