LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent multi-column list box showing an extra column

I am using a multi-column list box to display data and to allow the user to enter new values. More columns are used than are actually displayed within the bounds of the listbox control. Using an event structure the user is able to scroll left and right along the columns of the list box to select the appropriate field. I am using the 'Edit Position' property to highlight the particular field that the user is selecting. This technique works well and the listbox scrolls left and right to display the selected fields correctly.

 

If the listbox has, say, 10 columns with only 5 being visible within the displayed width, then I clamp the Edit Position to a maximum column value of 9 to prevent the list box from continuing to scroll right into unused columns. This works fine, except that when the user scrolls to the 10th column, the listbox control always shows a blank 11th column. The 11th column cannot be selected. It would appear that this is default behaviour for the listbox control in that an additional column is always displayed relative to the Edit Position. In my particular application it is untidy to have this blank column appearing. I have tried a workaround by programmatically writing to the 'TopLeft' property of the listbox. This partially works by ensuring that the blank 11th column is never displayed, however, despite the Edit Position being correct to select the 10th column, the field in the 10th column is no longer highlighted and the user cannot enter a new value.

 

Does anyone know of a method for preventing the blank additional column from appearing?

0 Kudos
Message 1 of 4
(2,994 Views)

Hi Dennis_M1,

 

Could you please attach your code so I can do some experiments on my side?

 

Thank you.

 

Lanxi

0 Kudos
Message 2 of 4
(2,951 Views)

Ok - I have attached an example which demonstrates the issue. This is produced with LV 2012. Open the project and then the 'Multi column listbox.vi'. Run the vi and use the right/left arrows to move between cells in the listbox. Observe that unused (unwanted) columns are always displayed to the right.

 

Thanks for any help..

0 Kudos
Message 3 of 4
(2,920 Views)

Hi Dennis_M1,

 

Thank you for providing the code. 

 

In the Check for Event case, could you please add another filter event to filter out the Key Down action when the next column is empty? You should ignore the "move left" front panel movement when reach the end of the array,

 

The behaviour we are seeing is the default behaviour and I don't know any other property node can change this on the top of my head.

 

Thank you.

 

Lanxi

0 Kudos
Message 4 of 4
(2,884 Views)