Re: Finding the main stack
I see what you mean about the target, confusion on my part. And thanks for the main(), definitely saves on typing. Pete Molly's Revenge http://www.mollysrevenge.com On Thu, Jul 7, 2011 at 10:02 PM, J. Landman Gay jac...@hyperactivesw.comwrote: On 7/7/11 10:44 PM, Pete wrote: I'm beginning to think the same thing. However the dictionary entry for the target says it resolves to the object that originally received the message and since the start using command came from the preOpenCard handler of a card in the application stack, I took that to mean the card that issued the start using command. The target is the object that receives the message, not the one that sent it. Your mainstack sent it; the library stack received it. I can easily get round this by calling the initialise handler from the original card immediately after the start using command - I was hoping to make things as simple as possible for the people who want to incorporate my library into their stacks but I guess one extra line of code is no big deal. The custom property holds a list of databases to be opened by the library. Some of us just put a function into the mainstack script. I use this all the time. I got the idea from Richard Gaskin: function main return the short name of me end main Then whenever you want to reference the mainstack, you just use main(). It also allows you to avoid structures like this in substacks: put the short name of (the mainstack of this stack) -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com __**_ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/**mailman/listinfo/use-livecodehttp://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Finding the main stack
Got a slightly convoluted situation where I need to get hold of the main stack for an application. When the app starts up, I issue a start using command to bring in my library handlers. I have a libraryStack handler which needs to get hold of the value of a custom property in the main stack of the handler that issued the start using command. I tried using me and the target but they return the main stack of the library stack, not the calling stack. Right now, I'm getting around this by getting hold of the mainstacks property, filtering out the rev stacks and my library stack and hope that the result leaves one stack - the calling stack. However, if there happens to be more than one application's stack in memory in the IDE, I end up with two or more stack names. Is there some way to discover the correct main stack in this situation? Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Finding the main stack
You could set a custom property in the library stack when it's brought into use. start using stack myLibStack set the cMainstack of stack myLibstack to the short name of me Terry... On 8/07/11 11:12 AM, Pete p...@mollysrevenge.com wrote: Got a slightly convoluted situation where I need to get hold of the main stack for an application. When the app starts up, I issue a start using command to bring in my library handlers. I have a libraryStack handler which needs to get hold of the value of a custom property in the main stack of the handler that issued the start using command. I tried using me and the target but they return the main stack of the library stack, not the calling stack. Right now, I'm getting around this by getting hold of the mainstacks property, filtering out the rev stacks and my library stack and hope that the result leaves one stack - the calling stack. However, if there happens to be more than one application's stack in memory in the IDE, I end up with two or more stack names. Is there some way to discover the correct main stack in this situation? Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Dr Terry Judd | Senior Lecturer in Medical Education Medical Education Unit Faculty of Medicine, Dentistry Health Sciences The University of Melbourne ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Finding the main stack
Is 'the effective filename of this stack' of any use? or the long id of this stack ? Jim Ault Las Vegas On Jul 7, 2011, at 6:12 PM, Pete wrote: Got a slightly convoluted situation where I need to get hold of the main stack for an application. When the app starts up, I issue a start using command to bring in my library handlers. I have a libraryStack handler which needs to get hold of the value of a custom property in the main stack of the handler that issued the start using command. I tried using me and the target but they return the main stack of the library stack, not the calling stack. Right now, I'm getting around this by getting hold of the mainstacks property, filtering out the rev stacks and my library stack and hope that the result leaves one stack - the calling stack. However, if there happens to be more than one application's stack in memory in the IDE, I end up with two or more stack names. Is there some way to discover the correct main stack in this situation? Pete Molly's Revenge http://www.mollysrevenge.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Finding the main stack
Pete- Thursday, July 7, 2011, 6:12:32 PM, you wrote: When the app starts up, I issue a start using command to bring in my library handlers. I have a libraryStack handler which needs to get hold of the value of a custom property in the main stack of the handler that issued the start using command. In that case, that sounds like the wrong architecture. My thinking is that a library stack shouldn't have to have a knowledge of the stack using it. Otherwise it might just as well be a substack of the mainstack, and then your troubles are over. Is there another paradigm you can use other than a custom property of the stack that uses the library? -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Finding the main stack
I'm beginning to think the same thing. However the dictionary entry for the target says it resolves to the object that originally received the message and since the start using command came from the preOpenCard handler of a card in the application stack, I took that to mean the card that issued the start using command. I can easily get round this by calling the initialise handler from the original card immediately after the start using command - I was hoping to make things as simple as possible for the people who want to incorporate my library into their stacks but I guess one extra line of code is no big deal. The custom property holds a list of databases to be opened by the library. Pete Molly's Revenge http://www.mollysrevenge.com On Thu, Jul 7, 2011 at 7:48 PM, Mark Wieder mwie...@ahsoftware.net wrote: Pete- Thursday, July 7, 2011, 6:12:32 PM, you wrote: When the app starts up, I issue a start using command to bring in my library handlers. I have a libraryStack handler which needs to get hold of the value of a custom property in the main stack of the handler that issued the start using command. In that case, that sounds like the wrong architecture. My thinking is that a library stack shouldn't have to have a knowledge of the stack using it. Otherwise it might just as well be a substack of the mainstack, and then your troubles are over. Is there another paradigm you can use other than a custom property of the stack that uses the library? -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Finding the main stack
On 7/7/11 10:44 PM, Pete wrote: I'm beginning to think the same thing. However the dictionary entry for the target says it resolves to the object that originally received the message and since the start using command came from the preOpenCard handler of a card in the application stack, I took that to mean the card that issued the start using command. The target is the object that receives the message, not the one that sent it. Your mainstack sent it; the library stack received it. I can easily get round this by calling the initialise handler from the original card immediately after the start using command - I was hoping to make things as simple as possible for the people who want to incorporate my library into their stacks but I guess one extra line of code is no big deal. The custom property holds a list of databases to be opened by the library. Some of us just put a function into the mainstack script. I use this all the time. I got the idea from Richard Gaskin: function main return the short name of me end main Then whenever you want to reference the mainstack, you just use main(). It also allows you to avoid structures like this in substacks: put the short name of (the mainstack of this stack) -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode