re; weird behavior

Richard Gaskin ambassador at fourthworld.com
Sun Feb 24 11:57:22 CST 2008


rand valentine wrote:
>>  I'm using Studio version 2.8.1 on an intel Mac running Leopard (10.5.2).
>> Also running Galaxy and GL2. I'm getting weird behavior that I don't
>> understand. An object is recognized for some things but not others. For
>> example, in the following script, which simply clears a field:
>> 
>> ON mouseUp
>>     IF fld "notes_note" is not empty THEN
>>         answer "Really clear?" with "Cancel" OR "Yes"
>>         IF it is "Yes" THEN
>>             put empty into fld "notes_note" -- "notes_note"
>>         END IF
>>     ELSE
>>         answer "The note field is already empty."
>>     END IF
>> END mouseUp
>> 
>>  In running the script, field "notes_note" is recognized in the IF
>> statement, but I get an error message "Chunk: no such object" when I run the
>> script, at the line that says "put empty into fld "notes_note". Anyone know
>> what's up? It seems to happen when I put a field into a group, more than at
>> other times.
> 
> I remember seeing some discussion of circumstances in which the ask and
> answer dialogs would alter the execution context, resulting in the
> symptoms you describe.
> 
> Whether that's happening here I can't say; I don't recall the specifics.
> 
> Anyone here know more about the ask/answer context issue, and whether
> that may be the culprit here?
> 
> -- 
> 
>  Yes, if I remove the answer dialogue, then the script runs just fine. How
> does one get around this bug?

For now:

     put the defaultStack into tSaveStack
     answer "Really clear?" with "Cancel" OR "Yes"
     put it into tVal
     set the defaultStack to tSaveStack
     IF tVal is "Yes" THEN
         put empty into fld "notes_note" -- "notes_note"
     END IF


For all mankind:

It's really kinda dumb if we need to save and restore the defaultStack 
for ask/answer dialogs.  Does anyone here know the RQQC# for this issue, 
and has it been confirmed fixed as of v2.9DP4?


-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list