Posted by: Paul Lefebvre
I have a lot of icons in PNG format with built in masks that I like to use in my toolbars. Although REALbasic loads the pictures fine with FolderItem.OpenAsPicture, it doesn’t load the mask, so I use the free PNG Utilities plug-in instead.
One annoyance I’ve had with this is that the PNG files need to be loaded at run-time. Dragging them into the project didn’t work; REALbasic would convert them and lose the mask. But it turns out there is a trick, posted to the REALbasic NUG mailing list by none other than Frank Condello, author of PNG Utilities. The trick is to rename your PNG files so that they don’t have a PNG extension (I used PNGDAT). Then you can drag them into your project; REALbasic will just import them as binary strings.
From there you can use the PNGu.GetPictureWithMask(name) method to convert the string into a picture object that you can then use with the toolbar. Perfect!


You might also need to remove any OS X Creator Type Codes from the file.