Jump to content
Sign in to follow this  
Mark Balla

Share your favorite User lib Vis

Recommended Posts

Another useful tool when building a user interface was given to me by njkirchner.

The propose is to put a Front Panel in it correct position at run time.

The steps to use it are as follows

Position the Parent VI in the desired runtime position.

Place the FP size and position vi on the block diagram.

post-584-1140327646.png?width=400

Next open the FP size and position vi and click on the Set Values button.

post-584-1140327802.png?width=400

Now run the Parent vi and stop it.

The position values with be filled in and the Set Value button will be set to false.

Create constants on each of the position inputs.

post-584-1140328069.png?width=400

Set the Move Window input true if desired

post-584-1140328299.png?width=400

Finally if you move the front panel of the Parent to a new location it will always come back to the same spot at runtime.

post-584-1140327992.png?width=400

Download File:post-584-1140328475.llb

Share this post


Link to post
Share on other sites

I also have a loop utility called LoopContinue that determines if the while loop it is enclosed into should continue or not. The different instances communicate with a notifier so many or all parallel loops can be notified to stop simultaneously. For UI VIs it also has an option to open the FP on first iteration, close it on last iteration and terminate the loop when the FP is closed.

This utility is intended to be used in any loop in an application that have to run an indefinite time. When the Application Quit input becomes TRUE in one instance, all instances will abort their wait and stop their calling loop. The Continue output, wired to the continuation terminal of the calling loop becomes FALSE. It is used to terminate the application.

When the Group Quit input becomes TRUE in one instance, all instances with the same group name will abort their wait and stop their calling loop. It is used to terminate a specific section of the application like a plugin.

When the OK|Close input becomes TRUE, only this loop will terminate.

When Manage Caller FP input is TRUE, the VI will open the Caller FP on the first iteration, close it at the last iteration and end the calling loop when the user closes the Caller FP.

Download File:post-447-1140347475.llb

Share this post


Link to post
Share on other sites

Here are 2 little vi's I often use:

post-253-1142925547.png?width=400

I use both (red to yellow sub-vi's) to deal between development and built app (takes the work for me)

- First gives back the root path by removing the the vi-name and the "\blabla.exe\" or "\blabla.llb\". It is quite ideal to load ini-files that reside in the app root directory.

- Second checks if the path contains an ".exe". I usually put it at the end of the main vi: if the ".exe" is detected, it gives a true to the "quit lv"-primitive, thus quiting the built app. If not detected it doesn't quit the development environment.

Didier

Download File:post-253-1142926055.zip

Share this post


Link to post
Share on other sites

One of my favorite Vis is called ToDo.

It's function ist to do nothing at all, but exist anywhere on a BD where there is some work left unfinished.

It has a bright red icon and a required text input to describe whatever there is left to do.

It is an eyecatcher on any BD and easyly spotted in the hierarchy window.

A search for all occurrences of this Vi will show you all unfinished parts :oops: of your application at a single glance.

Share this post


Link to post
Share on other sites

I added 2 VIs to my structures palette which simply have a while loop with a wait and a stop button and a while loop with an event structure and a stop case already set up. By setting them to be merged you can drop a loop ready for a quick testing of something very easily. Note - to modify the palettes you have to rename the readonly.txt file found in the menus\paletteviewname directory.

Share this post


Link to post
Share on other sites
I added 2 VIs to my structures palette which simply have a while loop with a wait and a stop button and a while loop with an event structure and a stop case already set up. By setting them to be merged you can drop a loop ready for a quick testing of something very easily. Note - to modify the palettes you have to rename the readonly.txt file found in the menus\paletteviewname directory.

I do this with a couple versions of a state machine template. It's a nice technique. My ToDo list includes converting a lot more basic structures into palettes of merge VIs.

Sigh ...

So many nifty things to code up ...

Share this post


Link to post
Share on other sites
I do this with a couple versions of a state machine template. It's a nice technique. My ToDo list includes converting a lot more basic structures into palettes of merge VIs.

Sigh ...

So many nifty things to code up ...

My favorite is a file dialog where the user can only search in specified directories. So he can't do anything wrong.

See you

Ulrich

Download File:post-3940-1143805352.zip

Share this post


Link to post
Share on other sites

Here is a running average VI (LabVIEW 8.0, but would work in LabVIEW 6 and 7 too) that allows you to change the size of the running average array. It is written for an input of type double but can be changed as needed. Also, it is reentrant so it can be used multiple times in the same application.

Comments are welcome.

Download File:post-2002-1144359314.vi

Share this post


Link to post
Share on other sites

Here's a small LLB (LV 8) with some of my favorite Stupid Array Tricks. Array_of_Indices is a tiny little block diagram that I got tired of making over and over.

post-4616-1145622933.png?width=400

post-4616-1145622991.png?width=400

listbox_to_booleans and vice-versa do exactly that.

post-4616-1145623153.png?width=400

post-4616-1145623171.png?width=400

post-4616-1145623194.png?width=400

post-4616-1145623223.png?width=400

linspace_N_points_DBL creates a linearly spaced ascending or descending series; any resemblance to the Matlab command linspace is strictly in the mind of the author.

post-4616-1145623680.png?width=400

post-4616-1145623690.png?width=400

And my favorite, multiple_indices_from_array, it's simple, stupid, and oh so useful. I wrote it before I learned to do the polymorphic VI thing, and I wonder if it isn't a little faster-executing this way anyway. And besides, it's very handy if you want to index multiple array types with the same list of indices, which I do a lot.

post-4616-1145623708.png?width=400

post-4616-1145623724.png?width=400

Any suggestions, comments, or reciprocation ;) appreciated. I'd share more, but I forgot what it was Jim Kring said about how to keep you-know-who from copyrighting my ideas.

