LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set 2d picture control image

Solved!
Go to solution

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.

_____________________________
- Cheers, Ed
0 Kudos
Message 1 of 10
(11,837 Views)

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.

 

get image.png

_____________________________
- Cheers, Ed
0 Kudos
Message 2 of 10
(11,816 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 10
(11,804 Views)

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.

_____________________________
- Cheers, Ed
0 Kudos
Message 4 of 10
(11,801 Views)

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.

 

DragToPictureFP.PNG

 

DragToPicture.png

 

Just run the VI and drag PNG, JPG, or BMP files to the picture control.

0 Kudos
Message 5 of 10
(11,792 Views)

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.

 

set palette icon.png

_____________________________
- Cheers, Ed
0 Kudos
Message 6 of 10
(11,786 Views)
Solution
Accepted by topic author yenknip

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?

Message 7 of 10
(11,773 Views)

 


@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!

 

_____________________________
- Cheers, Ed
0 Kudos
Message 8 of 10
(11,748 Views)

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.

 

 

Download All
Message 9 of 10
(11,730 Views)

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

 

 

0 Kudos
Message 10 of 10
(11,620 Views)