Page 1 of 1

No such object error when object does exist

Posted: Mon Feb 13, 2017 6:34 pm
by dpatterson
Okay. I have an openCard handler that references a data grid successfully on one line and then fails a few lines later with:

Code: Select all

card "cvList": execution error at line 63 (Chunk: no such object), char 7

Code: Select all

on openCard
  local tmp
  
  logDebug( "me: " & name of me )
  logDebug( the dgData of group "cvGrid" of me )            -- Formats and displays the array in a scrolling field - Successful!
  
  put field "whichList" of me into tmp
  put toUpper( char 1 of tmp ) into char 1 of tmp
  set the title of this stack to "Inventory - " & tmp
  put empty into char -1 of tmp
  put "New " & tmp into line 1 of button "File" of group "cvMenuBar" of me

  if( the dgData of group "cvGrid" of me is empty ) or \    -- This line fails (line 63).
        ( field "whichList" <> CurrentList ) then
    loadDatagrid
  end if
end openCard
I have copied the reference from the functional line to the failing line just to make sure that there isn't some strange typo. No joy.
I am at a loss.
Suggestions?

Thanks in advance.
Dave

Re: No such object error when object does exist

Posted: Mon Feb 13, 2017 7:06 pm
by Klaus
Hi Dave,

quick shot in the dark:
What happens if you leave out all the "of me" in your script?
They are really not neccessary!


Best

Klaus

Re: No such object error when object does exist

Posted: Mon Feb 13, 2017 9:53 pm
by dpatterson
Klaus,

Actually, I had to add them because the menu handling code that results in this card being opened is in another card's script. Leaving them out resulted in "no such object" errors.

Since you said I didn't really need them, the next question was "Well then, why do I need them?"
Backtracking all the way to the original menuPick handler, I found it.

I had an explicit 'dispatch "openCard" to card "cvList"' in the menuPick handler of the active card (I think it was left over from when the "cvList" card was part of a sub-stack.)
Removing that solved the problem.

So, thanks very much for sending me off in the correct direction.

Note to self: When observing odd behaviors in handlers, back-trace to the "entry point".

Thanks,
Dave

Re: No such object error when object does exist

Posted: Mon Feb 13, 2017 11:18 pm
by Klaus
Hi David,

glad I could help, even in mysterious ways... :D


Best

Klaus