The problem I am finding in all of this (whether I use JSON or even a database, I think) is that I have imported the 16x16 and 24x24 pngs into my Project (just like the sample project from Paul). Now when I save the iconName to either JSON or a database, it is a string. When I try to recreate the canvas object and use that string to create the actual icon, I get an error: Parameters are not compatible with this function". Now, I totally understand why I get that error, because I am supplying a string to a method that is expecting a Picture. But I don’t know how to supply a picture.
To get the error I am supplying this to the Method:
DrawingCanvas.RestoreObjects(699, 470, "garlic24", "Garlic")
It works OK if I supply this:
DrawingCanvas.RestoreObjects(699, 470, garlic24, "Garlic")
So I have to somehow store the “icon” as a Picture, or somehow Cast the String to a Picture.
This is the most complicated thing I have tried to do with Xojo, and I am afraid I am well past the extent of my knowledge.
I am thinking of the following:
I would still pass to the Method the picture as a string. In the Method I am going to try the following:
Select Case icon
Case "garlic24"
mIcon = garlic24
Case "cabbage24"
mIcon = cabbage24
....
End Select
Anyway, I will give it a try later (have to go out and vote in our General Election right now. If that doesn’t work, then I am not sure what will, but I am sure there must be a way to store to file an image that can then be recreated next time the app starts up.
Thanks for all the help - I am learning heaps.