LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to move elements to top of multicolumn listbox after it's been sorted

Solved!
Go to solution

I've sorted my multicolumn listbox depending on the column they click on, however as this reverses the array I'm left with a ton of blank elements at the top and my values all the way at the bottom. I don't know how better to explain, hopefully this will open up a conversation though.

0 Kudos
Message 1 of 22
(1,565 Views)

@TylerHW wrote:

 I don't know how better to explain, hopefully this will open up a conversation though.


 

You can explain better by showing a picture and attaching your VI.

 

The contents of a listbox is just an indicator (while the "value" is the selected row), so if you have blank rows in your array of items, maybe you want to get rid of them first.

0 Kudos
Message 2 of 22
(1,555 Views)

Can i "get rid" of them without resizing the listbox? I want to keep it a fixed size

0 Kudos
Message 3 of 22
(1,549 Views)

TylerHW_0-1676476046353.png

TylerHW_1-1676476060435.png

this is the before and after sorting by playlist name

 

0 Kudos
Message 4 of 22
(1,547 Views)

The size of the listbox is cosmetic. You can have a long listbox and only have a few rows of items. Or you can have more items than shown, then you can enable the scrollbar to be able to see all at runtime.

 

Simply make sure that your array of items has no blank rows and the rest will fall into place.

 

We can give much more specific advice if you would attach a simplified version of your VI.

0 Kudos
Message 5 of 22
(1,542 Views)

I'll attach my sorting VI 🙂

0 Kudos
Message 6 of 22
(1,532 Views)

Also, i want to keep the scroll bar incase they add more elements than i have rows and the listbox will stay the same size

0 Kudos
Message 7 of 22
(1,528 Views)

Find a way to use "replace array subset", instead of "insert into array".

0 Kudos
Message 8 of 22
(1,508 Views)
Solution
Accepted by topic author TylerHW

After you read the item names, just eliminate all empty rows before sorting.

 

Of course a better solution would be to never even have empty rows, so we would need to see the code that populates the listbox in the first place. can you show is the caller?

0 Kudos
Message 9 of 22
(1,505 Views)

@GRCK5000 wrote:

Find a way to use "replace array subset", instead of "insert into array".


Have you even looked at the code? None of the items you mentioned are even there!

0 Kudos
Message 10 of 22
(1,500 Views)