summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-09-08 13:45:29 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-09-08 13:45:29 +0000
commitb55202b53d73ea58e7ec050191e9a6380fd38275 (patch)
treee0d304428a0e1f38c9d9e8a3bcd95ce0dbb2e9a5 /src/gui
parent9a5d0e656f23ba98cf3f80a7462c95c58f7e5b86 (diff)
downloadfpGUI-b55202b53d73ea58e7ec050191e9a6380fd38275.tar.xz
* TfpgBaseGrid's FocusCol and FocusRow now defaults to -1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui_basegrid.pas8
-rw-r--r--src/gui/gui_customgrid.pas12
2 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/gui_basegrid.pas b/src/gui/gui_basegrid.pas
index 98d4359b..aa9cc0b9 100644
--- a/src/gui/gui_basegrid.pas
+++ b/src/gui/gui_basegrid.pas
@@ -129,8 +129,8 @@ type
property FontDesc: string read GetFontDesc write SetFontDesc;
property HeaderFont: TfpgFont read FHeaderFont;
property HeaderFontDesc: string read GetHeaderFontDesc write SetHeaderFontDesc;
- property FocusCol: Integer read FFocusCol write SetFocusCol;
- property FocusRow: Integer read FFocusRow write SetFocusRow;
+ property FocusCol: Integer read FFocusCol write SetFocusCol default -1;
+ property FocusRow: Integer read FFocusRow write SetFocusRow default -1;
property RowSelect: boolean read FRowSelect write SetRowSelect;
property ColumnCount: Integer read GetColumnCount;
property RowCount: Integer read GetRowCount;
@@ -1093,9 +1093,9 @@ begin
Focusable := True;
Width := 120;
Height := 80;
- FFocusCol := 0;
+ FFocusCol := -1;
FPrevCol := -1;
- FFocusRow := 0;
+ FFocusRow := -1;
FPrevRow := -1;
FFirstRow := 0;
FFirstCol := 0;
diff --git a/src/gui/gui_customgrid.pas b/src/gui/gui_customgrid.pas
index 0efa0edb..7b5aa52f 100644
--- a/src/gui/gui_customgrid.pas
+++ b/src/gui/gui_customgrid.pas
@@ -64,6 +64,7 @@ type
protected
FRowCount: Integer;
FColumns: TList;
+ procedure HandleSetFocus; override;
procedure SetTextColor(const AValue: TfpgColor); override;
function GetColumns(AIndex: integer): TfpgGridColumn; virtual;
procedure DoDeleteColumn(ACol: integer); virtual;
@@ -114,6 +115,17 @@ begin
Result := FRowCount;
end;
+procedure TfpgCustomGrid.HandleSetFocus;
+begin
+ inherited HandleSetFocus;
+ if (GetRowCount > 0) and (FocusRow = -1) then
+ begin
+ FocusRow := 0;
+ FocusCol := 0;
+ Repaint;
+ end;
+end;
+
procedure TfpgCustomGrid.SetTextColor(const AValue: TfpgColor);
var
i: integer;