summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2009-11-09 16:24:07 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2009-11-09 16:24:07 +0200
commitdb7ab7192557a4fb8816ecbdead7e06f1e236652 (patch)
tree8d4435cedebc115b6d21a7100863634d7f80cc92 /src
parent7019cd79560b7291b339a29e54c7b5b14ddb5a9b (diff)
downloadfpGUI-db7ab7192557a4fb8816ecbdead7e06f1e236652.tar.xz
ListBox BeginUpdate / EndUpdate now correctly delays updates
ListBox.items.Assign(AItems) cause the listbox to redraw after every item was added - seriously delaying things. This bug has now been fixed.
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_listbox.pas15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gui/fpg_listbox.pas b/src/gui/fpg_listbox.pas
index 384704bf..9b597d20 100644
--- a/src/gui/fpg_listbox.pas
+++ b/src/gui/fpg_listbox.pas
@@ -216,7 +216,6 @@ type
TfpgListBoxStrings = class(TStringList)
protected
ListBox: TfpgTextListBox;
- procedure SetUpdateState(Updating: Boolean); override;
public
constructor Create(AListBox: TfpgTextListBox);
destructor Destroy; override;
@@ -239,12 +238,6 @@ end;
{ TfpgListBoxStrings }
-procedure TfpgListBoxStrings.SetUpdateState(Updating: Boolean);
-begin
- inherited SetUpdateState(Updating);
- // do nothing extra for now
-end;
-
constructor TfpgListBoxStrings.Create(AListBox: TfpgTextListBox);
begin
inherited Create;
@@ -260,6 +253,8 @@ end;
function TfpgListBoxStrings.Add(const s: String): Integer;
begin
Result := inherited Add(s);
+ if UpdateCount > 0 then
+ Exit;
if Assigned(ListBox) and (ListBox.HasHandle) then
begin
ListBox.UpdateScrollBar;
@@ -270,6 +265,8 @@ end;
procedure TfpgListBoxStrings.Delete(Index: Integer);
begin
inherited Delete(Index);
+ if UpdateCount > 0 then
+ Exit;
if Assigned(ListBox) and (ListBox.HasHandle) then
begin
ListBox.UpdateScrollBar;
@@ -280,6 +277,8 @@ end;
procedure TfpgListBoxStrings.Clear;
begin
inherited Clear;
+ if UpdateCount > 0 then
+ Exit;
ListBox.FocusItem := -1;
ListBox.UpdateScrollBar;
ListBox.Invalidate;
@@ -622,7 +621,7 @@ var
r: TfpgRect;
begin
//if FUpdateCount > 0 then
- //Exit; //==>
+ // Exit; //==>
inherited HandlePaint;
Canvas.ClearClipRect;