LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to perform horizontal scrolling in list box control?

Since CVI list box control is not allow horizontal scroll bar, there is impossible to view entire item label, when it quite long. How to solve this problem?
0 Kudos
Message 1 of 7
(5,546 Views)
Misha,

Unfortunatelly the list box does not provides a horizontal scroll bar, but I'll send a request for that feature for future releases in CVI.

There are however a couple of things that you can do to have a list box with a horizontal scroll bar. The example attached here shows how to setup a table control and make it look like a listbox with a horizontal scroll bar. The other option is to use an activeX scroll bar and change the text in the listbox when the user handles the scroll bar; this may be to complicated for this task, but there is that option.

If you have CVI 7 you can also use a tree control to do it and it will look just like a list box with a horizontal scroll bar.

I hope this helps,

Regards,

Juan Carlos
N.I.
0 Kudos
Message 2 of 7
(5,544 Views)
Instead of using an ActiveX scrollbar, you can create a scrollbar with scroll.fp (...\CVI\tollslib\custctrl\scroll.fp). See the sample project ...\CVI\samples\userint\custctrl\scrollbar\scrollsample.prj.
But, as far as I can tell, you still need to modify the list box text to "scroll". You need to save the original text somewhere (like a global or the controls callbackData) so you can scroll back to the left.
0 Kudos
Message 3 of 7
(5,549 Views)

I'm reviving this thread in the hope that there may be new approaches available.  

The problem: List controls support formatting with escape codes (via the InsertListItem function), but do not support horizontal scroll bars. On the other hand, the TextBox control has horizontal scroll bars, but no support for escape code formatting. 

The List control is nice because it supports a mix of tablular output (using those escape codes) interspersed with lines of text as needed.

But, in the world of splitters and re-sizing of controls, horizontal scroll bars are more important now.

So, are there any new options?

Thanks,

Ian

 

Message 4 of 7
(5,402 Views)

You might want to try using the tree that was introduced in version 7.0. You can make a tree look and behave just like a listbox with a lot more functionality such as...

- horizontal scroll bar
- tooltips
- multiple item selection option
- drag and drop within the list
- sorting
- search
- customizable right click menu
- columns
- edit item labels at run time

However, while you can have columns in the tree to display tabular data like you could in the listbox, you don't do it through each item's escape codes, you do it by adding columns. Therefore, you can't have columns on some items and not have columns on other items. So, I'm not sure you can intersperse tabular output with lines of text like you mentioned.

Take a look at the attached code to see how to begin to configure a tree to be a listbox.

Hope this helps.

- jared

0 Kudos
Message 5 of 7
(5,370 Views)

Thanks, jared, for the informative example.

In my case the interactivity (e.g. drag/drop/sort/search/expand/tooltip) is not really necessary, as it is purely for displaying data.

Setting aside the need to intersperse lines of text, I'm still curious: Would there be any advantage to using a table control instead?  Or were there particular ("non-interactive") features of the tree control that led you to recommend it?

Thanks,

Ian

0 Kudos
Message 6 of 7
(5,351 Views)
I recommended using the tree control so that you can get horizontal scroll bars. You can turn off all those other features of the tree if you don't want them. If you do use the tree, you can use the same listbox API for the tree (InsertListItem, etc), so changing your code to use the tree would be pretty easy.
 
- jared
Message 7 of 7
(5,319 Views)