Error : Object cannot be grouped

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
CAsba
Posts: 431
Joined: Fri Sep 30, 2022 12:11 pm

Error : Object cannot be grouped

Post by CAsba » Mon Dec 12, 2022 5:09 pm

Hi,
I'm working on the title of ask and answer presentations. It will show 'CAsba', at the begining of the line, and the business name at the end of the line.
To do this I have two fields, identical properties except length and text left on one and text right on the other.
The code:

Code: Select all

on mouseup
   put "CAsba" into field compnamex3 of cd "business departments"
   if there is group "compnamex15" of cd "business departments" then
   ungroup group "compnamex15"      
   end if
   group field "compnamex3" of cd "business departments" and field "compnamex4" of cd "business departments"
   set the name of it to "compnamex15" of cd "business departments"
   put group "compnamex15" of cd "business departments" into field "fieldboxtitle" of cd template1
   end mouseup
The field 'fieldboxtitle' would then be added to the ask/answer code line.
I get the error message at the 5th line. Beats me..

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Error : Object cannot be grouped

Post by richmond62 » Mon Dec 12, 2022 5:33 pm

Nothing that I can see, I'm afraid:
-
Screen Shot 2022-12-12 at 6.31.51 pm.png
Attachments
LADBROOKE GROVE.livecode.zip
Stack
(1.06 KiB) Downloaded 94 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Error : Object cannot be grouped

Post by richmond62 » Mon Dec 12, 2022 5:34 pm

Oh, wait a minute . . .

How do you expect to put a group into a text field?

Code: Select all

put group "compnamex15" of cd "business departments" into field "fieldboxtitle" of cd template1
That just does not make sense at all.

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

Re: Error : Object cannot be grouped

Post by Klaus » Mon Dec 12, 2022 5:58 pm

Is the button with that "mouseup" script on card "business departments"?
What is in group "compnamex15"?
Why do you UNGROUP it first?

And what Richmond said!

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Error : Object cannot be grouped

Post by stam » Mon Dec 12, 2022 6:43 pm

As others have said, the code you posted doesn't make much sense.
Rather than code, can you post what you're trying to achieve? (with as much detail as possible as it's often the case that what is being asked can be perceived quite something when detail is lacking...). Then people can try to help...
S.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Error : Object cannot be grouped

Post by dunbarx » Mon Dec 12, 2022 7:09 pm

CAsba.

There is, however, something to learn here. Fields are containers and contain only text. You cannot put an object into a field.

Code: Select all

put group 1 into fld 1
Because only a container (a reserved LC name) can go into a container.

But you can put the contents of an object into a field:

Code: Select all

on mouseUp
  put "XYZ" into btn 1
  put btn 1 into fld 1
end mouseUp
Because a button is a container. This goes way back to HC.

Craig

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Error : Object cannot be grouped

Post by mwieder » Mon Dec 12, 2022 7:47 pm

Based on your original post
I'm working on the title of ask and answer presentations. It will show 'CAsba', at the begining of the line, and the business name at the end of the line.
I think what you want is more like

Code: Select all

on mouseUp
put field "compnamex3" of cd "business departments" && field "compnamex4" of cd "business departments" into field "fieldboxtitle" of cd template1
end mouseUp

CAsba
Posts: 431
Joined: Fri Sep 30, 2022 12:11 pm

Re: Error : Object cannot be grouped

Post by CAsba » Tue Dec 13, 2022 2:37 pm

Thank you guys, I didn't know that groups can't be put into fields. I appreciate your responses very much.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Error : Object cannot be grouped

Post by dunbarx » Tue Dec 13, 2022 3:35 pm

CAsba.
I didn't know that groups can't be put into fields.
Assume for a moment you could. What would that look like? Could you put a card or stack into a field? A banana?

Craig

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Error : Object cannot be grouped

Post by mwieder » Tue Dec 13, 2022 6:45 pm

Craig- if you think of a group not as a group of controls but as a group of texts contained in the aggregated controls then it does make sense.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Error : Object cannot be grouped

Post by dunbarx » Tue Dec 13, 2022 9:09 pm

Mark.

Hmmm. I suppose one could think of a group as anything at all. But in instructing a new user I wanted to make a clear distinction between the nature of a source container and the nature of a destination container. And what a container is and needs to be in the first place.

Hence the banana.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Error : Object cannot be grouped

Post by jacque » Tue Dec 13, 2022 10:02 pm

I can see how it would be confusing because if you say "put fld 1" you get the text of the field. You don't have to specify "the text of fld 1". It's a shortcut that goes back to HC. So why couldn't you say "put grp 1" and get the text?

We take a lot for granted when things become habitual.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Error : Object cannot be grouped

Post by dunbarx » Tue Dec 13, 2022 10:54 pm

Jacque.
So why couldn't you say "put grp 1" and get the text?
Because group 1 might consist of two images, a scrollbar and a line graphic? :wink:

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Error : Object cannot be grouped

Post by jacque » Tue Dec 13, 2022 11:07 pm

If the syntax were consistent we'd probably get the binary representation. ;)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Error : Object cannot be grouped

Post by dunbarx » Wed Dec 14, 2022 12:23 am

I have rarely had consistent syntax. In fact, I rarely have syntax at all.

Craig

Post Reply