LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Listbox features for a table

Hi,

I need to provide a control on the user interface that acts more or less like a text editor. Here are some of the additional features it requires:

1) The user should be able to mark one or more lines of the displayed text by using the mouse and the CTRL and SHIFT keys
2) Delete highlighted lines by pressing the delete key
3) The control should support copying pasting and cutting lines
4) The control should allow using arrows (page up/down keys, up/down keys).
5) Marking a line should be done simply by clicking once on the line - not by dragging the mouse across all the text in the line
6) Line dragging

It seems like what I need is a combination of features of the Listbox and the Table. I can see how these can be implemented in a Listbox, but the listbox does not allow editing of the text. The other option I have is to then use a table, but then I need to program all of the additional functionality for the table.

Does anybody have any ideas on the best way to implement this?

Thanks in Advance.
0 Kudos
Message 1 of 4
(2,938 Views)
If you want a text editor, it sounds like the best option is simply a string control. What it doesn't support natively, you should be able to code yourself using events (mouse up\down) and property nodes (selection). Be aware that you can't disable word wrapping in a string control.
If you want something that has a different functionality (you seem to want something with seperate lines), elaborate more on this functionality. If this is what you want, you can probably add items to the list box using a mouse down to detect where to put the name and placing a string control there where the user can type. This is not pretty, though.

___________________
Try to take over the world!
Message 2 of 4
(2,930 Views)
You are right - what I need is to display a multi-line script file and allow the user to edit the file.

I thought about the solution you describe to place a string on the listbox where the user can type. Would it be easier to program the features of the listbox on a table? Would that be any "prettier"?
0 Kudos
Message 3 of 4
(2,925 Views)
I don't think most of those things (like line dragging or line deleting) are supported natively on any one control. Since you say that you have a multi line file, I think the best option may be the string control. You can use mouse down with GetKeyState (from user32.dll) to detect a click with ctrl or shift (you will have to do some calculations to know which line you clicked on), cutting and pasting is supported, you can select a line by detecting the LFs and using the selection property. The only thing I'm not sure about is the ability to have multiple selections.
Can you think of any existing program that can do this? Maybe it has an ActiveX control you can use.

___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(2,915 Views)