I've tried working with the SelectedIndices and Items[##].Selected
attributes to get the problem to go away, but not having any luck.
Questions I have are:
1) How do you move (using code) the focus Rectangle when your Selected
Index changes ?
2) If there are no selected rows, can that focus rectangle be removed?
3) What other quirks exist in this simple example I might need to code
for ?
On the Listview, I'm using "MultiSelec t = True" and "FullRowSel ect =
True".
//
// Detail
//
When the application first starts up, the Listview has focus. No
selection has been clicked, but a simple rectangle outlines the first
record.
http://i11.photobucket.com/albums/a1...3/01_Start.jpg
If I press Cursor Up, nothing highlights. If I press Cursor Down, the
2nd row highlights and the Focus rectangle moves to 2nd row:
http://i11.photobucket.com/albums/a1...CursorDown.jpg
Double clicking the row launches my Editor Form, in this example I
double click the 2nd Row item.
I pass the ListView object from the Main Form to the Editor. In my
Editor, I have [Previous] [Next] buttons. I click the "Previous"
button and the Main ListView changes focus to the 1st record.
http://i11.photobucket.com/albums/a1.../03_Editor.jpg
//
// Code for Previous click:
//
private void cmdPrevious_Cli ck(object sender, System.EventArg s e)
{
if (_ListView.Sele ctedIndices[0] > 0 )
{
int iNewIndex = _ListView.Selec tedIndices[0]-1;
// Remove Current Highlighted Record
_ListView.Items[_ListView.Selec tedIndices[0]].Selected = false;
// Highlight Previous record
_ListView.Items[iNewIndex].Selected = true;
_ListView.Refre sh();
}
}
//
// Code (Image) for Previous click:
//
http://i11.photobucket.com/albums/a1...r_Previous.jpg
I finish the Edit and close the Editor Form, the Main Form now has the
first row highlighted -AND- the focus Rectangle is still on the 2nd
row.
http://i11.photobucket.com/albums/a1..._AfterEdit.jpg
Pressing Cursor Down does nothing. Pressing Cursor Up moves the focus
Rectangle to the 1st Row and it remains highlighted.
http://i11.photobucket.com/albums/a1...5_CursorUp.jpg
Help!