On May 5, 2006, at 7:50 PM, Brian Heibert wrote:

Hi,

I tried p.graphics = canvas1.backdrop
but I got Cannot assign a value to  this property
I don't know what to do to get it to work

If you are using Rb 2006, open the language reference. To do so, go to the Help menu and choose "Language Reference". You should practice doing this repeatedly until you are sure you know how to open the language reference.

Once you have opened the language reference, find the column called "Category". Read down until you see "Errors". Place the mouse cursor over this text, depress the mouse button and release it to click the hyperlink. Now look in the column called "Subcategory". Read down until you see "Error Messages". Click this hyperlink by using the mouse, as just described.

Now look into the third column, "Item". Read down until you see "Cannot Assign a Value to this Property". Click this hyperlink, again using the mouse as described above. The page that is then displayed in the window provides more explanation as to the meaning of the error message. Here, it says

"You tried to assign a value to a constant or other object type that does not accept a value."

Returning to your code, the conclusion is that either p.graphics is a constant, or p.graphics is something to which one cannot assign. So now return to the language reference. Remember that you can do so by selecting the Help menu and choosing "Language Reference". At the top of the language reference window is an edit field with caption "Location". Into this field, type "Picture.Graphics", then press the return key. You will learn that Picture.Graphics is a property.

There are only three sorts of things to which you can assign -- local variables, method parameters. and mutable (not read-only) properties (whether defined as actual properties, methods using Assigns, or computed properties). In your code, p.Graphics is not a local variable, and it is not a method parameter. It is a property. If it is mutable, then you should be able to assign to it. But you cannot, and the compiler is the final authority (which is not, by the way, the same as always being right). Therefore, p.Graphics must not be mutable.

So the documentation is wrong; it should have said that Picture.Graphics is read-only. But because you will know how to open the language reference and look up the meaning of an compiler error message if you practice what I have explained, you'll be able to figure this out for yourself.

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to