Page 1 of 1

Naming Groups

Posted: Sat Dec 26, 2015 10:50 am
by A1Qicks
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?

Re: Naming Groups

Posted: Sat Dec 26, 2015 11:17 am
by Dixie

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

Re: Naming Groups

Posted: Sat Dec 26, 2015 11:22 am
by A1Qicks
Really? All I was missing was "of this card"? Damn.

Thanks Dixie!

Re: Naming Groups

Posted: Sat Dec 26, 2015 11:31 am
by Klaus
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

Re: Naming Groups

Posted: Sat Dec 26, 2015 11:39 am
by A1Qicks
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.

Re: Naming Groups

Posted: Sat Dec 26, 2015 12:12 pm
by Klaus
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

Re: Naming Groups

Posted: Sat Dec 26, 2015 3:47 pm
by A1Qicks
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.

Re: Naming Groups

Posted: Sat Dec 26, 2015 5:09 pm
by bn
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

Re: Naming Groups

Posted: Sat Dec 26, 2015 7:37 pm
by A1Qicks
Perfect! Thanks.