The error codes are telling you what you want to know. A picture object needs a picture. I don;t know what you are expecting from 500, 500. I guess those are the .top and .left properties of your picture object, but they don’t define a picture.
You don’t. Unless you purchase the Formatted Text Control from BKeeney or some other canvas-based editfield control which will allow that. Use a canvas to hold your properly defined picture.
I think the question should be, why does a picture property allow you to enter a default value in the inspector pane of the IDE.
I think the answer is, the default field is there for properties that can be assigned a default value with a string, constant or expression, such as a string, integer, double or color. The field should be hidden or disabled for other property types, but alas, it is not. (Unless there really is some special purpose that I am unaware of)
You can set the value of the picture property in the constructor or open event of the window.
I certainly was bad to explain what I wanted and the fact I was not able to display the image in my original post may not add to clarity.
So, use cmd-P to add a new Property, then type a Property Name, Fill the Property Type (Picture) and then you are in the Default area I was talking to.
Because that field hold text, I was searching what to give it, so my use of “500”. It was only at the third try (500) that I got the correct error message.
Also, I do not understand what / how “Formatted Text Control” comes into this conversation about the creation of a Property in Window1.
At last, you are right, I use Xojo 2013r4.1: no EditField there. And I never talked about Canvas Class nor TextField (and Childs) Class
Sorry for the mistake, thank you for taking time to answer.
A Picture is a an object - thus a variable declared as a Picture has a default value of “nil” - meaning no object assigned.
Same holds true, for example, for the Dictionary class. I often forget to initialize it. What you could do: Create a computed property, and in the getter first check if it is available. If it is - return it - if not: create it first and then return it.
And my answer is that you cannot. I was attempting to tell you other ways to display an image. The FTC WILL allow you to display a picture within a textArea. As an alternative, you can use a canvas.
Secondly, this is a Property. Type cmd-option-P to create one, then fill the following fields:
Name:
Type:
Default :
Scope:
The whole question is around the Default field. As far as I understand it (after a bad night) is: you have to place a constant in that field. That constant have to hold a Picture. The question relates to that: how can I set a constant to a Picture so I can put it there (in the Default field of the Property).
Also, I do not found a description for that in the Docs.
I’m pretty sure that you can’t assign a default value to a picture property. It always starts as nil. You can assign a default value to a number or string or boolean using a constant with the &…but that doesn’t work for pictures. I think the Default field should be disabled for types that can’t be assigned a default value. I would call it an oversight… maybe start a bug report/ feature request.
You can’t assign a default value for a property where the data type is Object or subclass thereof. You can assign Nil, but this is the default value anyway for such properties, so you best leave it empty.