LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set number of Columns in a table

Hello,

 

I have a table on my front panel that I populate with information. It has a horizontal scrollbar so you can scroll to see all the different columns of information. My problem is that for some reason I have 6 extra empty columns that I can't seems to get rid of. I have tried changing the number of columns through a property node (NumCols) but that only changed how many are displayed, I can still scroll over to the extra empty columns. Anyone know how to set a certain number of columns on a table in LabVIEW? Thanks.

 

 

0 Kudos
Message 1 of 8
(4,227 Views)

Not only that but clicking the right arrow next to the scrollbar would allow you to scroll infinitely to the right, not just the six extra columns that you mention. 

 

Try to click and drag from first column to another column off-screen.  How do you prevent that method of scrolling?

 

I think in order to prevent some of this behavior, you'll have to do something fancy with mouse down/move events and the invoke node "Point to Row Column".  However I seriously doubt that you'll be able to prevent scrolling in all possible scenarios without creating some other unwanted, funky behavior.  You should probably re-evaluate your priorities to determine if this is really that important to you.  Maybe you could look at a multi-column listbox because it doesn't seem to have this "feature". 

 

aputman
0 Kudos
Message 2 of 8
(4,212 Views)

@ebohannon wrote:

Anyone know how to set a certain number of columns on a table in LabVIEW? Thanks.


To try to answer your specific question, this is not possible AFAIK.  As you have discovered, you can only control the number of visible rows and columns.  The table control in LabVIEW is akin to an Excel spreadsheet, an endless canvas of cells/rows/columns, which is different than Word's implementation of tables where rows and columns can be deleted at will.

aputman
0 Kudos
Message 3 of 8
(4,177 Views)

@aputman wrote:

Try to click and drag from first column to another column off-screen.  How do you prevent that method of scrolling?


Just tested this, but I can't reproduce this behavior. Are you confusing the MCLB and a table? The table does have this behavior...

 

The scrollbar seems to be the only way to scroll horizontally. Simply hiding the horizontal scrollbar prevents the user from doing this.

 

You can change the width of the columns manually, or from your program. If you have 6 columns, and you know the width of the MCLB, you can calculate and set the width of the columns. Then you'd have 6 columns as far as the user is concerned. I do this all the time.

0 Kudos
Message 4 of 8
(4,154 Views)

wiebe@CARYA wrote:

@aputman wrote:

Try to click and drag from first column to another column off-screen.  How do you prevent that method of scrolling?


Just tested this, but I can't reproduce this behavior. Are you confusing the MCLB and a table? The table does have this behavior...


No I'm not confusing the MCLB and a table.  The OP said they were using a table and I pointed out additional methods of scrolling on a table that would be difficult to prevent.  I did suggest switching to a MCLB at the end of my post because some of these "features" are not found in that type of a control.  Am I missing something?

aputman
0 Kudos
Message 5 of 8
(4,145 Views)

@aputman wrote:

wiebe@CARYA wrote:

@aputman wrote:

Try to click and drag from first column to another column off-screen.  How do you prevent that method of scrolling?


Just tested this, but I can't reproduce this behavior. Are you confusing the MCLB and a table? The table does have this behavior...


No I'm not confusing the MCLB and a table.  The OP said they were using a table and I pointed out additional methods of scrolling on a table that would be difficult to prevent.  I did suggest switching to a MCLB at the end of my post because some of these "features" are not found in that type of a control.  Am I missing something?


No, it's probably me...

0 Kudos
Message 6 of 8
(4,135 Views)

You can create a property node, index values, change all to write, than set it to 0,0

0 Kudos
Message 7 of 8
(3,387 Views)

To prevent unwanted scrolling on a Table control, I got rid of the scroll bars and made my own. Not fun, but it can be done. You then have control over the scroll bar and can set limits, etc. Works well and almost looks like a native scroll bar if you use splitters correctly. The MCLB control does not suffer from this problem, but I avoided using it because it needs to be updated via property nodes for new values, which is slower in the long run. If you are not updating often then a MCLB might be okay.

 

Below is a screen shot a Table control and a separate scroll bar control. There is about 1 pixel misalignment at the bottom that I cannot seem to fix. Sigh.

 

mcduff

 

Snap14.png

0 Kudos
Message 8 of 8
(3,376 Views)