I just read your post on the bugtracker and thought maybe I should try to clarify what I am attempting.
If you put this same code into a TTreeView object, the results are exactly as expected; well almost. TTreeView under Linux correctly changes the .Canvas.Font.Style, however, it does not render the .Canvas.Font.Color
procedure TForm1.TreeView1AdvancedCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; Stage: TCustomDrawStage;
var PaintImages, DefaultDraw: Boolean);
begin
if (pos('Van', Node.Text) > 0) then
begin
TreeView1.Canvas.Font.Style := [fsBold,fsItalic];
TreeView1.Canvas.Font.Color := clRed;
end
else
begin
TreeView1.Canvas.Font.Style := [];
TreeView1.Canvas.Font.Color := clBlue;
end;
end;
If I use this code in Lazarus under WinXP; still using GTK2, it will render correctly in both TTreeView and TListView.
The next issue is when attempting to place a graphic on the control. I use this code to embed a .jpeg image at the bottom portion of the TTreeView and TListView.
procedure TForm1.TreeView1AdvancedCustomDraw(Sender: TCustomTreeView;
const ARect: TRect; Stage: TCustomDrawStage; var DefaultDraw: Boolean);
begin
TreeView1.Canvas.Draw(50,175,tstIcon);
end;
procedure TForm1.ListView1AdvancedCustomDraw(Sender: TCustomListView;
const ARect: TRect; Stage: TCustomDrawStage; var DefaultDraw: Boolean);
begin
TreeView1.Canvas.Draw(50,175,tstIcon);
end;
As you can see in the image, this almost works as expected (the .Font.Color issue) in TTreeView (the control on the right; TListView is on the left) however not in TListView. Of course, both Lazarus and Turbo Delphi under WinXP produce the expected results.
In some of the trial runs, such as the code posted on bugtracker, I noticed that the text or images were drawn with the X,Y coordinates relative to the TListView, however, it seemed that it was placed on the TForm canvas - probably mistaken, but that is what is acted like.
It is because of the difference in behaviour between the Linux and WinXP environments that I feel it may be a bug issue. Of course, as I stated before, I am merely a hobby programmer and not so well versed in the inner workings of all the controls; maybe it is an 'undocumented feature' and is meant to work that way <grin>
I hope this clears the issue a little better. Again, thanks for the feedback.
geno.