J
Jonathan Wood
I'm adding items to a ListView control. As I add each item, I want to
*properly* select that new item--as though it had been clicked with the
mouse. This means it will be the only highlighted item, it will get the
focus rectangle if the control has focus, and the control will scroll if
needed to fully display the selected item.
Apparently, it was assumed this would not be a useful task.
So far, I've come up with the following.
lvwInfo.SelectedItems.Clear();
item.Selected = true;
item.Focused = true;
lvwInfo.Items.Add(item);
It kind of works, but it does not scroll to fully display the selected item.
Please tell me I'm missing something easy here, instead of that I need yet
more code to accomplish this trivial task.
Thanks.
Jonathan
*properly* select that new item--as though it had been clicked with the
mouse. This means it will be the only highlighted item, it will get the
focus rectangle if the control has focus, and the control will scroll if
needed to fully display the selected item.
Apparently, it was assumed this would not be a useful task.
So far, I've come up with the following.
lvwInfo.SelectedItems.Clear();
item.Selected = true;
item.Focused = true;
lvwInfo.Items.Add(item);
It kind of works, but it does not scroll to fully display the selected item.
Please tell me I'm missing something easy here, instead of that I need yet
more code to accomplish this trivial task.
Thanks.
Jonathan