diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2009-02-04 14:00:45 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2009-02-04 14:00:45 +0000 |
commit | fa6745346420b9d4df1f5bbb32132e26cf0ce000 (patch) | |
tree | 7a3de1c26bba577eb5638e86fb34e63e5e91f061 | |
parent | 837d6ef5259b48a86af26d551a611285f6fffa38 (diff) | |
download | fpGUI-fa6745346420b9d4df1f5bbb32132e26cf0ce000.tar.xz |
* CustomGrid now calls Update instead of Repaint. This now conforms to BeginUpdate..EndUpdate requests.
* StringGrid now has a Clear method.
-rw-r--r-- | src/corelib/fpg_base.pas | 3 | ||||
-rw-r--r-- | src/gui/fpg_basegrid.pas | 10 | ||||
-rw-r--r-- | src/gui/fpg_customgrid.pas | 44 | ||||
-rw-r--r-- | src/gui/fpg_grid.pas | 12 |
4 files changed, 45 insertions, 24 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 15270468..7c89f40a 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -81,7 +81,7 @@ const FPGM_MOVE = 16; FPGM_POPUPCLOSE = 17; FPGM_HINTTIMER = 18; - FPGM_CUSTOM = 50000; + FPGM_USER = 50000; FPGM_KILLME = High(Integer); // The special keys, based on the well-known keyboard scan codes @@ -603,7 +603,6 @@ implementation uses fpg_main, // needed for fpgApplication & fpgNamedColor fpg_utils, // needed for fpgFileList - fpg_constants, typinfo; diff --git a/src/gui/fpg_basegrid.pas b/src/gui/fpg_basegrid.pas index a1cc01d0..6a1fd8b0 100644 --- a/src/gui/fpg_basegrid.pas +++ b/src/gui/fpg_basegrid.pas @@ -392,8 +392,9 @@ begin FFocusRow := 0; if FFocusRow > RowCount-1 then FFocusRow := RowCount-1; - - FollowFocus; + +// FollowFocus; + Update; CheckFocusChange; end; @@ -1150,7 +1151,10 @@ end; procedure TfpgBaseGrid.Update; begin - UpdateScrollBars; + if csUpdating in ComponentState then + Exit; + +// UpdateScrollBars; FollowFocus; RePaint; end; diff --git a/src/gui/fpg_customgrid.pas b/src/gui/fpg_customgrid.pas index b5a6c191..ed3b3a89 100644 --- a/src/gui/fpg_customgrid.pas +++ b/src/gui/fpg_customgrid.pas @@ -123,7 +123,8 @@ begin begin FocusRow := 0; FocusCol := 0; - Repaint; +// Repaint; + Update; end; end; @@ -136,7 +137,8 @@ begin begin TfpgGridColumn(FColumns.Items[i]).TextColor := AValue; end; - Repaint; +// Repaint; + Update; end; function TfpgCustomGrid.GetColumns(AIndex: integer): TfpgGridColumn; @@ -203,10 +205,12 @@ begin // graemeg 2008-07-18: I believe after all the repaint and event fixes // this check is not required anymore. -// if csUpdating in ComponentState then -// Exit; - UpdateScrollBars; - RePaint; + //if csUpdating in ComponentState then + //Exit; + Update; + //UpdateScrollBars; + //RePaint; + end; procedure TfpgCustomGrid.SetRowCount(const AValue: Integer); @@ -220,10 +224,11 @@ begin // graemeg 2008-07-18: I believe after all the repaint and event fixes // this check is not required anymore. -// if csUpdating in ComponentState then -// Exit; - UpdateScrollBars; - RePaint; + //if csUpdating in ComponentState then + //Exit; + Update; +// UpdateScrollBars; +// RePaint; end; function TfpgCustomGrid.GetColumnWidth(ACol: Integer): integer; @@ -246,8 +251,9 @@ begin lCol.Width := 1 else lCol.Width := AValue; - UpdateScrollBars; - Repaint; + Update; + //UpdateScrollBars; + //Repaint; end; end; @@ -268,8 +274,8 @@ begin if lCol.FBackgroundColor <> AValue then begin lCol.FBackgroundColor := AValue; -// UpdateScrollBars; - Repaint; + Update; + //Repaint; end; end; @@ -332,11 +338,11 @@ begin i := FColumns.Add(Result); DoAfterAddColumn(i); // update empty cells in descendants - if csUpdating in ComponentState then - Exit; //==> - - UpdateScrollBars; - RePaint; + //if csUpdating in ComponentState then + //Exit; //==> + Update; + //UpdateScrollBars; + //RePaint; end; procedure TfpgCustomGrid.DeleteColumn(AIndex: integer); diff --git a/src/gui/fpg_grid.pas b/src/gui/fpg_grid.pas index 3eecf7c1..5eda16f7 100644 --- a/src/gui/fpg_grid.pas +++ b/src/gui/fpg_grid.pas @@ -116,6 +116,7 @@ type property ColumnTextColor; // property Cols[index: Integer]: TStrings read GetCols write SetCols; // property Rows[index: Integer]: TStrings read GetRows write SetRows; + procedure Clear; end; @@ -528,5 +529,16 @@ begin Update; end; +procedure TfpgCustomStringGrid.Clear; +var + i: integer; +begin + for i := FColumns.Count-1 downto 0 do + TfpgStringColumn(FColumns[i]).Free; + FColumns.Clear; + FRowCount := 0; + Update; +end; + end. |