<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi<br>
<br>
I have a TStringGrid where I have set up my own OnDrawCell handling.
In this new OnDrawCell function I have set up to change behaviour if
aCol is 1 and aRow is larger than 0. If not in selected range I call
the TStringGrid(Sender).DefaultDrawCell function.<br>
<br>
This seems to be working well excepts for that it does not react to
changes in the state (specific selected). All cells that are drawn
are just displayed with their text values and no indication if they
are selected or not. The properties I have set are :<br>
<br>
DefaultDrawing = False<br>
Options.RowSelect = True<br>
<br>
and OnDrawCell.<br>
<br>
The overriden OnDrawCell function is (nothing fancy, just to test) :<br>
<br>
procedure TForm1.StringGrid1DrawCell(Sender: TObject; aCol, aRow:
integer;<br>
aRect: TRect; aState: TGridDrawState);<br>
begin<br>
if (aCol = 1) and (aRow > 0) then<br>
begin<br>
TStringGrid(Sender).Canvas.Pen.Color := clRed;<br>
TStringGrid(Sender).Canvas.Line(aRect);<br>
end<br>
else<br>
TStringGrid(Sender).DefaultDrawCell(aCol, aRow, aRect, aState);<br>
end;<br>
<br>
I can implement gdSelected<span class="Apple-style-span"
style="color: rgb(0, 0, 0); font-family: 'dejavu sans
mono',monaco,'lucida console','courier new',monospace; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 15px; orphans: 2; text-indent: 0px;
text-transform: none; white-space: nowrap; widows: 2;
word-spacing: 0px; background-color: rgb(238, 238, 255);
font-size: x-small;"></span> in my code to handle the columns
where I have decided to custom draw the content but should not the
DefaultDrawCell function ensure that all the other cells where
properly drawn (not just the content but also the state if selected)
?<br>
<br>
BR<br>
Eirik<br>
<br>
(I'm using Lazarus 0.9.30 on Ubuntu and Lazarus 0.9.31 on Windows.
Both displays the same result).<br>
<br>
</body>
</html>