03-21-2011 06:36 AM
I'm making some palette installers for ease of distribution for some libraries I have written. I'm following the example VIs (search the example finder for "palette API").
I'm having some frustration in setting the new palette icon; the icon constant is a 2d picture control but I can't find a way to drop my image into it, and I can't set it programatically as the 2d picture control VIs only allow me to draw shapes into it.
Solved! Go to Solution.
03-21-2011 09:41 AM
I've found I can import a bmp file and load it into a picture control, then convert the indicator into a constant. This is all a bit of a round about way, and I'm going to leave the question open if anybody knows of a more direct way.
03-21-2011 10:46 AM
You found the programatic approach.
If you just want to change it in the development environment (you will not want to hear this) just drag the imae ont othe FP from your browser.
Ben
03-21-2011 10:55 AM
That was the first thing I tried, but it just drops a picture down with all the functionality of a decoration. The picture control doesn't act like a drag-drop target.
03-21-2011 11:43 AM
In cases like this I often resort to using a transparent classic path as an overlay to catch dropped files. If you do not plan on interacting with the picture control, it is quite easy. Otherwise it is just a few more events to control visibility when the mouse enters the VI with the button pressed.
Just run the VI and drag PNG, JPG, or BMP files to the picture control.
03-21-2011 12:04 PM
Good thinking Darin, but that's still just adding unnecessary steps for what I want to do 😞
I just want the basic functionality for the picture control constant to be a drag/drop target.
03-21-2011 04:00 PM
Oh for a BD constant, a bit unusual, but just for the heck of it.
1) Unzip attachment and save to disk.
2) If you use LV10 open Picture Constant_Tree.vi or Mass Compile the directory.
3) Drag the Picture Constant.xnode file to your BD.
4) Drag a PNG/JPG/BMP file to the constant and enjoy the results
5) Right-click to 'Flatten' to a normal picture constant if you want to use the VI on a machine without this XNode.
6) If you like it, add Picture Constant.xnode to your Palette, just be sure to select all files so .xnode files are visible when adding a VI.
Still, don't you want your users to be mucking with the Front Panel and not the Block Diagram?
03-22-2011 05:31 AM
@Darin.K wrote:...Still, don't you want your users to be mucking with the Front Panel and not the Block Diagram?
I'm not worried about anyone playing with the FP or BD. It's just a dev tool for me. As I said earlier, I'm making some palette installers for sharing in-house libraries. The VI just copies the library/class files to user.lib and creates a .mnu file, and I was upset that there wasn't a simple way to drop an image into the palette icon constant.
Cheers Darin!
03-22-2011 11:16 AM
Glad it works for you, kind of addictive. I fixed a bug in the resize code, you can replace everything with the new zip file or just replace the OnResize file with the one attached below.
Someday I'll add the option to flatten to an image data cluster.
05-07-2011 02:33 AM - edited 05-07-2011 02:36 AM
I too find it puzzling. After placing the 2-D picture from the Graph->Controls->2D-Picture from the front panel control palette, how do to stick an image inside the 2D-picture box. For example 'Picture control zoom attibute.vi' that shipped with LV has 2d-picture box ( see the attached image of the FP) on the front panel with labview logo image. How did they insert that picture? I am sure it is something very trivial, but I couldn't figure out yet. Any cooment....
-Ravi