Download File:post-4616-1145623818.llb

Share this post


Link to post
Share on other sites
I'd share more, but I forgot what it was Jim Kring said about how to keep you-know-who from copyrighting my ideas.

I wouldn't be worried about feeping anyone from copyrighting your ideas - your posts (and all their attachments) here on LAVA are covered by the Creative Commons License (see the somerights20.png at the bottom of the page?) so you're safe!

If you'd like to go even further and increase your contribution's value to the wider LabVIEW community, check out OpenG:

From the OpenG website:

OpenG is an organized community committed to the development and use of open source LabVIEW tools, applications, frameworks, and documentation. Through participation and continuous improvement, we empower ourselves and others within our community while creating new opportunities for LabVIEW developers.

Share this post


Link to post
Share on other sites

Here's a couple of VIs that will help you sort a multi column listbox based on which column header the user clicks on, and resize the columns in a listbox to the width of the widest test element (essentially expanding to show all items).

Download File:post-181-1146403499.vi

Download File:post-181-1146403509.vi

Download File:post-181-1146404066.vi

Download File:post-181-1146404097.vi

Download File:post-181-1146572866.vi

Download File:post-181-1146572894.vi

Share this post


Link to post
Share on other sites
Here's a couple of VIs that will help you sort a multi column listbox based on which column header the user clicks on, and resize the columns in a listbox to the width of the widest test element (essentially expanding to show all items).

Hi !

Seems to be very usefull, but "Check if Listbox Column Header Clicked.vi" and "Sort 2D Array by Selected Column Values.vi" are missing.

vladimir

Share this post


Link to post
Share on other sites
...but <VI list> are missing.

Oops - sorry - they should be there now.

Share this post


Link to post
Share on other sites
Oops - sorry - they should be there now.

Hi,

Now works fine - wery usefull code.

(One VI is still missing "Count Number of Lines in a Multiline string", but the function was clear ...)

I have found and fix two small bugs:

1, When you have selected colum last+1, the list was cleared

post-3852-1146828883.png?width=400

2, When you have done mouse click on Label above column, the list was reorded too (this is only cosmetic, but some users are perfectionist ...)

post-3852-1146828903.png?width=400

Vladimir.

Share this post


Link to post
Share on other sites
I have found and fix two small bugs:

Hey - thanks for the fixes - I appreciate it :thumbup:

Share this post


Link to post
Share on other sites
Here's a small LLB (LV 8) with some of my favorite Stupid Array Tricks.

