LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ListBox cannot show all the content

Hello 

So I have a test project that have around 100 test cases, So as the below picture shows, I have all the test step, description, log etc in a listBox,

right now the problem is I definitely cannot put all the table's cells in side of the red color area which is the user interface area, and instead, it will reach out to the down areas quite a lot. I tried to enable the vertical screw bar, but it didn't have any result. so what should I do then, to make sure even I have 100 columns it will also only show around 35(which is the number that the table can fit into the UI). and after the test i can screw down to check all the parameters?

QQ截图20201026134944.pngQQ截图20201026140201.png

0 Kudos
Message 1 of 13
(3,017 Views)

The easiest solution is to place one or more splitters to create a pane containing the MCLB and then right click the MCLB and select Fit Control to Pane. That way, it will always fill the pane when the window is resized.

 

Then, just make sure that the vertical scrollbar of the MCLB itself is visible (right click>>Visible Items) and it will simply be disabled when the user can't scroll. This doesn't require any code, although you might want to update the top-left visible cell to be 0,0 at some points in time.


___________________
Try to take over the world!
0 Kudos
Message 2 of 13
(3,009 Views)

@ericyuan  ha scritto:

I tried to enable the vertical screw bar, but it didn't have any result.


The vertical scroll bar should definitely allow you to view all lines. Unless the multicolumn listbox is disabled.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 13
(2,993 Views)

You should not show all 100 rows. The scrollbar enables you to show a set of items out of all items. If all items are shown, there will be no scrolling left... 

 

The listbox is grown to outside the panel. If you want to scroll to see the listbox and it's 100 elements, you'd need to show the pane's scrollbar.

 

As mentioned, the easiest solution is to put the scrollbar on it's own pane (using a splitter) and fit it to the pane. This won't (and you shouldn't force it to) show all 100 items, but it will allow you to scroll through the items that are not visible. 

0 Kudos
Message 4 of 13
(2,982 Views)

I was able to fit into the panel after finish the test, but the problems is in my listBox initialize code, after i set the column to 100 ,the bottom side will extend to the outside of the splitter?

 

ericyuan_1-1603698447888.png

 

0 Kudos
Message 5 of 13
(2,978 Views)

OK, that's good to know,  I will have a try and use a splitter have a try

0 Kudos
Message 6 of 13
(2,975 Views)

To be more clear: the suggestion is to NOT set the number of lines/columns at runtime and let the control to resize automatically.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 13
(2,972 Views)

OK. I probably will disable that part and then

0 Kudos
Message 8 of 13
(2,965 Views)

hey Paolo

After i delete the columns value in initialize part, It cannot display the other part which is out of the boundary of UI interface anymore.

but if i add that initialize code, the table at least  can show up all the information but it just extend from the bottom side of the UI interface.

I really didn't get more hints from the property of the listbox for solving this problem.

do you have any idea about where could be wrong in my code? 

 

QQ截图20201028172843.pngQQ截图20201028172955.png

0 Kudos
Message 9 of 13
(2,894 Views)

If you have a variable number of columns, it's ok to set it at runtime. If not, it's better to set it only at edit time.

 

I don't really understand what you mean with:  the table at least can show up all the information but it just extend from the bottom side of the UI interface. Can you elaborate more?

If you want to set the position into the items table of the first control line programatically, you can do it using the property Top Left Visible Cell.

 

If the table cannot display more than 36 items (I would say 35), you can't do much apart from using a smaller font and decrease the line height.

But in any case you will never be able to show 100 items at once, so what's wrong in letting the user move up and down with the scrollbar?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 10 of 13
(2,888 Views)