Jump to content


Photo
* * * * * 4 votes

Put your LabVIEW in the Tray -- Once and for all


  • Please log in to reply
23 replies to this topic

#1 Zerobite

Zerobite

    1 more post to go.

  • Members
  • 9 posts
  • Location:Denmark
  • Version:LabVIEW 8.6
  • Since:2004

Posted 30 March 2011 - 10:47 AM

*
POPULAR

Hi everyone

A couple of weeks ago i had the need to put a small suite of applications i made in the tray area, but the VIs i could find to do this wasn't really very intuitive or was lacking the functions i needed.

The solution?
Another one of these put-your-LabVIEW-app-in-the-tray toolsets .. but this time, a little better wrapped than the example code you can find on NI's site.. ;-) (no offense)
So here it is for you to evaluate .. it's not anything near final, and one can always find a number of small features lacking, but hey..it's event based, and its pretty easy to add more events if ever needed :-)

Notes:
Code is currently for LV8.6 and requires at least .NET Runtime 2.0, but i know for a fact that it runs on Win7 and LV2010..

Installation:
Unpack / Extract contained "Notify Icon" folder into your user.lib and refresh palettes or restart LabVIEW..

Examples:
Browse into your user.lib -> Notify Icon palette and drag the "NotifyIcon Class Example" VI to your block diagram (or open it by browsing into the "user.lib\Notify Icon\Example" folder)

License:
Since i made this code in my sparetime, but planned to be using it at work, i've made arrangements with the grand-old-boss and put a BSD License on it..

Feel free to send me any comments / questions AND bugfixes / error-reports

Thanks
Stinus

Well..since FF4 doesn't want to play nice.. here is the code uploaded using good old IE :-/

Attached Files



#2 hooovahh

hooovahh

    The 500 club

  • Members
  • PipPipPipPipPip
  • 809 posts
  • Version:LabVIEW 2011
  • Since:2004

Posted 30 March 2011 - 12:09 PM

Sweet, I'll definitely check it out. I've been interested in this kind of functionality for personal reasons and always wanted to spend time wrapping some VB code with LabVIEW to get the functionality I wanted.

"Maybe Hoovah is really Crelf's alter-ego, which he uses to irk people?" - Gary Rubin

"Seemingly minor changes....can mean the difference between a working app and a quivering heap of unresponsive code." - David Boyd


#3 hugo_fr

hugo_fr

    More Active

  • Members
  • PipPip
  • 28 posts
  • Location:Lyon (France)
  • Version:LabVIEW 2010
  • Since:1996

Posted 30 March 2011 - 12:14 PM

Nice work :thumbup1:


Hugo

#4 S59X

S59X

    Active

  • Members
  • Pip
  • 14 posts
  • Location:Slovenia
  • Version:LabVIEW 8.6
  • Since:1995

Posted 30 March 2011 - 12:59 PM

Very nice. I've been looking for this functionality also. Thank you for sharing this. Great! :thumbup1:

Mirko

#5 sachsm

sachsm

    Extremely Active

  • Premium Member
  • 288 posts
  • Location:Sarasota FL / Huntsville AL

Posted 30 March 2011 - 01:53 PM

Beautiful clean code, thanks for sharing!

#6 Zerobite

Zerobite

    1 more post to go.

  • Members
  • 9 posts
  • Location:Denmark
  • Version:LabVIEW 8.6
  • Since:2004

Posted 30 March 2011 - 03:43 PM

Thanks for the feedback and positive comments..
Hope you put it to some good use in those GUI's out there... :D

/ Zero

#7 crelf

crelf

    I'm a LAVA, not a fighter.

  • V I Engineering, Inc.
  • 5,748 posts
  • Version:LabVIEW 2012
  • Since:1993

Posted 02 May 2011 - 04:51 PM

License:
Since i made this code in my sparetime, but planned to be using it at work, i've made arrangements with the grand-old-boss and put a BSD License on it..

...and the community thanks you for it! :yes:

post-181-1170858537.png


#8 Omar Mussa

Omar Mussa

    Very Active

  • JKI
  • 253 posts
  • Version:LabVIEW 8.6
  • Since:1998

Posted 12 May 2011 - 11:10 PM

Your API is great, I just tried using it out and was impressed!

I have some feature requests that I think would make it even better (and these requests depend on the .NET API)"
  • If the clicked events could specify whether there was a right-mouse vs left-mouse click on a given menu/tray/balloon tip
  • If the balloon tip clicked event returned the balloon tip text
Thanks for your contribution to the community!

#9 Brinoceros

Brinoceros

    One hit wonder!

  • NI
  • 1 posts
  • Version:LabVIEW 2009
  • Since:2007

Posted 16 May 2011 - 06:11 PM

Looks Great!

I posted my own solution for this a little while ago:
NI Community: Icon in Windows system tray with LabVIEW

