Jump to content

[CR] Toolbar Class


Recommended Posts

index.php?app=downloads&module=display&section=screenshot&id=246

Name: Toolbar Class

Submitter: hooovahh

Submitted: 16 Jul 2014

Category: User Interface

LabVIEW Version: 2011

License Type: BSD (Most common)

Toolbar Class

Copyright © 2014, Brian Hoover (hooovahh)

Author:

Brian Hoover (hooovahh)

Environment Support:

LabVIEW 2011 and up

Windows only (likely XP and newer) due to .NET dependency

Description:

This is a toolbar class designed to make toolbars in the UI, which appear more like normal toolbars seen in Windows.

The idea for this came about because I wanted a way to make a simple toolbar, but didn't want to have to make all the button states for mouse not over, mouse over, mouse down. I just wanted to provide one PNG file for a button, and have it take care of how the button should look.

I also wanted a way to handle when there are more buttons than there is room for horizontally. When this happens I wanted a More Options button to appear which when clicked gives a vertical list of the remaining buttons, and a veritcial scrollbar if there are too many buttons to show vertically.

I also wanted support for basic veritcal and horizontal separators.

This toolbar class can do all these things, and all that is needed is to provide the buttons as PNG files with alpha layers. other file types like JPG, and BMP are supported but won't look as good just because buttons don't need to be a rectangle and can have soft edges. The Add Icon(s).vi is a polymorphic and also can add images from Image Data, or the native LabVEW picture data type. But these image types have the same issue mentioned with JPG and BMP that they don't support alpha layers.

Dependencies:

This relies on the following OpenG packages, a VIPC is included.

OpenG Error Library-4.2.0.23

OpenG Application Control Library-4.1.0.7

OpenG File Library-4.0.1.22

OpenG String Library-4.1.0.12

OpenG Array Library-4.1.1.14

OpenG LabVIEW Data Library-4.2.0.21

Installation and instructions:

At the moment this is not distributed as a package but just a zip with the required files in it. Install the OpenG packages required or install the Required Packages.vipc. Then run the Example Toolbar under the Example folder. This uses images from within the Example Images folder and must be in the same directory as the Example Toolbar.vi. There is also a Toolbar Tree.vi which shows the public functions as they could appear on the palette.

Distribution:

This code was downloaded from the LAVA Code Repository found at lavag.org

Click here to download this file

  • Like 2
Link to comment

The only bummer with this toolkit is that it requires a scripting node to get the picture's rectangle bounds.  Maybe there's another property that could be used instead that doesn't require scripting?

Oh I'm sure there is.  But why is that such a bummer?  What's wrong with using a scripting node?  It isn't a private function?  It is endorsed by NI with documentation.  I didn't see anything wrong with using it because of this.

Link to comment

Because I can't use it in my executables.

 

I have no idea which property is being used, but many scripting properties are available in the RTE, especially the read-only ones.  You should double check the detailed help to see if that property is available in the RTE.

Link to comment

The scripting function is the Master Bounds Rect on a picture control.  I have built executrices that use this and have had no problem.  And according to the help on this function it is available in the Run-Time Engine, and even the Real-Time OS which is a little odd but okay.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.