Jump to content
Karissap

[CR] Multi-Column Listbox XControl

Recommended Posts

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

Name: Multi-Column Listbox XControl

Submitter: Karissap

Submitted: 02 Jul 2009

Category: X-Controls

LabVIEW Version: 8.5

Version: 1.2.0

License Type: BSD (Most common)

Make this available on the VI Package Network?: Undecided

Copyright © 2007, Karissa Purcell

All rights reserved.

Author:

Karissa Purcell

--see readme file for contact information

Description:

An XControl with enhanced features for the multi-column. To access X-Control features select More… from the shortcut menu.

Features

  • Automatic Ordering -. The Rows are ordered by a selected column in either ascending or descending mode (alphabetically). Columns can be selected by clicking on the column header with the hand tool. The sorted row is displayed in bold font with a \/ or /\ marker at the end of the name.
  • Value Filtering – Rows can be hidden by applying value filters. The value filters will apply upper and lower limits (alphabetical) for columns.
  • Alternate Line Colouring – Gives the Multi-Column Listbox a professional look by applying an alternating background and text row colour.

Dependencies:

Labview 8.5.x or higher

Open G Array Library: oglib_array

Change Log:

1.2.0: Fixed edit cell behaviour. Improved ability to convet older versions.

1.1.0: Added more commenting. Fixed bug in cell editing of column headers. Added saving of adjusted column widths. Added example vi.

1.0.0: Initial release of the code.

Click here to download this file

  • Like 2

Share this post


Link to post
Share on other sites

Hi,

I am trying to use your XControl, but I am not able to get the Items I select. I can only get the number but you can only use the number to get the items selected if the list isn't sorted. Maybe I'm wrong ?

Any hints ?

Thanks

Markus

Edited by M_Fink

Share this post


Link to post
Share on other sites

Karissa, I pointed a coworker to this for something he needed and he really liked it, but we also have a couple of points of feedback:

  • It's advisable to defer the updates when updating the display. If you don't, you see all the changes as they are made and (worse) you suffer considerable performance degradation if you have more than a few items.
  • The XControl doesn't work correctly when building an executable. The reason is that the column width is decided by placing text in a decoration in a subVI and checking the size of the decoration. The problem is that the FP of the subVI is removed when building, so this doesn't work. The easiest way of working around this is creating a property node for one of the controls in the subVI. The node doesn't have to do anything, but just having it causes the subVI to keep the FP when building the EXE.
  • You use the listbox as a storage area for the string array. I would suggest moving the actual string array into the state shift register and always operating on that. The listbox can than just be updated when needed.

Share this post


Link to post
Share on other sites

Yair,

Your comments sounds very reasonable. I did modification of Karissa's code for my needs, but my changes doesn't include anything what you mentioned. I do deffer FP updates outside the xcontrol code. What about autowidth feature, I simply don't need it and made it disableable. Still using listbox as a storage area. Your last suggestion is the best.

