[NTLK] ReadOnly error -48214

From: Tom McDougal (tmcdougal_at_newted.org)
Date: Fri May 30 2003 - 13:34:05 PDT


(My first NewtonScript question.)

I'm getting an error, "Object is Read-Only" which is exposing a
fundamental confusion I have about protos and instantiation.

I found a posting from a year ago about this error, with responses by
Laurent and Steve Weyer. The gist of their diagnosis is that it comes
from trying to set a slot of a proto instead of setting the slot in
an instantiated frame.

I don't understand why this is happening. According to _The
NewtonScript Programming Language_:

   "2. If the slot exists in the prototype chain
       of the current frame, a new slot is made in
       the currently executing frame and its value
       is set there."

Granted, in my situation there is a layering of protos:
    protoA (derived from clView)
      contains [subview1, subview2]
where each of the subviews is of class protoB (derived from textButton).

The proto definition for View1 includes code like this in its
viewSetupDone script:
     foreach x in stepChildren do // the copies of protoB
        x.foo := "hello";

This fails (Object is Read-Only, -48214).

Slot 'foo is defined in protoB. I have also tried explicitly adding
it to the subviews.

Sorry to be so verbose.

-Tom

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
List FAQ/Etiquette/Terms: http://www.newtontalk.net/faq.html
Official Newton FAQ: http://www.chuma.org/newton/faq/


This archive was generated by hypermail 2.1.5 : Fri May 30 2003 - 14:00:01 PDT