Naming Groups

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
A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Naming Groups

Post by A1Qicks » Sat Dec 26, 2015 10:50 am

I seem to be having some trouble with naming groups.

I was attempting to make it work in a wider script but have tried it independently on a stack by itself and can't get it to work for the life of me.

Got two fields, Field1 and Field 2, this is what I've got on a button:

on mouseUp
set the name of templateGroup to "Misery"
answer the name of the templateGroup
group field "Field1" and field "Field2"
end mouseUp

I've also tried using "set the name of the last group" but I know 'last' has had some problems with groups anyway.

All the same, this doesn't affect the new group at all. I can't change any of the properties of the new group through use of the templateGroup.

How do I create a group and set its name at the same time?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Naming Groups

Post by Dixie » Sat Dec 26, 2015 11:17 am

Code: Select all

on mouseUp
   group fld 1 AND fld 2
   set the name of the last group of this card to "fldgroup"
end mouseUp

A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Re: Naming Groups

Post by A1Qicks » Sat Dec 26, 2015 11:22 am

Really? All I was missing was "of this card"? Damn.

Thanks Dixie!

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

Re: Naming Groups

Post by Klaus » Sat Dec 26, 2015 11:31 am

HI A1Qicks,

1. welcome to the forum! :D

2. All modifications to "the templateXXX" only stick when you later do:
...
create group
## button/field etc...
...


Best

Klaus

A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Re: Naming Groups

Post by A1Qicks » Sat Dec 26, 2015 11:39 am

Hi Klaus! It's nice to be here. I'm a stone cold beginner to coding entirely, so I'll probably be posting a fair few dumb questions... :lol:

And thanks for the bonus info! I was working by scouring old forum posts and couldn't quite follow the layout of them.

What's the phrasing for then adding an object to an existing group?

For example with 'create group', and then trying to put a field into it.

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

Re: Naming Groups

Post by Klaus » Sat Dec 26, 2015 12:12 pm

Hi A1Qicks,

always remember that Livecode is VERY english like, so:
...
create field "name of new field here" in group "your group here"
...
:D

Please also take a look at these stacks:
http://www.hyperactivesw.com/revscriptc ... ences.html
Very good learning resources!


Best

Klaus

A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Re: Naming Groups

Post by A1Qicks » Sat Dec 26, 2015 3:47 pm

Next stupid question - unrelated but I didn't think it warranted its own topic.

In putting text into something, how do you specific a line break?

e.g. I've currently got

put "<" && the text of field "nameField" && ">" && the text of field "textEntry" after field "displayMessage"

but I want it to put a line break before putting that as a new line.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Naming Groups

Post by bn » Sat Dec 26, 2015 5:09 pm

Hi A1Quicks,
put "<" && the text of field "nameField" && ">" && the text of field "textEntry" after field "displayMessage"
try "cr" or "return"

Code: Select all

put "<" && the text of field "nameField" && ">" && cr & the text of field "textEntry" after field "displayMessage"
Kind regards

Bernd

A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Re: Naming Groups

Post by A1Qicks » Sat Dec 26, 2015 7:37 pm

Perfect! Thanks.

Post Reply