I'd love to hear some opinions comparing the two and offering suggestions. Maybe we can roll the best of each (assuming my solution has something worth keeping :cool:) into one great tool! It's obvious there's demand for this. I know a number of people have used what I posted, and can see the same thing here.

#10 Stobber

Stobber

    Very Active

  • Members
  • PipPipPip
  • 58 posts
  • Location:Austin, TX USA
  • Version:LabVIEW 2011
  • Since:2005

Posted 16 May 2011 - 08:16 PM

*
POPULAR

I posted my own solution for this a little while ago: NI Community: Icon in Windows system tray with LabVIEW I'd love to hear some opinions comparing the two and offering suggestions.


I used yours on a side project last week, and I have some things I'd like to change/add in that one. (I should note that it was very easy to use and worked flawlessly!)
  • The "Register LabVIEW User Events" function outputs an event registration refnum, which makes it impossible to register both NotifyIcon events and other user events on the same event handler. (Good ol' LV doesn't allow additional registration of new strict types on an existing event registration wire, and you can only create one dynamic registration terminal on an event structure so you only get to work with one wire.) So I broke out the user event refnum from your "Initial Event Registration" case and made an indicator from it. This lets me drop my own Register For Events node and wire as many types of user events to it as I like.

    Posted Image
  • As I mentioned on the NI Community page, the Disposed event doesn't fire the way I expect. Your proposed solution is to modify the order of things in the "Destroy" VI to call Dispose, then unregister the events, Of course, I'd rather handle event reg/unreg myself as explained in #1, so the real solution may be to have "Destroy" call Dispose, then exit, relying on the client to unregister events himself.
  • The menu for my application had a subset of selections that were mutually exclusive, so they basically had to act like a menu ring. I made a little FGV that wraps your API to provide that behavior for any subset of MenuItems. I've attached it in case you think it should be added to the API.
  • Using the name of the library to namespace the VIs is ghetto. :P Why not add them to an lvlib? There are few enough that load times and memory bloat won't be an issue.
  • I'd like to see this packaged as a VIP or OGP, instead of an unversioned ZIP file. I could help you get started with that, if you like. :)
  • Finally, I'd like to see that whatever blend of these two solutions we come up with is distributed on LAVAG with the BSD license, instead of NI Community with NI's very restrictive T&C.
All told, this is a great LV interface to some nice .NET functionality, and I'd love to see more things like it out in the world!

Attached Files



#11 dannyt

dannyt

    Extremely Active

  • Premium Member
  • 369 posts
  • Location:Devon UK
  • Version:LabVIEW 2011
  • Since:2007

Posted 17 May 2011 - 08:01 AM

That looks really sweet, I am now trying to think of a good excuse to use a tray icon in our project +1 from me

cheers

Dannyt

#12 Zerobite

Zerobite

    1 more post to go.

  • Members
  • 9 posts
  • Location:Denmark
  • Version:LabVIEW 8.6
  • Since:2004

Posted 17 May 2011 - 11:11 AM

Your API is great, I just tried using it out and was impressed!

I have some feature requests that I think would make it even better (and these requests depend on the .NET API)"

  • If the clicked events could specify whether there was a right-mouse vs left-mouse click on a given menu/tray/balloon tip
  • If the balloon tip clicked event returned the balloon tip text
Thanks for your contribution to the community!


Those are really good suggestions!
I actually already did some of the mouse-button stuff as an update to the existing version, and now that I'm not the only one missing this feature I'll probably get around to finish it! :lol:

At the same time I should probably also try putting this in a nice OpenG package as mentioned by Stobber..


Looks Great!

I posted my own solution for this a little while ago:
NI Community: Icon in Windows system tray with LabVIEW

I'd love to hear some opinions comparing the two and offering suggestions. Maybe we can roll the best of each (assuming my solution has something worth keeping :cool:) into one great tool! It's obvious there's demand for this. I know a number of people have used what I posted, and can see the same thing here.


Looks pretty interesting!..I'll definitely have a look at this tonight :yes:

#13 fabio

fabio

    One hit wonder!

  • Members
  • 1 posts
  • Version:LabVIEW 2010
  • Since:2009

Posted 17 May 2011 - 07:14 PM

good work :thumbup1:

#14 BrentonLang

BrentonLang

    More Active

  • Members
  • PipPip
  • 33 posts
  • Location:Brisbane, Australia
  • Version:LabVIEW 2011
  • Since:2008

Posted 25 July 2012 - 01:46 AM

This is great! I'll be adding this functionality in my current project. Thanks again.

#15 Bjarne Joergensen

Bjarne Joergensen

    Very Active

  • Members
  • PipPipPip
  • 89 posts
  • Version:LabVIEW 8.2
  • Since:1997

Posted 02 October 2012 - 01:01 PM

Hi

Use this in my new project now. So happy :yes: :thumbup1:

I would like to ask how you convert a image(jpeg, png, gif....) to the binary string? I have search but I didn't find a solution.

