No such object error when object does exist

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dpatterson
Posts: 24
Joined: Wed Jan 18, 2017 5:38 pm

No such object error when object does exist

Post by dpatterson » Mon Feb 13, 2017 6:34 pm

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

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: No such object error when object does exist

Post by Klaus » Mon Feb 13, 2017 7:06 pm

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

dpatterson
Posts: 24
Joined: Wed Jan 18, 2017 5:38 pm

Re: No such object error when object does exist

Post by dpatterson » Mon Feb 13, 2017 9:53 pm

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

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: No such object error when object does exist

Post by Klaus » Mon Feb 13, 2017 11:18 pm

Hi David,

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


Best

Klaus

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”