get the name of group from stack

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
klamp
Posts: 18
Joined: Sun Sep 20, 2020 10:36 am

get the name of group from stack

Post by klamp » Sat Mar 26, 2022 11:00 am

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
Attachments
groupname.zip
(800 Bytes) Downloaded 70 times

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

Re: get the name of group from stack

Post by Klaus » Sat Mar 26, 2022 11:09 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: get the name of group from stack

Post by richmond62 » Sat Mar 26, 2022 11:11 am

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 65 times
-

klamp
Posts: 18
Joined: Sun Sep 20, 2020 10:36 am

Re: get the name of group from stack

Post by klamp » Sat Mar 26, 2022 11:21 am

Thanks richmond62 and Klaus. its work :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: get the name of group from stack

Post by richmond62 » Sat Mar 26, 2022 11:40 am

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, . . .

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: get the name of group from stack

Post by richmond62 » Sat Mar 26, 2022 11:49 am

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?
Attachments
GET GUFF.livecode.zip
Stack.
(1.1 KiB) Downloaded 62 times

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

Re: get the name of group from stack

Post by Klaus » Sat Mar 26, 2022 12:06 pm

Or just:

Code: Select all

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

stam
Posts: 2635
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: get the name of group from stack

Post by stam » Sat Mar 26, 2022 1:17 pm

or

Code: Select all

the short name of the target

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

Re: get the name of group from stack

Post by Klaus » Sat Mar 26, 2022 1:22 pm

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.

stam
Posts: 2635
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: get the name of group from stack

Post by stam » Sat Mar 26, 2022 1:33 pm

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...

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: get the name of group from stack

Post by richmond62 » Sat Mar 26, 2022 4:31 pm

"Richmond's wishes", Ha, Ha, give me a break:

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”