I'm trying to allow editing of select cells in a TAdvListview said cells being subItems - the listview style is vsReport and I have several items worth of data populating it.
I have ReadOnly false, Rowselect False, SubItemSelect True, SubItemEdit True, and in the CanEditCell event I have set Allow = True for all events for testing purposes.
And, nothing happens when I click on a cell and the CanEditCell event doesn't even fire.
What am I missing.
Some additional information - I'm using Delphi 7 under Windows 7 64-bit Home Premium and the version of the advlistview I'm using is 220.127.116.11.
I've gotten the cell editing to kick in a few different ways by calling StartEdit from various events - it seems to work as in the cell in question is editable but there's some repainting going on under the hood and every time it seems some random cell on the same row always goes blank. When I'm done with the edit as in leave the cell or control all the blank cells come back.
Same problem here with a much more recent version 18.104.22.168 of TAdvListView. The only difference in my case is that it's always column 0 which gets blank, meaning the item caption itself is not rendered if subediting is active.
FItemCaption := GetTextAtColRow(0, FItemIndex);
I have retested this with a default TAdvListView on the form and the following code:
Editing SubItems works for me as well and did in the end for the original poster... But what is with the caption of the item, which is column 0 in vsReport? Is it shown properly if you edit a sub item? It is not in my case and wasn't when I tested in a clean project with a fresh AdvListView without any of my code.
I tested with another clean project again and it seems that activating "OwnerDraw" itself is the necessary bit: If deactivated the rendering looks better, but the caption is missing. If activated, the rendering lokks a bit more old school, but the caption is visible now!
The default drawing in a TListView doesn't support subitem selection drawing unfortunately, so it is only possible when doing custom drawing.
Make sense of course. Would be really cool if there was some mechanism to automatically activate OwnerDraw if SubItemEdit gets selected... But I guess such dependencies are not possible in the IDE?
Yes, that is a good tip to preset OwnerDraw when SubItemEdit is needed. We have extended the component for this and the next update will handle it this way.