LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading Large Lists Into the Listbox Control.

I am using CVI 6.0 to write a display and analysis application for viewing test output files that are formatted as ASCII text.
 
Is there a faster method than the InsertListItem() function to load large lists (100K lines, 4.5 Mbyte) into the list box control?  The first Mbyte or so goes quickly, but after that the speed falls off quite rapidly.  It usually takes over a minute to load one on my machine ( 1.8 Ghz P4)  
 
I could use the textbox, but the checkbox function works well for my application.
 
Thanks,
 
Bob
0 Kudos
Message 1 of 7
(3,912 Views)

Hello Bob,

Unfortunately, that seems to be the only way to insert items into a Listbox. I tried looking in the Programmers Toolbox library and it has functions that allow you to insert multiple items into the list. However, there is no way to convert a List to a Listbox.

If you can tell me more about your application, I can help you figure out a way to make it more efficient. Maybe we can use some other type of UI to accomplish the same task faster.

Regards,

Jack J.
Applications Engineer
National Instruments

0 Kudos
Message 2 of 7
(3,884 Views)

Hi Jack,

As I mentioned, the application will be used to view test setup files formatted as ASCII text.  At 100K+ lines, they are too large to load into Excel.  Some users view them using Notepad or Word, but these do not provide line numbers which are helpful to use as internal references. 

Since the files are ASCII, I usually view them using the editor in CVI.  It provides line numbers, an easy to use "find" feature, along with the ability to add toggle tags for rapidly moving to selected areas of interest.  Unfortunately, not everyone in my group has CVI.  Also, there are some other custom features that would be handy to have such as:

  1. A "jump to" button that would increment the display to certain predetermined sections of the file .
  2. A "list"  function that would populate a ring control with the headings of the frequently used data fields.  This would allow the user to rapidly move to selected areas of the display.
  3. Misc. analysis features that would extract or summarize various data parameters in the file.
  4. A "bookmark" function, similar to the toggle tags in CVI which would allow the user to quickly jump around in the file.  (The checkbox feature in the listbox control would work especially well for this.)

Features 1 - 3 can be readily accomplished using a text box, but I'm not sure how to implement the bookmark feature with this control.  It would be great to have a user click on a line of text and be able to provide some visual feedback in the textbox that this line has been bookmarked.  Is there a way to change the color or format of a single line of text in a text box?.  Perhaps this is a feature in 7.X.

Thanks in advance for any suggestions that you can provide.

Bob   

0 Kudos
Message 3 of 7
(3,885 Views)

Hi Bob,

Wow! That would be a pretty cool application. A document browser written in CVI. It is no simple task but I would definitely love to see this done in CVI.

However, I think you can save a lot of time by using a free software that does the same things you are looking for. Here is a link to it:
http://www.download.com/3001-2352_4-10433516.html?idl=n

It is called Notepad++. It seems to do everything you want.

Hope this helps,

Regards,
Jack J.
Applications Engineer
National Instruments

0 Kudos
Message 4 of 7
(3,857 Views)
Bob,

There is no way to alter the look of an individual line in a text box. The idea behind the text box is that it holds one piece of data (as opposed to the list box, which conceptually holds a list of items), which is why you can't change individual lines and also why you can so easily set/replace its entire contents.

I've written a small app that implements the bookmarking functionality you wanted.  To do this, I used a parallel text box to display the bookmarks ('>' characters).  The only tough part is making the two text boxes scroll in unison.  To do this, I had to check for the up/down arrow and page up/down keypress events, as well as enabling a timer when I detected the user was dragging the mouse.  The one thing missing is support for the mouse scroll wheel, but that could probably be accomplished by getting the right Windows events.

The whole issue of synchronizing the two text boxes could be avoided if you just used one text box, and inserted some marking  characters directly into the beginnings of the lines of text you have bookmarked (if you don't mind it looking a little awkward).  You could easily do this by using GetTextBoxLine to get the original text, adding in your marking characters, then calling ReplaceTextBoxLine to do the replacement.

Hope this gives you some ideas!

Mert Akinc
National Instruments
0 Kudos
Message 5 of 7
(3,837 Views)

Mert and Jack,

Thanks for your help.  I'll give this a try.

Bob

0 Kudos
Message 6 of 7
(3,834 Views)
I'm sorry, I found a problem with the app I posted.  I am reposting the fixed code.

Mert Akinc
National Instruments
Message 7 of 7
(3,825 Views)