LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

use external image for tree icons

Hi all,

 

   having searched extensively with probably the wrong keywords, i'm hoping someone can point me in the right direction.

 

My app has a tree control that gets built by reading an Ini file, the icons get populated with custom images from a directory.  I'm trying to find a way to be able to interchange those icons after the executable has been built.  The current way that i put the icons in the tree is simplistic.  the names determine where in the tree they go... i.e. icon_1.jpg , icon_2.jpg , icon_3.jpg ...  become the first, second, and third icon.

 

i just don't want to have to rebuild the app every time a customer wants to replace the icons. 

 

any tips?  

 

thanks in advance! 

0 Kudos
Message 1 of 10
(3,973 Views)

Are you referring to the item symbols?

 

Look under the Invoke Node for the tree control.   There is a several methods associated with the custom symbol array.  I've never done it, so I don't know the exact steps.  But if you are able to load your pictures from your file, turn them into LabVIEW images, you should be able to use the invoke node to get and set each element of the custom symbol array.

0 Kudos
Message 2 of 10
(3,965 Views)

Thanks Raven Fan for the reply,

 

  I was in fact referring to the item symbols.  Sorry for the confusion.  

I don't have any problems loading custom images as my item symbols.  My app loops over the names of all the jpegs in a directory in alphabetical order, and loads them into the tree at runtime.  

 

What i'd like to do after the executable is built, is to swap those jpegs out so the next time the program ran, it loaded different item symbols into the tree.  

 

I don't have any experience with dll's and LabVIEW, and am ASSuming that's the route i'm going to be told to go...       Maybe i'm just not doing something right in the application builder.  Is there a way to externalize the directory where the jpegs are so it doesn't get compiled into the exe?

 

 

Below is an example of what i'm trying to convey...  

the blue flame would be named icon_1,  the truck is icon_2,  the cylinder is icon_3, etc.  i'd like to allow every customer to have the ability to customize the tree symbols to their own liking, without me having to swap the icons, and rebuild the .exe  

 

 forum tree.png

 

Thanks in advance!

  

0 Kudos
Message 3 of 10
(3,922 Views)

I'm curious as to how you are loading the custom item symbols now.  I haven't used trees, nor custom symbols, so I can't confirm how this would work.

 

But those property nodes should be able to do what you want.  This is how I think it should work:

 

1.  At the beginning of your program, you do whatever you need to to programmatically determine where to load the symbols from.

2.  Programmatically read the files using the picture VI's and load the image data into those property nodes.

3.  Continue with your program.

0 Kudos
Message 4 of 10
(3,915 Views)
Have you taken a look at the "Setting Custom Item Symbols" example that ships with LabVIEW? That reads a symbol from a file and loads it into the tree.
0 Kudos
Message 5 of 10
(3,906 Views)

I'm not very original,  I'm using a tree toolkit i found on LAVA written by Norm Kirchner. http://lavag.org/index.php?app=downloads&showfile=27
See the .zip at the bottom of the page, it has an example vi.
 
It does in fact use the "Read JPeg File" vi's.
 
You'll see in the "Load Symbols.vi" that it takes as input, a directory where your custom symbols are located.  Is there a way to keep this directory outside of the executable when the application builder compiles everything together....????   Like maybe in the /data directory?
 
I've only been using the app builder for a couple weeks so I'm not that sharp on those little nuances, but the more we hash this out, it seems like it should be possible.
 
 
 
 
 
 
Message Edited by joshuatree on 12-07-2009 11:18 AM
0 Kudos
Message 6 of 10
(3,902 Views)
Yes.  Just use that piece of code at the beginning of your program.
Message 7 of 10
(3,885 Views)
I was thinking you weren't understanding my problem, but now i'm with ya. :smileywink:  
(For future reference: simpletons require extremely explicit instructions :smileytongue:)
 
I put together a test project/app to play with, and it seems that i was doing something wrong between development and build regarding the paths.  In this test i used a path browser control instead of a constant and it correctly loaded the item symbols from a directory outside the executable. 
I'll attach the zip. (LV 8.5)
 
thanks for your patience. 

 

 

 

 

0 Kudos
Message 8 of 10
(3,865 Views)
It appears that you had this issue.
0 Kudos
Message 9 of 10
(3,858 Views)

yeah...   bitten by that one before.

 

this one was a little fuzzier in my tunnel vision mode.  After building my executable, i had this:

 

C:\build\MyApplication.exe\Application.vi

C:\build\MyApplication.exe\icons\

C:\build\MyApplication.exe\icons\icon_1

C:\build\MyApplication.exe\icons\icon_2

C:\build\MyApplication.exe\icons\icon_3 

 

What i really wanted was:

 

C:\build\MyApplication.exe

C:\build\icons\icon_1 

C:\build\icons\icon_2

C:\build\icons\icon_3 

 

So a combination of my project settings AND path problems. :smileymad:

 

 

 

 

0 Kudos
Message 10 of 10
(3,849 Views)