10-03-2011 08:37 AM
I want to programmatically change the selected cell of a multicolumn list box whose Selection Mode is set to Highlight Entire Row. I would use this to be able to highlight which ever row of the listbox I choose to. It would function in the same manner as if the user had clicked on a row to select it and highlight that particular row. Setting the Active Cell does not accomplish this.
Steve
Solved! Go to Solution.
10-03-2011 10:16 AM
Try using the value property 😜
10-03-2011 09:26 PM
Assigning the Value property works to change the selected and highlighted row. Thanks
02-08-2016 04:19 PM
What if the Multi-column listbox value exceeds the visible number of rows? Is there a way to automatically scroll down with the value being set?
02-09-2016 02:59 AM
@rkmadse wrote:Is there a way to automatically scroll down with the value being set?
Yes and no. There is nothing built in, but you can use the Top Left Visible Cell property to set this. While you can simply use this with your cell, it generally looks better if you set it to a few rows above and there are edge cases around the start and end of the listbox.
07-05-2023 09:20 AM
Not really selected in the strict sense.
I does highlight the row(s) but they aren't ("completely") selected: You can't extend the selection by shift-click (but you can by ctrl-click...) 😮
It needs a mouse click to start/end the selection, which is indicated indicated by a dotted box around where you selected.
Go figure...
07-06-2023 12:07 AM
@MGiacomet wrote:I does highlight the row(s) but they aren't ("completely") selected: You can't extend the selection by shift-click..
With a bit of playing, it looks like the Focus Row property does do what you want (if you shift-click after setting it, the selection block will start from that row), but you will still need to decide which row is the one you actually want to start from.
Can't say that I ever needed this personally. I think that in cases where I needed to track and mark mutiple things in a MCLB it was usually either OK to let the user Ctrl+click as much as needed (or I simulated a Ctrl press when entering the control and a release when leaving in the cases where holding down Ctrl was not a viable option) or I tracked the selection by cell and not by row in a separate data structure and used the cell colors to indicate the selection to the user rather than the value of the control.
07-06-2023 08:07 AM
You mean, like in the pic below? Still doesn't do it...
The intent in this example (and I believe the OP) is to programmatically select row three and, as in any Windows, etc. application, based on the "selected" row as indicated by the highlight, be able to extend the selection to, say, row 5 by shift-clicking on it. The result should be rows 3, 4, and 5 selected. However when you shift-click on row 5, only it becomes selected (and then it has the dotted box around it indicating the start of the actual selection...)
It appears that the MCLB needs a mouse click to start the (actual) selection.
Furthermore, Help for the property property FocusRow says "The row that has focus and is used as the basis for key navigation such as up and down arrows", but after calling the property up and down arrows do NOT work! One must (again) mouse click on a row to be able to use up/down arrows.
07-10-2023 03:25 AM
@MGiacomet wrote:
You mean, like in the pic below? Still doesn't do it...
when you shift-click on row 5, only it becomes selected (and then it has the dotted box around it indicating the start of the actual selection...)
Your MCLB datatype is defined as a scalar (selection mode 0 or 1 item or 1 item). I don't think in this case you can select multiple rows in any configuration, regardless of how many times you shift click. Change the selection mode to be 0 or more and then it should work.
@MGiacomet wrote:
Furthermore, Help for the property property FocusRow says "The row that has focus and is used as the basis for key navigation such as up and down arrows", but after calling the property up and down arrows do NOT work! One must (again) mouse click on a row to be able to use up/down arrows.
Your MCLB doesn't have the key focus, so pressing the keys will not affect it. You can set the focus row property and then set the key focus property to true (or mouse click on it like you did) and then it should work.
07-10-2023 07:23 AM
>>Your MCLB datatype is defined as a scalar (selection mode 0 or 1 item or 1 item
Ok, my bad in the pic; but the (wrong) behavior is the same even if set for multiple selection
>>Your MCLB doesn't have the key focus
Setting Key Focus puts an extra border around the MCLB, which isn't shown (or needed) once you do a mouse click to start the selection