diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui_basegrid.pas | 21 | ||||
-rw-r--r-- | src/gui/gui_grid.pas | 9 | ||||
-rw-r--r-- | src/gui/gui_popupcalendar.pas | 6 |
3 files changed, 28 insertions, 8 deletions
diff --git a/src/gui/gui_basegrid.pas b/src/gui/gui_basegrid.pas index 79dbd899..29043086 100644 --- a/src/gui/gui_basegrid.pas +++ b/src/gui/gui_basegrid.pas @@ -72,6 +72,7 @@ type FTemp: integer; FVScrollBar: TfpgScrollBar; FHScrollBar: TfpgScrollBar; + FUpdateCount: integer; function GetFontDesc: string; function GetHeaderFontDesc: string; procedure HScrollBarMove(Sender: TObject; position: integer); @@ -133,6 +134,8 @@ type constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Update; + procedure BeginUpdate; + procedure EndUpdate; end; implementation @@ -993,7 +996,8 @@ begin FShowGrid := True; FRowSelect := False; FScrollBarStyle := ssAutoBoth; - + FUpdateCount := 0; + FFont := fpgGetFont('#Grid'); FHeaderFont := fpgGetFont('#GridHeader'); @@ -1035,5 +1039,20 @@ begin RePaint; end; +procedure TfpgBaseGrid.BeginUpdate; +begin + Inc(FUpdateCount); +end; + +procedure TfpgBaseGrid.EndUpdate; +begin + if FUpdateCount > 0 then + begin + Dec(FUpdateCount); + if FUpdateCount = 0 then + RePaint; + end; +end; + end. diff --git a/src/gui/gui_grid.pas b/src/gui/gui_grid.pas index ef56ff40..4527d7a1 100644 --- a/src/gui/gui_grid.pas +++ b/src/gui/gui_grid.pas @@ -707,8 +707,9 @@ begin Exit; //==> if TfpgStringColumn(FColumns.Items[ACol-1]).Cells[ARow-1] <> AValue then begin + BeginUpdate; TfpgStringColumn(FColumns.Items[ACol-1]).Cells[ARow-1] := AValue; - RePaint; + EndUpdate; end; end; @@ -716,8 +717,9 @@ procedure TfpgCustomStringGrid.SetColumnTitle(ACol: integer; const AValue: strin begin if ACol > ColumnCount then Exit; //==> + BeginUpdate; TfpgStringColumn(FColumns.Items[ACol-1]).Title := AValue; - RePaint; + EndUpdate; end; procedure TfpgCustomStringGrid.SetObjects(ACol, ARow: LongWord; @@ -734,8 +736,9 @@ procedure TfpgCustomStringGrid.SetColumnWidth(ACol: integer; const AValue: integ begin if ACol > ColumnCount then Exit; //==> + BeginUpdate; TfpgStringColumn(FColumns.Items[ACol-1]).Width := AValue; - RePaint; + EndUpdate; end; function TfpgCustomStringGrid.GetColumns(AIndex: integer): TfpgStringColumn; diff --git a/src/gui/gui_popupcalendar.pas b/src/gui/gui_popupcalendar.pas index e9bc41c8..0be547df 100644 --- a/src/gui/gui_popupcalendar.pas +++ b/src/gui/gui_popupcalendar.pas @@ -96,6 +96,7 @@ var lCellText: string; begin lCellText := ''; + grdName1.BeginUpdate; for r := 0 to 6 do for c := 1 to 7 do begin @@ -110,10 +111,7 @@ begin grdName1.Cells[c, r] := IntToStr(lCellDay); end; end; -// drawtext(canvas, -// msestring(inttostr(dayof(incday(ffirstdate,cell.row*7+cell.col)))), -// rect,flags1); - + grdName1.EndUpdate; end; procedure TfpgPopupCalendar.grdName1DoubleClick(Sender: TObject; |