AVs if you set CheckImageKind to ckCustom
Ref: RAD Studio 12.2 (without Patch 1) Ver: V8.0.2 Commit: 10f854d - Fixed issue#1247
Hi Joachim, I was looking to try and implement a triple state for a treeview as I want the user to be able to "Remove", "Demote" or "Leave Alone" a piece of data in a file. I thought that the way to do this would be through custom check images however, I believe I've uncovered some issues.
I set the following in my code:
vstGlobalActCodes.CustomCheckImages := ilACTVTypeCheckImages;
vstGlobalActCodes.CheckImageKind := ckCustom;
where vstGlobalActCodes is a TVirtualStringTree.
When I ran the code the VTV control AVed in TBaseVirtualTree.PaintCheckImage on the line:
13962: ForegroundColor := GetRGBColor(BlendColor);
...because FCheckImage is nil in the with statement on line 13951. I looked to change this for FCustomCheckImage however I got another AV in VirtualTrees.Header.pas, PaintColumnHeader on line 5699: FImageRect.Right := FImageRect.Left + ColImageInfo.Images.Width as ColImageInfo.Images is nil. I tried to apply a fix but no images appeared for checkboxes in the VTV control.
The above AVs are because TBaseVirtualTree.SetCustomCheckImages sets FCheckImage to nil when setting FCustomCheckImages.
I messed around and found custom images can be used by setting CustomCheckImages and not changing CheckImageKind. I think the code has a bit of an identity crisis regarding whether to use FCheckImages or FCustomCheckImages to the point where CheckImageKind and FCustomCheckImages probably could be removed from the code.
Apologies, but I'm not familiar enough with the code base to suggest an overall fix for this but I think I will look to use StateImages for my triple state functionality.
If you need more information, please let me know.
regards Dave.