Page 2 of 2

Re: Select Group

Posted: Fri May 04, 2018 11:32 am
by Klaus
Hi jwtea,
jwtea wrote: Fri May 04, 2018 11:24 amHello 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

Re: Select Group

Posted: Fri May 04, 2018 6:25 pm
by jacque
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.

Re: Select Group

Posted: Fri May 04, 2018 6:48 pm
by jmburnod
maybe custom properties aren't the easiest to understand for new users.
yes and discover custom properties in same time.
Jean-Marc

Re: Select Group

Posted: Fri May 04, 2018 8:51 pm
by jacque
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

Re: Select Group

Posted: Mon May 07, 2018 2:33 am
by jwtea
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.

Re: Select Group

Posted: Mon May 07, 2018 10:26 am
by jmburnod
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

Re: Select Group

Posted: Tue May 08, 2018 1:47 am
by jwtea
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