I have added images to my project and used as backgrounds for a window… that is done at design time.
How do I access an image inside my project and use it in printing?
I know how to read a .jpg from a folder on the hard drive.
What is the “path” inside the project?
I’d rather store the images inside the project and access them there than have to install them somewhere on the hard drive and hope they stay in place.
Pictures that you dragged into the IDE can be accessed by whatever you named them in the IDE.
As for not having to install them, for quite some time now Xojo hasn’t embedded images inside the executables on Windows, and you can find the images in the [MyApp Resources] folder.
So if I open a file using no path at all but the name of the file like “someimage.jpg”
then it will work automagically on Mac but on Windows we have to add the path to the My App Resources folder?
And if so what is that path?
If you dragged the image in to the IDE you would reference it as the object name in the IDE.
I’m not quite sure how much more clear I can make that.
You would reference it like any other object in the Navigator.
So much the way you can dim w as new MainWindow you can use dim p as picture = cover_page, and even then you don’t have to do that much because cover_page is already a picture object.
This only applies to images you dragged into the project. Items added via a Copy Files step you must access using the file path, in which case as Michel linked, I would recommend the TPSF module. https://github.com/devtimi/TPSF