What changes I did, besides the enabling of some native listbox properties like Visible Items group, I made columns width ajustable programmatically in addition to autowidth. A column can be made hidden. Also, I modified the Value Filter greatly. The original one could do AND opearation only, but I was needed OR. So now my filter can process AND/OR logic but does it sequentially (doesn't undestand brackets). Also, UI for value filters displays column names now instead of number and doesn't display hidden columns (while you still can filter by hidden columns programmatically). One more addition, selected row kept selected through sorting or filtering process. All these changes might be not made the optimal way, but works great for my purposes (if don't forget to deffer FP updates). If somebody interested, I may post the code.

Share this post


Link to post
Share on other sites
License Type: BSD (Most common)
and this
Copyright © 2007, Karissa Purcell

All rights reserved.

are in conflict. You can't reserve all rights of copy and BSD license them simultaneously. I believe the correct notation is
Copyright © 2007, Karissa Purcell

All non-licensed rights reserved.

Share this post


Link to post
Share on other sites

If somebody interested, I may post the code.

The default should be to post it. Even if no one wants it right now, someone might want it down the line.

Share this post


Link to post
Share on other sites

The default should be to post it. Even if no one wants it right now, someone might want it down the line.

Here we go. I'm sorry for lack of documenting. I'm not sure is it right to post this code here in certified repository, but this is just enhancement of the original Multi-Column Listbox XControl. Pay attention to Value Filters. Enhancin of this feature was the main reason I did the modification.

MC_ListBox_XControl.zip

Share this post


Link to post
Share on other sites

The XControl doesn't work correctly when building an executable. The reason is that the column width is decided by placing text in a decoration in a subVI and checking the size of the decoration. The problem is that the FP of the subVI is removed when building, so this doesn't work. The easiest way of working around this is creating a property node for one of the controls in the subVI. The node doesn't have to do anything, but just having it causes the subVI to keep the FP when building the EXE.

Even easier would probably be a Get Text Rect.vi call to calculate the bounds of the string. Well perhaps not easier, but cleaner and possibly faster since it likely doesn't involve a UI update (though I'm not sure what happens under the hood of that VI).

post-11742-126834422353_thumb.png

Edited by mje

Share this post


Link to post
Share on other sites

Even easier would probably be a Get Text Rect.vi call to calculate the bounds of the string. Well perhaps not easier, but cleaner and possibly faster since it likely doesn't involve a UI update (though I'm not sure what happens under the hood of that VI).

post-11742-126834422353_thumb.png

I've been playing around with my own MCL functions and I've been using Get Text Rect.vi as you suggested; but I also go the extra step to retrieve the CellFont properties of each cell as an input into the Get Text Rect.vi. (just in case someone uses fonts or sizes other than App or System types)

I've had as many as 500 rows with no significant delays... :thumbup1:

MCL Get Max Col Widths.vi (LV 8.6)

Share this post


Link to post
Share on other sites

...works great for my purposes (if don't forget to deffer FP updates).

Which was why I suggested defering the updates inside the facade VI - then the control becomes contained and there's no need to do this yourself.

Any plans on releasing this as a VIPM package?

You could probably create one yourself.

Share this post


Link to post
Share on other sites

Sorry, I was just told about the latest comments on this thread (thanks Yair), I will get started on the update using the attached files in the thread and the other suggestions (and change the copyright notice, woops). That get text rectangle vi method is great, I didn't know about that, it'll be much better for the exe. These are great improvements!

Share this post


Link to post
Share on other sites

and this

are in conflict. You can't reserve all rights of copy and BSD license them simultaneously. I believe the correct notation is

Can someone please clarify this (so I know what to right too!)?

Here is the license template:

Copyright © <YEAR>, <OWNER>

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

http://opensource.org/licenses/bsd-license.php

Share this post


Link to post
Share on other sites

Can someone please clarify this (so I know what to right too!)?

It appears you can simply leave it out without any loss of your rights.

From Wikipedia,

"All rights reserved" is a phrase that originated in copyright law as part of copyright notices. It indicates that the copyright holder reserves, or holds for their own use, all the rights provided by copyright law, such as distribution, performance, and creation of derivative works; that is, they have not waived any such right. Copyright law in most countries no longer requires such notices, but the phrase persists...

The requirement to add a notice became obsolete and essentially deprecated on August 23, 2000, as every country that was a member of the Buenos Aires Convention (which is the only copyright treaty requiring this notice to be used) is also a member of the Berne Convention which requires protection be granted without any formality of notice of copyright.

Reading this post constitutes a binding agreement not to hold the author liable for any lost income or damages resulting from taking legal advice from Wikipedia. Furthermore, the author expressly denies any knowledge of the contents of this post.

Share this post


Link to post
Share on other sites

I put together a little example of how to use my modification of MC ListBox XControl (see post #7) to create a UI element of two lists, left with available items and right with selected items, using Select, Unselect buttons to move elements between lists. (I don't know an official name for this UI structure).

The vi should be put into the MC_ListBox_XControl folder. The vi is in LV 2009.

MC_ListBox_XCtrl_example.vi

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.


×
×
  • Create New...

Important Information

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