Crybaby Grows up

J. Landman Gay jacque at hyperactivesw.com
Fri Feb 27 16:35:11 EST 2009


DunbarX at aol.com wrote:
> So I was looking at the actual openstack handler, which was:
> 
> "insert the script of this stack into back" (also was "start using this 
> stack")
> 
> And thought I would change it to:
> 
> "insert the script of stack myStack into back"
> 
> Fixed. Done. And it all makes sense. I am relieved that it was me and not 
> Rev.

The "this stack" issue trips up everyone. In a multi-window environment, 
"this" stack isn't always what you think it is. If your script is in a 
topstack, it's often "this stack", only you can set the defaultstack 
property and then it isn't. If your stack is a palette, a lot of times 
"this stack" isn't the palette, it's the one that has focus (which is 
good, because that's how you make toolbars.) "This" stack can actually 
be just about any stack, depending on what the script is doing, the 
style of the stack the script is in, the mode of the stack, and probably 
some other stuff. Takes some getting used to, and even after you think 
you know it, it bites you when you aren't looking. I still get hit with 
it when I'm not paying attention.

> One MINUTE later Jackie writes with basically the same idea.

I'm always late to the party. :)

> Is there anything to discuss about why putting the msg stack script into 
> "back" is not a good idea?

Oh yeah, and all the other IDE stacks too. The message box has lots of 
specialized and snarly scripts in it (that's a technical term) that 
should only ever apply to itself. It has to do some work-arounds to 
interpret what you've typed so that the evaluation is in the right 
context and points to the right user stack. I assume that inserting it 
into the back could cause it to do it's little song and dance on every 
open stack, re-evaluating everything in it's own context, and leaving a 
wake of chaos. There be dragons. Don't go there...

For a generic stack utility, it's a good idea to just filter out and 
ignore any IDE stacks. Check to see if the first 3 characters of the 
stack name are "rev" and ignore those. For HC compatibility, three 
stacks don't start with "rev" so you have to check for those by name: 
"message box", "answer dialog", and "ask dialog". So:

  get the short name of the target -- presumably the stack
  if char 1 to 3 of it = "rev" or \
  it is among the items of "message box,answer dialog,ask dialog"
  then exit <handler>

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list