script scope variables inexplicably becoming unset

Dr. Hawkins dochawk at gmail.com
Wed Dec 31 11:36:07 EST 2014


On Tue, Dec 30, 2014 at 11:22 AM, Peter Haworth <pete at lcsql.com> wrote:

> Your code refers to chstk in one place and chcStk  in another.
>

chcStk is a custom property telling whether to use the default pallet or
another field; chStck holds the result of that.

Overall, it appears I'm being bitten by *Bug 10862*
<http://quality.runrev.com/show_bug.cgi?id=10862> - While debugging
selectedChunk points to the script editor--which is over eight months old,
confirmed and acknowledged, and unfixed.

The parentheses fixed *that* problem.  But I'm still struggling to delete
the text and then process.

I'm trying triggering my behavior on textChanged--which let me pull a few
handlers and not try to handle deletion of selected text and backspace.
(This field isn't all that different than the recent typingFilter stack,
accomplishing similar purposes)

Now, though, with it all cleaned up, I've added the test a second time,
with the side-effect code gone.  The chcStk of me is "true" when this
happens, and the handler begins with the value "field 1 of stack dna"--but
that value is never used, just cjeckdd for empty:

on shwChcStk
   --ck "chstk: _" & chStk  & "_; " & cr & (chStk is empty )
   if chStk is empty then
      --debug only; this happens in the debugger.
      answer "chStk empty"
      breakpoint
      initCtr
   end if

   if the chcStk of me then
      if word 2 of chStk is not among the lines of the openStacks then
         lock messages --chStk becomes unset during openstack!
         palette chStk
         unlock messages
      end if
      if chStk is empty then
         --debug only; this happens in the debugger.
         answer "chStk empty"
         breakpoint
         initCtr
      end if

The *second* "if chStk" test triggers;  somehow, chStk changes from a value
to empty about where the palette opens, even with messages locked--unless
I'm in the debugger, in which case the value remains the same.
-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462



More information about the use-livecode mailing list