On Feb 18, 2006, at 11:22 AM, FreeFL wrote:

Hello!

I have a series of pictures, dropped in the project window so they are known to the app. I have a dictionary containing pairs of strings, the seconds being the _names_ of the aforesaid pictures. I want to assign these pictures to canvases, according to dictionary searches. I know how to retrieve correctly the _names_ of the desired pictures, but how do I tell the app that I want it to load the _pictures_ ? In another way, I would like to be able to write something like :
  thiscanvas.backdrop = Picture(thisname)
Maybe defining the dictionary a different way, maybe through some coercing method, I am lost in the wilderness...


Define a global Dictionary object PictureMap. Load this Dictionary at runtime --

For each PictureName
  PictureMap.Value("PictureName") = Picture
Next

Alternatively, move the pictures to a directory, and load them from disk at runtime. You could write a function like the following.

Function LoadPicture(pictureName as String) as Picture
If PictureDirectory <> nil and PictureDirectory.Child(pictureName) <> Nil then
    Return PictureDIrectory.Child(pictureName).OpenAsPicture
  Else
    Return nil
  End if
End Function

Inside this function you could add the ability to cache Picture objects once open.


--------------
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