Stack Manager
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 239
- Joined: Tue Jun 30, 2009 11:15 pm
Stack Manager
I've got a stack in the front scripts which has a PreOpenStack and CloseStack handler in it to update a list whenever a stack is opened and closed.
Trouble is i cant figure out how to get the name of the stack which is opened/closed. Can anyone help?
Btw. The stack is set to automatically pass the message once complete so the stack being opened/closed can perform its own tasks on those messages.
Any help would be much appreciated.
Trouble is i cant figure out how to get the name of the stack which is opened/closed. Can anyone help?
Btw. The stack is set to automatically pass the message once complete so the stack being opened/closed can perform its own tasks on those messages.
Any help would be much appreciated.
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Location: Aalst, Belgium
- Contact:
Look at the content of the long id of the target. In Rev's messaging system, the target is the original destination of the event message; in case of preOpenStack and closeStack messages, the current card of the target stack is the original destination; so we have to use the long id to extract the stack name.
Jan Schenkel.
Code: Select all
on preOpenStack
put StackNameFromLongId(the long id of the target) into tStackName
-- proceed as planned
pass preOpenStack
end preOpenStack
on closeStack
put StackNameFromLongId(the long id of the target) into tStackName
-- proceed as planned
pass closeStack
end closeStack
private function StackNameFromLongId pLongId
-- determine where the 'stack "TheStackName"' part begins
put wordOffset("stack", pLongId) into tWordOffset
-- we only care about the name of the stack, so get the next word
put word tWordOffset + 1 of pLongId into tStackName
-- now get rid of the leading and trailing quote
return char 2 to -2 of tStackName
end StackNameFromLongId
Last edited by Janschenkel on Thu Jul 02, 2009 9:18 pm, edited 1 time in total.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- VIP Livecode Opensource Backer
- Posts: 239
- Joined: Tue Jun 30, 2009 11:15 pm
Thanks
Thanks Janschenkel, I hope this can help me.
Ps. Will it work for stacks which are opened but invisible?
Ps. Will it work for stacks which are opened but invisible?
Re: Thanks
Since computers do not have eyes like we do, the answer is YESmickpitkin92 wrote:...Ps. Will it work for stacks which are opened but invisible?
-
- VIP Livecode Opensource Backer
- Posts: 239
- Joined: Tue Jun 30, 2009 11:15 pm