Stack Manager

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 239
Joined: Tue Jun 30, 2009 11:15 pm

Stack Manager

Post by SirWobbyTheFirst » Wed Jul 01, 2009 8:13 pm

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.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Thu Jul 02, 2009 6:22 am

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.

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

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 239
Joined: Tue Jun 30, 2009 11:15 pm

Thanks

Post by SirWobbyTheFirst » Thu Jul 02, 2009 9:09 am

Thanks Janschenkel, I hope this can help me.

Ps. Will it work for stacks which are opened but invisible?

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

Re: Thanks

Post by Klaus » Thu Jul 02, 2009 9:37 am

mickpitkin92 wrote:...Ps. Will it work for stacks which are opened but invisible?
Since computers do not have eyes like we do, the answer is YES :)

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 239
Joined: Tue Jun 30, 2009 11:15 pm

Post by SirWobbyTheFirst » Thu Jul 02, 2009 1:36 pm

Does a webcam not count? Lol :lol:

Anyways cheers for the help.

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

Post by Klaus » Thu Jul 02, 2009 6:40 pm

mickpitkin92 wrote:Does a webcam not count?
NO WAY, DUDE! :D

Post Reply

Return to “Off-Topic”