I'm trying to create an addin which has some images as .png files. When I run the JSL files alone, these images are displayed without any problems. However, when I package the same files into an addin, JMP does not display the images.
I'm using the standard $ADDIN_HOME(addin.id)/image.png as the reference for the image, but there seems to be some problem in displaying the image.
Is there something more I need to do to get this to work in addins? I'm using the 'new image()' command to get the images into my output.
I have managed to get this to work by converting my images to character strings and then using the Char to Blob functions, but this strikes me as a workaround rather than being able to simply reference the image file using the ADDIN_HOME address.
What happens when you reference the image.png files using the $ADDIN_HOME path? Is there any error reported to the log?
If you look in the addin's home directory after you've installed it do you find the image.png file there?
All the image files go into the right place, and the script creates a space for the images to go but no image appears.
I have a thought that I may need to include the image reference as an expression rather than reference it directly and then ask the script to evaluate the expression.
I have a couple of other approaches to try and will update the message board as appropriate,
A bit more information:
The script with the image in it is called by another script in the addin using the 'Include' function - I don't know if that helps at all.
I get no error messages and there is nothing in the log to help either.
It all apparently works, but no image appears. I imagine that I'm missing something and would like to know what...
Did you get any error messages in the log window?
When you use the include function, does it reference the other script by the addin?
Try putting some debug print statements into your code around the image display. Or if you have JMP 10 you can use the new debugger.
I don't get any error messages.
I reference the other scripts by the addin_home, so I know that is working.
Thanks for the suggestion on debugging - I think you are right and this is something I need to do. I think it will form a part of the next iteration of work.
One further question would be what are the disadvantages of using the 'char to blob' approach apart from the fact that it is purely a workaround and not intelectually satisfying - does it use a whole bunch of memory that would otherwise be free? The character version of the image forms part of an expression - are these all held in memory or are they only called when required? My images are only small so I don't see that as a major problem, and I can put them all at the end of the script so that they don't cause a problem in editing.
By the way - I am not a programmer by training, so I may not make sense to people who actually know what they are talking about...
If you are running your add-in from a menu, did you uncheck the box "Use the Here namespace for unqualified JSL variable names"? If this box is checked, and you reference global variables without the "::" prefix, your code will not work. Happened to me a lot when I first started using add-ins.
Another simple debugging technique is to highlight sections of your JSL code and hit CTRL-R to execute it. That way you can quickly locate the trouble spot. If you hover your mouse over variable names their value will appear. Or you can highlight a variable name, hit CTRL-R and the variable's value will show up in the log window.