From af854e41c0f98acec4be31efe1d6690cefa60554 Mon Sep 17 00:00:00 2001 From: graemeg Date: Thu, 12 Jun 2008 14:40:49 +0000 Subject: * Minor fixes to csUpdating ComponentState in Grids. * fpgApplication now closes all forms created via fpgApplication.CreateForm() before the main form when the application terminates. * Minor documentation update for fpgfx.pas unit. --- src/corelib/gfxbase.pas | 6 ++++++ src/gui/gui_basegrid.pas | 5 +++++ src/gui/gui_customgrid.pas | 2 +- src/gui/gui_grid.pas | 4 +++- 4 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/gfxbase.pas b/src/corelib/gfxbase.pas index 03aae37d..6e419d72 100644 --- a/src/corelib/gfxbase.pas +++ b/src/corelib/gfxbase.pas @@ -1938,7 +1938,13 @@ begin end; procedure TfpgApplicationBase.Terminate; +var + i: integer; begin + // make sure all forms are closed before main form + for i := FormCount - 1 downto 0 do + if Forms[i] <> MainForm then + fpgSendMessage(Self, Forms[i], FPGM_CLOSE); // SendMessage waits for it to complete. Post doesn't. Terminated := True; end; diff --git a/src/gui/gui_basegrid.pas b/src/gui/gui_basegrid.pas index 4f2382f3..a2ca441c 100644 --- a/src/gui/gui_basegrid.pas +++ b/src/gui/gui_basegrid.pas @@ -95,6 +95,7 @@ type function VisibleHeight: integer; procedure SetFirstRow(const AValue: Integer); protected + property UpdateCount: integer read FUpdateCount; procedure UpdateScrollBars; virtual; function GetHeaderText(ACol: Integer): string; virtual; function GetColumnWidth(ACol: Integer): integer; virtual; @@ -1148,6 +1149,7 @@ end; procedure TfpgBaseGrid.BeginUpdate; begin Inc(FUpdateCount); + Updating; end; procedure TfpgBaseGrid.EndUpdate; @@ -1156,7 +1158,10 @@ begin begin Dec(FUpdateCount); if FUpdateCount = 0 then + begin + Updated; RePaint; + end; end; end; diff --git a/src/gui/gui_customgrid.pas b/src/gui/gui_customgrid.pas index 1ed59e6f..dc2c0631 100644 --- a/src/gui/gui_customgrid.pas +++ b/src/gui/gui_customgrid.pas @@ -298,7 +298,7 @@ begin Result.Backgroundcolor := clBoxcolor; Result.TextColor := TextColor; FColumns.Add(Result); - + if csUpdating in ComponentState then Exit; //==> diff --git a/src/gui/gui_grid.pas b/src/gui/gui_grid.pas index eaeb9ddc..2284bec1 100644 --- a/src/gui/gui_grid.pas +++ b/src/gui/gui_grid.pas @@ -469,7 +469,9 @@ begin for r := 0 to RowCount-1 do Result.Cells.Append(''); - Updated; + + if UpdateCount = 0 then + Updated; // if we called .BeginUpdate then don't clear csUpdating here end; end. -- cgit v1.2.3-70-g09d2