LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multicolumn listbox scroll to the last row - with autosizing on

Solved!
Go to solution

Hi, Everyone:

 

I have a question about scrolling to the last row of a multicolumn listbox with a little twist: Autosizing Row Heght is on.

 

I've checked this out - multicolumn listbox - scroll to last element - but if one or more rows have been autosized to have more than one line, then the actual number of visible rows differs from the numrows and the calculation ends up incorrect.

 

Has anyone figured out how to do this?  If there was only a property to find the heght of a row in lines...

 

Thanks!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 1 of 6
(4,157 Views)

I haven't looked at all at what's available (although you should probably also check the methods, as some controls have useful methods when it comes to things like this), but at worst, you could probably brute force it by checking the content of the last N lines to see if it has line breaks (I'm assuming no wrapping, or if wrapping exists, that there's a way to check for it).

 

Another brute force alternative would probably be to use the Point to Row Col method and iterate over a point near the bottom to see when you get to the last row.


___________________
Try to take over the world!
Message 2 of 6
(4,127 Views)

Hmmm, I wonder if dividing the height in pixels of the row in question by the height of the default pixel height would be good enough.  (Rounding if needed.)  I bet it would be...

 

Thanks for getting me think about the pixels.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 6
(4,117 Views)

Maybe a non-issue but also note that you may end up with a multi-line row showing only partially.

 

Ben64

Message 4 of 6
(4,112 Views)

@ben64 wrote:

Maybe a non-issue but also note that you may end up with a multi-line row showing only partially.

 

Ben64


I guess I'll have to shoot the rapids and see what comes out the other side...  😉

 

Thanks!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 6
(4,108 Views)
Solution
Accepted by topic author billko

I've developed what I think is a bullet-proof solution.  It is based on adding the row heights, in pixels, from the last row backwards, until it is greater than or equal to the height of the content area of the MC Listbox, also in pixels.  Add one to the top left row to display because the last row displayed can be a fractional one.  Thus, there will always be one row empty on the bottom (which is the only way to make sure that the last message is entirely visible).  Due to the way that LabVIEW scrolls multi-lined rows, there may be more than one row empty on the bottom.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 6 of 6
(4,049 Views)