Subject | Re: [IBO] Selected colour |
---|---|
Author | TeamIBO |
Post date | 2002-01-14T11:06:26Z |
> Can the row colour of the Non Focused grid be set to simulate thatI happen to agree, I have my own derivation of IB_Grid for
> of for eg a treeview when it is not selected(clInactive). It makes
> life a lot easier when determining which control has focus, and in
> the case of master detail, which the master record is.
specifically this requirement. To do it more easily attach the
following code to the OnGetCellProps event handler of your IB_Grid...
procedure TForm1.IB_Grid1GetCellProps(Sender: TObject; ACol,
ARow: Integer; AState: TGridDrawState; var AColor: TColor; AFont: TFont);
begin
if gdSelected in AState then
begin
if IB_Grid1.Focused then
begin
AColor := clHighlight;
AFont.Color := clHighlightText;
end
else
begin
AColor := clBtnFace;
AFont.Color := clBtnText;
end;
end;
end;
There are no predefined colors of unfocused highlighting (or not that
I am aware of) so I just used clBtnFace and clBtnText, but you can use
whatever you prefer.
hth
--
Geoff Worboys - TeamIBO
Telesis Computing