Select Group

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Select Group

Post by Klaus » Fri May 04, 2018 11:32 am

Hi jwtea,
jwtea wrote:
Fri May 04, 2018 11:24 am
Hello Klaus , thanks for your help! Now my group got each and special unique name.
great!
jwtea wrote:
Fri May 04, 2018 11:24 am
But i still can't get this to work after typing the code provided by Craig. Any idea why??

Code: Select all

on mouseUp
put word 2 of the short name of the target into tNumber
put field "uniqueNumberField" && tNumber into field "holding field"
end mouseUp
So far you only renamed your GROUPS but not the object inside of it, right?

You should check "the short name of the owner of the target".
If it begins with "userbox" then extract word 2 of it and you have the number you want.

Code: Select all

on mouseUp
   put the short name of the owner of the target into tGoup
   if word 1 of tGroup = "userbox" then
     put word 2 of tGroup into THE_DESIRED_NUMBER
     ## now do whatever you have to do with THE_DESIRED_NUMBER :-)
   end if
end mouseUp
Hope I understood you correctly!


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Select Group

Post by jacque » Fri May 04, 2018 6:25 pm

I think in this case it would be cleaner to just set a custom property on each group and retrieve that as needed. That way the names of the controls don't matter. But maybe custom properties aren't the easiest to understand for new users.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Select Group

Post by jmburnod » Fri May 04, 2018 6:48 pm

maybe custom properties aren't the easiest to understand for new users.
yes and discover custom properties in same time.
Jean-Marc
https://alternatic.ch

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Select Group

Post by jacque » Fri May 04, 2018 8:51 pm

Well, just in case the OP wants a challenge, the handler could do this:

Code: Select all

...
 if tArray["users"][myID1]["email"] is not empty then
    ## copy group "usersbox"
    ## paste group
    clone group "usersbox"
    set the cNum of IT to myVar
    move it to myPosition1 , myPosition2 in timing second
...
And then whenever the number is required:

Code: Select all

put the cNum of the owner of the target into tNum -- and do whatever you need with the tNum variable
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jwtea
Posts: 66
Joined: Fri Mar 23, 2018 2:01 am

Re: Select Group

Post by jwtea » Mon May 07, 2018 2:33 am

Hello Klaus, thanks for your time :D
Klaus wrote:
Fri May 04, 2018 11:32 am
You should check "the short name of the owner of the target".
If it begins with "userbox" then extract word 2 of it and you have the number you want.

After typing your code, the function can't seem to work ~ ~
There is no value display in my field.

What i want is if i click on any of the group , one of the value inside the group will be display into my field.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Select Group

Post by jmburnod » Mon May 07, 2018 10:26 am

Hi
What do you get when you insert this line in your script

Code: Select all

Answer the short name of the owner of the target
Best regards
Jean-Marc
https://alternatic.ch

jwtea
Posts: 66
Joined: Fri Mar 23, 2018 2:01 am

Re: Select Group

Post by jwtea » Tue May 08, 2018 1:47 am

Hello all!

Thanks for all your responsive help! What i did, i just took all of the solution provided to me and modify some of the code to make the desired outcome i want!!

Very grateful for the Livecode Community :D

Post Reply

Return to “Talking LiveCode”