04-29-2015 11:41 AM
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!
Solved! Go to Solution.
04-29-2015 01:37 PM
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.
04-29-2015 01:50 PM
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. 🙂
04-29-2015 01:56 PM
04-29-2015 01:58 PM
@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!
05-05-2015 01:27 PM
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.