Here's another few array tricks, primarily sort_Excel_style, which crelf's multicolumn listbox sorter reminded me of. This isn't as user-friendly, but it allows you to pick multiple columns (or rows instead) by which to sort. So if two lines are "tied" (have the same thing) in column 1, you can break the tie using your second-priority column, say column 9 for example. And if they're equal there as well, then ... and so on for up to 7 "priority" columns. Why 7? It would get more and more clumsy for more priorities (see middle diagram below), and I couldn't figure out how to make it inherently flexible.

post-4616-1149618445.png?width=400

post-4616-1149618460.png?width=400

post-4616-1149619060.png?width=400

post-4616-1149618976.png?width=400

post-4616-1149618543.png?width=400

Download File:post-4616-1149618861.zip

Share this post


Link to post
Share on other sites

In this other thread I've discussed a project of mine that is too messy to be Code Repository material. Unzip the attached and open File IO/DirTree__Browser_Plus.vi - It's a GUI for browsing directories, with a pie chart showing relative sizes (bytes) of the items, where the only bytes that count are the files that you're looking for. For example, if you're looking for files VoltageData* and CurrentData*, a folder that has many bytes of those will appear larger on the pie chart than one with few of those but more total data. You can leave the search pattern(s) blank and then all files will count.

Directories with what you're looking for will get check-marked, as in the picture below. Any directories that do not have such items will have plain folder symbols. Note that in the picture, two directories have been selected (which really means that the 7 files within have been "selected"). When the user quits, these items' paths will be passed to the calling VI.

post-4616-1163076926.png?width=400

Some sub-VIs that may be of interest, even if you don't have any use for the main VI:

Tree Related: tree_Find_all_children.vi, tree_add_if_new.vi, tree_locate_and_add_item.vi (files item alphabetically within "its kind", as determined by a list of item symbols defining "its kind")

File operation: List_all_dirs_many_files (applies "patterns" to filter file listing but not directory listing)

GUI: Pie_chart_oriented.vi

Array: cut_multiple_indices_1D.vi (polymorphic for i32, dbl, str)

String: see picture above.

If anybody feels like cleaning this stuff up (or maybe just some subVIs) and making Code Repository material, be my guest, but I'm not feeling up to it. If you find some smallish group of subVIs particularly useful, let me know, and I'll see about cleaning those up myself.

Download File:post-4616-1163076885.zip

Share this post


Link to post
Share on other sites
... and so on for up to 7 "priority" columns. Why 7? It would get more and more clumsy for more priorities (see middle diagram below), and I couldn't figure out how to make it inherently flexible.

Hi,

maybe this could be a way to sort on an arbitrary number of columns.

Flow Formula - Dwyer Averaging Pitot.vi

Attachment is in LV8.20

Download File:post-5958-1163081605.vi

/J

Share this post


Link to post
Share on other sites

have this LLB in my user lib folder.

It's a LV2 global for storing data structures in an array without regard for the data type.

It can be used to store an object's current state into memory or to disk.

It handles a lot of gory details. All that all that is required from the caller is the following:

1) The data (as a cluster of variant bundled with a enum or string descriptor for that particular data type.)

2) An index for storage into the array of data types.

The caller can

Put, Get, Replace, and Insert data "elements" in any order, and at any index, (even one that does not yet exist. The VI will create the array element.)

Caller can also

Put/Get an entire array of elements, as well as storing/retreiving from binary disk file.

Range checking and other sanity code are not added, however it should be easy to modify this puppy.

Pros: Simple to utilize

Very Flexible and adaptable (I think)

Cons: Caller must define a descriptor entry for the data type and must re-construct the data on the other end using the descriptor into a case statement

(This is not really a bad thing)

Disk storage is not human readable or editable. I've not had time to think about what would be involved in adding this capability.

The DEMO should be self explanatory.

I have found this VI to be re-usable in my work and I hope someone will find it a useful work saver.

Regards,

John

http://forums.lavag.org/index.php?act=attach&type=post&id=5578

Share this post


Link to post
Share on other sites

QUOTE(crelf @ Apr 30 2006, 09:35 PM)

Here's a couple of VIs that will help you sort a multi column listbox based on which column header the user clicks on, and resize the columns in a listbox to the width of the widest test element (essentially expanding to show all items).

Hey Pal..

How to insert icon in table. Please help me to do this..

Have nice time

Regards,

Shashi

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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