Page 1 of 1

get the name of group from stack

Posted: Sat Mar 26, 2022 11:00 am
by klamp
how do i get the group name when doing mouseup event.

when i put my script in group, i get the group name

Code: Select all

on mouseUp
   answer the name of me
end mouseUp
I want to put the script in the stack. Thanks

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 11:09 am
by Klaus
Hi klamp,

put this into the stackscript:

Code: Select all

on mouseUp
   answer the name of the owner of the target
end mouseUp  
Best

Klaus

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 11:11 am
by richmond62
Not very difficult. 8)
-
SShot 2022-03-26 at 12.09.36.png
-
SShot 2022-03-26 at 12.10.05.png
-
Groupies.livecode.zip
(945 Bytes) Downloaded 127 times
-

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 11:21 am
by klamp
Thanks richmond62 and Klaus. its work :D

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 11:40 am
by richmond62
Yes: but now I have a question:

For instance, if I have this in the stackScript:

Code: Select all

on mouseUp
   put the ID of the target
end mouseUp
It gives me a number (well, that is what I asked for).

But I would also like to find out WHAT type of thing I clicked on:

card, button, field, . . .

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 11:49 am
by richmond62
I love answering my own questions

(it's an EGO thing):

Code: Select all

on mouseUp
   get the name of the target
   set the itemDelimiter to " "
   put it into DETAILS
   put item 1 of DETAILS
end mouseUp
-
SShot 2022-03-26 at 12.47.57.png
-
That does not work with the FIELD or with the GROUP for some reason.

Klaus?

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 12:06 pm
by Klaus
Or just:

Code: Select all

...
put word 1 of the name of the target
...

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 1:17 pm
by stam
or

Code: Select all

the short name of the target

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 1:22 pm
by Klaus
stam wrote:
Sat Mar 26, 2022 1:17 pm
or

Code: Select all

the short name of the target
Richmond wants to know the TYPE of the control.

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 1:33 pm
by stam
but not sure why the need to use the target

if i group 2 buttons together and name the group 'buttonGroup' and edit the group's script to

Code: Select all

on mouseUp
    answer the short name of me
    pass mouseUp
end mouseUp
it answers 'buttonGroup'

Klaus wrote:
Sat Mar 26, 2022 1:22 pm
Richmond wants to know the TYPE of the control.
My bad... i was answering the original poster's question:
klamp wrote:
Sat Mar 26, 2022 11:00 am
how do i get the group name when doing mouseup event.
but then i noticed this as well from the OP:
klamp wrote:
Sat Mar 26, 2022 11:00 am
I want to put the script in the stack. Thanks
For that to work you'd need to use 'the target' AND either not implement any mouseUp handlers in the specific message path or have them 'pass mouseUp' if any component does have a mouseUp handler.
Again no relevance to Richmond's wishes.

On that note i do use the long id and the long name quite frequently. Not only does word 1 give you the type, but if you also set the itemDelimiter to " of " (with spaces), item -2 gives you the card name and item -1 gives you the stack name. Quite handy...

Re: get the name of group from stack

Posted: Sat Mar 26, 2022 4:31 pm
by richmond62
"Richmond's wishes", Ha, Ha, give me a break:

"Richmond's sh*t-stirring musings" more like: dead time
on Saturday morning . . . :shock: