I do not recall ever having this problem when coding in Delphi...It is the same behavior as in Delphi 7. Recent versions, however, keep the selected item highlighted even when the ListView has lost focus. This makes the property HideSelection which still exists kind of useless...
[...] selection of the line in the listview[...]?If you want to see the entire line highlighted (not just the item in the first column) you must set "RowSelect" to true.
Created 4 columns in Lazarus editorWhat about property HideSelection?
ViewStyle = vsReport
Rowselect = true
Gridlines = true
Everything else are default settings.
...
Only if I click the mouse on a non-active part of the listview does the selected line show up with the proper color marking.
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...
I don't know what you are doing that HideSelection is not working - the attached demo shows that it does. Tested on Win10 and Win 7 and Lubuntu/gtk2.By not working I meant that the selected line changed color from dark blue into some light gray when I moved to the button. Previously it changed to not show at all.
Depending on the widgetset and theme, the color of the selection may change when the focus is moved away from the ListView; this is intended to give a visual feedback that the ListView is not focused any more. The normal color is given by the values of clHighlight and clHighlightText which are system colors determined by the theme setting, the non-focused color probably has no entry in the list of predefined colors.OK so I could use these color names instead of the hex RGB to make the highlight follow the theme.
By not working I meant that the selected line changed color from dark blue into some light gray when I moved to the button. Previously it changed to not show at all.
But I want the selected row to remain as is irrespective of if I click a button...
A "trick" I use sometimes (and only if absolutely needed) to do what you want is to change the focus back to the list box (or whatever control) in the button's OnClick handler. There will be some barely noticeable "flash" which, depending on your p.o.v., can be good or annoyingYes, I thought about that as well, but I did not test it.
My next step is to port the project over to Lazarus 2.0.4 on Raspbian (Debian derivative).I ended up setting the font.size property for all affected controls in the form.Show event.
It turns out that even though the project builds fine also on Linux, the form design is screwed up because a different font size is used. I did not set the font size on Windows but Lazarus used some default value (9). But on Linux it switched to using size 10 and it causes carefully aligned controls to grow in size and overlap. Bad.
But it is another topic in need of a thread of its own....