Reference to External Image

In earlier versions of Xojo, I used to be able to drag and drop a vector PDF image file into the IDE in order to create an external reference to that file that would automatically bundle it with my app and provide the path as constant in order to reference that bundled file.

This was convenient when using the NSImageMBS constructor that uses a file path as the parameter because I could pass the constant the Xojo provided in order to construct the image.

In 2020 R2.1, the IDE is trying to be smart about things and is interpreting my vector PDF as a raster image and creating an image object instead of a reference to the external file.

Is there any workaround to this functionality?
I know that I can use the copy files step to in order to bundle the PDF in the resources folder, but since that is slightly less convenient I just wanted to make sure that I wasn’t missing another way of forcing the IDE to create an external reference.

Thanks for the help.

We didn’t change how the IDE behaves in this regard. Did anything else change on your system recently… like an OS upgrade?

Here is a video demonstrating the different functionality between fresh downloads of 2019r1.1 and 2020r2.0

This is on macOS 10.14.6

The same thing happens in r2.1
I just forgot that I was on the archive page when I was downloading 2020.

Have you tried to remove the file ending of the pdf file? That way the file isn’t interpreted as picture. You should still do a Feedback report, though.

I have tried that with the same results.

Interestingly enough, I even converted it into a txt file and it still read it as image data.
The file header doesn’t lie :slight_smile:

Xojo2019r3.1 does the same as Xojo2020r2.1. I don’t have Xojo2019r2.1 but my guess is that will behave the same as later Xojo versions.

Well, that probably explains it then. In 2019r2, we updated the underlying API that we were using for folderitem. I suspect that the newer api is trying to be “Helpful”.

1 Like

Instead of dragging it into your project, could you instead use a CopyFiles build step and then just use a binarystream to read the file?

I could definitely use CopyFiles. The drag and drop was just convenient for the name constant and organization of icon files in the IDE.

I did figure out a workaround though.

If I create a zero byte file with the same name as the PDF and drag that into the IDE, it will create an external reference. Then I can overwrite the zero byte file with the real PDF and the path will still resolve.

1 Like

@Jared_Feder you contributed to a thread on using a barcode scanner on MacOS. There was a .rpb file shared by someone for scanner GoDEX GS550. You said it helped you find a solution for your Symbol LS2208. I have the exact problem trying to connect a USB barcode scanner LS2208 and I was wondering if you might be able to share your .rpb file or MacOS package to allow the barcode scanner to work.

Hi Elliott,

Here is a sample project for connecting to a Symbol LS2208 that is programmed in IBM Hand-Held USB mode.

https://www.dropbox.com/s/9knizi1go5jk4lz/Serial%20Scanner%20Connection.xojo_binary_project?dl=1

It does, however, use Monkeybread plugins, so it won’t work without those.