LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Get current Listbox row number from disabled row

Highlighted

Get current Listbox row number from disabled row

In an effort to scroll a front panel window (pane) that contains a listbox which is much bigger than the window, I need to get the number of the currently-highlighted row within the listbox and adjust the window scroll (origin) position accordingly.  I want to be able to move from row to row within the listbox using the up/down arrow keys on the keyboard. So far all that can be made to work fairly easily. But once some (or perhaps many) of the rows within the listbox become disabled rows, the value that gets reported out for them is always "-1".  Using the arrow keys it is possible to move the selected row pointer to a disabled row and while it does not become highlighted like an enabled row, a ghost rectangle does appear around it to show that some part of LabVIEW does have a sense that the listbox pointer is at that row anyway.

 

I have looked at and observed the behavior of every listbox property that I thought even might remotely be able to give me the sense of the row number (ghost pointer) when the row is disabled but so far I've come up empty.  Suggestions?

 

 

0 Kudos
Message 1 of 3
(1,147 Views)

Re: Get current Listbox row number from disabled row

Rather than making the listbox much larger than the pane and then scrolling the pane, I would suggest making the listbox fit the pane and then maybe change the top row property of the listbox to scroll it. Once you do that, as far as I can tell, you shouldn't actually have a problem or need to do anything, because the listbox scrolls automatically when the user navigates it, which is why that "maybe" is there. You can also show the scroll bar on it to make it easier for the user.

 

I did mention the top row property, because there are times when you do want to change the position yourself and then it is useful (such as if you're adding an item to the list and want to highlight it). If you do that, there are some edge cases around the start and end of the listbox you will want to handle (such as doing a min and max with zero).

 

Incidentally, if for some reason I would still need to control it myself, I think I would probably use the Key Down? event for the listbox and track the current value separately in a shift register. Whenever the value of the listbox is -1, I would handle incrementing or decrementing it myself.

 

 

Also, relevant plug - http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Setting-the-value-of-a-listbox-should-display-the-sele...


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

Re: Get current Listbox row number from disabled row


@tst wrote:

Rather than making the listbox much larger than the pane and then scrolling the pane, I would suggest making the listbox fit the pane and then maybe change the top row property of the listbox to scroll it. Once you do that, as far as I can tell, you shouldn't actually have a problem or need to do anything, because the listbox scrolls automatically when the user navigates it, which is why that "maybe" is there. You can also show the scroll bar on it to make it easier for the user.

 :

 :

 Incidentally, if for some reason I would still need to control it myself, I think I would probably use the Key Down? event for the listbox and track the current value separately in a shift register. Whenever the value of the listbox is -1, I would handle incrementing or decrementing it myself.


This is what I started out with initially and for a variety of reasons did not care for it.  I may have to go back to it but for now would like to try to make this other work.

 

 

 

0 Kudos
Message 3 of 3
(1,091 Views)