hooovahh Posted July 16, 2014 Report Share Posted July 16, 2014 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 2 Quote Link to comment
crossrulz Posted July 16, 2014 Report Share Posted July 16, 2014 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? Quote Link to comment
hooovahh Posted July 16, 2014 Author Report Share Posted July 16, 2014 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. Quote Link to comment
crossrulz Posted July 16, 2014 Report Share Posted July 16, 2014 But why is that such a bummer? Because I can't use it in my executables. Quote Link to comment
Darin Posted July 16, 2014 Report Share Posted July 16, 2014 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. Quote Link to comment
hooovahh Posted July 16, 2014 Author Report Share Posted July 16, 2014 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.