Aborting substack opening from within preOpenStack?

Paul Hibbert lc at pbh.on-rev.com
Fri Apr 12 18:38:00 EDT 2013


Sorry, I read through the OP too quickly!

For Richard's case splitting the check between preOpenStack and openStack should work, this is what I tested…

== subStack script ==

local sCondition

on preOpenStack
   put the hilite of btn "badCondition" of stack "stack_1" into sCondition -- Just the button used for testing
   if sCondition then
      answer "You can't do this yet because blah blah blah!"
      set the visible of this stack to false -- Avoids a flash of the stack showing
   end if
end preOpenStack

on openStack
   if sCondition then
   close this stack -- Closes the stack
   exit openStack -- Aborts the openStack handler
   end if
   ## Continue openStack
   set the visible of this stack to true
   answer "SubStack is open"
end openStack

HTH

Paul

On 2013-04-12, at 12:55 PM, Graham Samuel wrote:

> You can't quit just from a substack (the whole app quits), so if you just want a substack to close without the whole app closing, I think the trick is to make sure it isn't running first: I am having lots of problems with this too, and despite advice from Jacque Gay I have not really cracked it. But as an experiment, put a button in a different stack from the one you want to close, with a script that does the close, and I think it will work. If you want something that's fired from within the substack, I think you have to do something like
> 
> send "closeFromOtherStack" to stack "otherStack" in 0
> 
> This allows your substack to quiesce and then it will close. I may have got this wrong, but I think it's a pointer. There is not much I can find in the LC documentation about this.
> 
> To exactly copy the IDE's ability to close a stack and remove it from memory is far from straightforward, IMHO.
> 
> Graham
> 
> On 12 Apr 2013, at 20:00, Paul Hibbert wrote:
> 
>> Richard, 
>> 
>> Try changing "close this stack" to "Quit" - it worked for me!
>> 
>> Paul
>> 
>> 
>> On 2013-04-12, at 9:29 AM, Dr. Hawkins wrote:
>> 
>>> When some of my substacks are called to open, I need to check that
>>> conditions are ready.
>>> 
>>> so
>>> 
>>> if badCondition then
>>> answer "You can't do this yet because blah blah blah!"
>>> close this stack
>>> end if
>>> 
>>> 
>>> But this doesn't seem to stop openStack from getting called; I thought it
>>> did.
>>> 
>>> How do I cause the entire stack opening to abort from within preOpenStack?
>>> 
>>> And on that line, I'm tracking a bug that is messing with opening a card
>>> with a datagrid.  Apparently my grey column problem is linked to a livecode
>>> supplied script that tries to "set the text of me to empty", but I don't
>>> have it cornered yet.  But these seme related.
>>> 
>>> -- 
>>> Dr. Richard E. Hawkins, Esq.
>>> (702) 508-8462
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at 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 at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list