Thanks in advance.

Bjarne

#16 Zerobite

Zerobite

    1 more post to go.

  • Members
  • 9 posts
  • Location:Denmark
  • Version:LabVIEW 8.6
  • Since:2004

Posted 17 October 2012 - 05:42 AM

Hi Bjarne

Whenever I find myself in need of a new tray icon, I usually do a search on Iconarchive or Google using descriptive terms for the pictures I have in mind.
I then download the images or icon files I find interresting, or just the ones I think looks cool :D

If the file is an icon file I use an icon editor to remove icons bigger then 32x32px in the file (I stick with IcoFX v1.6.4 - mainly because its simple and doesn't have a trial timeout, newer versions do).
Also sometimes I use an old version of PaintShop Pro to apply transparancy to the image if it didn't exist already.

After that I just use the build in LabVIEW primitive "Read From Binary File" to read the file - that is, I create a new Untitled VI, insert the "Read From Binary File" function, wire the path input to a control, point it to the image file of your choice, wire a constant of -1 to the Count input (to have it read the whole file), and finally I create an indicator on the Data output terminal. Then I run the VI ;)

Once the file is read and the content is displayed in the front panel indicator I go to the block diagram and right click on the indicator terminal and do a 'Convert to Constant' on it. Be aware though, some resizing is probably required..

There you go..

Happy coding

#17 hooovahh

hooovahh

    The 500 club

  • Members
  • PipPipPipPipPip
  • 809 posts
  • Version:LabVIEW 2011
  • Since:2004

Posted 17 October 2012 - 12:44 PM

Whenever I find myself in need of a new tray icon, I usually do a search on Iconarchive or Google using descriptive terms for the pictures I have in mind.
I then download the images or icon files I find interresting, or just the ones I think looks cool :D

If the file is an icon file I use an icon editor to remove icons bigger then 32x32px in the file (I stick with IcoFX v1.6.4 - mainly because its simple and doesn't have a trial timeout, newer versions do).

Couple things. I have used Gimp in the past for icon file editing which supports transparencies and multiple icons (as layers) but does have limitations as far as usability to I may try IcoFX.

Another thing, which may be better in a new post, is what is the restrictions on using icons from sites like the one you posted? It has a "Commercial Icons" section which is where you need to pay to use the icons in a commercial application or website. I don't intend on using it for a commercial application, but a work related one. Does that mean I don't need to pay to legally use these icons? I'm sure most people would just grab images from a Google search and use them without thinking about it, and maybe I should too, but I am just curious about what is legal.

"Maybe Hoovah is really Crelf's alter-ego, which he uses to irk people?" - Gary Rubin

"Seemingly minor changes....can mean the difference between a working app and a quivering heap of unresponsive code." - David Boyd


#18 Zerobite

Zerobite

    1 more post to go.

  • Members
  • 9 posts
  • Location:Denmark
  • Version:LabVIEW 8.6
  • Since:2004

Posted 17 October 2012 - 05:30 PM

Another thing, which may be better in a new post, is what is the restrictions on using icons from sites like the one you posted? It has a "Commercial Icons" section which is where you need to pay to use the icons in a commercial application or website. I don't intend on using it for a commercial application, but a work related one. Does that mean I don't need to pay to legally use these icons? I'm sure most people would just grab images from a Google search and use them without thinking about it, and maybe I should too, but I am just curious about what is legal.


Of course you're right,..whenever you are using material that are widely available or easily downloadable, there's a potential risk that you're actually crossing the legal boundary, and
maybe without even knowing it. I for one don't really check if every little icon picture I download and use in my own programs at home, are protected or covered by some legal rights.

However, that doesn't mean that I totally disregard the fact that some rules do apply!
For instance, I always stick to the Icon packages that we have bought and payed for in the company, when I do software that will end up at a customers site somewhere!

#19 Bjarne Joergensen

Bjarne Joergensen

    Very Active

  • Members
  • PipPipPip
  • 89 posts
  • Version:LabVIEW 8.2
  • Since:1997

Posted 21 October 2012 - 02:56 PM

Thank you. It's working now :thumbup1:
I did try "Read from binary file" without success, but the pass through a icon editor did the job.

Regards Bjarne

#20 Bjarne Joergensen

Bjarne Joergensen

    Very Active

  • Members
  • PipPipPip
  • 89 posts
  • Version:LabVIEW 8.2
  • Since:1997

Posted 05 November 2012 - 11:48 AM

Hi


I got a new challenge :-)
I would like to password protect the possibility to open the program after it has been sent to tray.
I made a small password VI to popup when the user dobble click the tray icon, but I can't make the password VI to focus in the input control.
I have placed the VI before the functions that make the example visible and made at case around it to respond on correct password.

If i place the PW VI in the event case for ballon tip and press the show tip, the PW popup and focus in the input field.

I would appreciate i any one got clue what to do.

Thanks in advance.

Bjarne