[color=#000080][i]{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
*
Unit Name : ExtStringGrid
* Autor : Daniel Wischnewski
* Copyright : Copyright © 2001, 2002 by gate(n)etwork. All Rights Reserved.
* Urheber : Daniel Wischnewski
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}[/i][/color]
[b]
unit[/b] ExtStringGrid;
[b]interface[/b]
[b]uses[/b]
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids;
[b]type[/b]
TExtInplaceEdit = [b]class[/b](TInplaceEdit)
[b]private[/b]
[b]protected[/b]
[b]public[/b]
[b]published[/b]
[b]end[/b];
TExtStringGrid = [b]class[/b](TStringGrid)
[b]private[/b]
FEditorColor: TColor;
FEditorFontColor: TColor;
[b]procedure[/b] SetEditorColor([b]const[/b] Value: TColor);
[b]procedure[/b] SetEditorFontColor([b]const[/b] Value: TColor);
[b]procedure[/b] UpdateEditor(aEditor: TInplaceEdit);
[b]protected[/b]
[b]function[/b] CreateEditor: TInplaceEdit; [b]override[/b];
[b]public[/b]
[b]constructor[/b] Create(AOwner: TComponent); [b]override[/b];
[b]published[/b]
[b]property[/b] EditorColor: TColor [b]read[/b] FEditorColor [b]write[/b] SetEditorColor [b]default[/b] clWindow;
[b]property[/b] EditorFontColor: TColor [b]read[/b] FEditorFontColor [b]write[/b] SetEditorFontColor [b]default[/b] clWindowText;
[b]end[/b];
TExtDrawGrid = [b]class[/b](TDrawGrid)
[b]private[/b]
FEditorColor: TColor;
FEditorFontColor: TColor;
[b]procedure[/b] SetEditorColor([b]const[/b] Value: TColor);
[b]procedure[/b] SetEditorFontColor([b]const[/b] Value: TColor);
[b]procedure[/b] UpdateEditor(aEditor: TInplaceEdit);
[b]protected[/b]
[b]function[/b] CreateEditor: TInplaceEdit; [b]override[/b];
[b]public[/b]
[b]constructor[/b] Create(AOwner: TComponent); [b]override[/b];
[b]published[/b]
[b]property[/b] EditorColor: TColor [b]read[/b] FEditorColor [b]write[/b] SetEditorColor [b]default[/b] clWindow;
[b]property[/b] EditorFontColor: TColor [b]read[/b] FEditorFontColor [b]write[/b] SetEditorFontColor [b]default[/b] clWindowText;
[b]end[/b];
[b]procedure[/b] [b]Register[/b];
[b]implementation[/b]
[b]procedure[/b] [b]Register[/b];
[b]begin[/b]
RegisterComponents([color=#000080]'gate(n)etwork'[/color], [TExtStringGrid, TExtDrawGrid]);
[b]end[/b];
[color=#000080][i]{ TExtStringGrid }[/i][/color]
[b]constructor[/b] TExtStringGrid.Create(AOwner: TComponent);
[b]begin[/b]
[b]inherited[/b];
FEditorColor := clWindow;
FEditorFontColor := clWindowText;
[b]end[/b];
[b]function[/b] TExtStringGrid.CreateEditor: TInplaceEdit;
[b]begin[/b]
[color=#000080][i]// inherited;[/i][/color]
Result := TExtInplaceEdit.Create(Self);
UpdateEditor(Result);
[b]end[/b];
[b]procedure[/b] TExtStringGrid.SetEditorColor([b]const[/b] Value: TColor);
[b]begin[/b]
FEditorColor := Value;
UpdateEditor(InplaceEditor);
[b]end[/b];
[b]procedure[/b] TExtStringGrid.SetEditorFontColor([b]const[/b] Value: TColor);
[b]begin[/b]
FEditorFontColor := Value;
UpdateEditor(InplaceEditor);
[b]end[/b];
[b]procedure[/b] TExtStringGrid.UpdateEditor(aEditor: TInplaceEdit);
[b]begin[/b]
[b]if[/b] aEditor <> [b]nil[/b] [b]then[/b]
[b]if[/b] aEditor [b]is[/b] TExtInplaceEdit [b]then[/b]
[b]with[/b] TExtInplaceEdit(aEditor) [b]do[/b]
[b]begin[/b]
Color := FEditorColor;
Font.Color := FEditorFontColor;
[b]end[/b];
[b]end[/b];
[color=#000080][i]{ TExtDrawGrid }[/i][/color]
[b]constructor[/b] TExtDrawGrid.Create(AOwner: TComponent);
[b]begin[/b]
[b]inherited[/b];
FEditorColor := clWindow;
FEditorFontColor := clWindowText;
[b]end[/b];
[b]function[/b] TExtDrawGrid.CreateEditor: TInplaceEdit;
[b]begin[/b]
[color=#000080][i]// inherited;[/i][/color]
Result := TExtInplaceEdit.Create(Self);
UpdateEditor(Result);
[b]end[/b];
[b]procedure[/b] TExtDrawGrid.SetEditorColor([b]const[/b] Value: TColor);
[b]begin[/b]
FEditorColor := Value;
UpdateEditor(InplaceEditor);
[b]end[/b];
[b]procedure[/b] TExtDrawGrid.SetEditorFontColor([b]const[/b] Value: TColor);
[b]begin[/b]
FEditorFontColor := Value;
UpdateEditor(InplaceEditor);
[b]end[/b];
[b]procedure[/b] TExtDrawGrid.UpdateEditor(aEditor: TInplaceEdit);
[b]begin[/b]
[b]if[/b] aEditor <> [b]nil[/b] [b]then[/b]
[b]if[/b] aEditor [b]is[/b] TExtInplaceEdit [b]then[/b]
[b]with[/b] TExtInplaceEdit(aEditor) [b]do[/b]
[b]begin[/b]
Color := FEditorColor;
Font.Color := FEditorFontColor;
[b]end[/b];
[b]end[/b];
[b]end[/b].