I ended up adding the code below after reading
this article.
procedure TfrmEditCuts.lvCutListCustomDrawItem(Sender:
TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
const
cStripe = $FF9933; // colour of selected list items
begin
if Item.Index = lvCutList.ItemIndex then
begin
lvCutList.Canvas.Brush.Color := cStripe;
lvCutList.Canvas.Font.Color := clWhite;
end
else
lvCutList.Canvas.Brush.Color := clWindow;
end;
This made the selected row stay colored even though the listview lost
focus when I clicked the buttons.
I had to probe the selection color in my paint program to set the
cStripe value to the same because when clicking on an item the
CustomDrawItem event seems not to be called. So on initial click the
row was colored blue and when I used my buttons to move the row it was
colored in the cStripe value that I originally used (light green).
Changing the cStripe value to the color of initial selection made the
row move without visible color change....
PS: I had no knowledge of the property HideSelection, but when I saw mention of it I tested it and it did not work well to set it to false.
Other issues popped up like losing the selection if returning to the listview.
And the selection changed color when I clicked elsewhere.
The code above works, but I cannot use any other color than the one the selection defaults to, since I don't know where to change that. Initial selection is always blue...
DS