summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-01-13 10:41:22 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-01-13 10:41:22 +0200
commitc7a7fbd8a43b28aff454b68865a4924b02b3bd44 (patch)
tree6a76acfdb9f73c9e4f424514539e580fa22930fa /src
parent6de12d9d6ca9ac113640b0dba1e3aabb479ca007 (diff)
downloadfpGUI-c7a7fbd8a43b28aff454b68865a4924b02b3bd44.tar.xz
treeview: various changes due to new resizing behaviour of toolkit
* Also fixed the issue where the treeview did not always display in the UI Designer. * When the treeview is in the UI Designer, then only limited painting occurs.
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_tree.pas43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/gui/fpg_tree.pas b/src/gui/fpg_tree.pas
index 2397417e..ffc5ec9a 100644
--- a/src/gui/fpg_tree.pas
+++ b/src/gui/fpg_tree.pas
@@ -1297,9 +1297,8 @@ begin
writeln(Classname, '.HandleResize');
{$ENDIF}
inherited HandleResize(awidth, aheight);
- if (csLoading in ComponentState) then
- exit;
- ResetScrollbar;
+ if not (csLoading in ComponentState) then
+ ResetScrollbar;
RePaint;
end;
@@ -1440,9 +1439,8 @@ end;
procedure TfpgTreeview.HandleShow;
begin
- if (csLoading in ComponentState) then
- Exit;
- ResetScrollbar;
+ if not (csLoading in ComponentState) then
+ ResetScrollbar;
inherited HandleShow;
end;
@@ -1465,16 +1463,21 @@ begin
writeln('TfpgTreeview.HandlePaint');
{$ENDIF}
// inherited HandlePaint;
- if not HasHandle then
- Exit; //==>
- i1 := 0;
- PreCalcColumnLeft;
- UpdateScrollbars;
- AVisibleHeight := VisibleHeight;
- Canvas.BeginDraw; // start double buffering
Canvas.ClearClipRect;
Canvas.Clear(FBackgroundColor);
+
+ // Limit painting in the UI Designer
+ if csDesigning in ComponentState then
+ begin
+ Canvas.SetColor(clInactiveWgFrame);
+ r.SetRect(0, 0, Width, Height);
+ Canvas.DrawRectangle(r);
+ Canvas.SetTextColor(clInactiveWgFrame);
+ Canvas.DrawString(2, 2, Name + ': ' + Classname);
+ Exit;
+ end;
+
if FFocused then
Canvas.SetColor(clWidgetFrame)
else
@@ -1482,6 +1485,15 @@ begin
r.SetRect(0, 0, Width, Height);
Canvas.DrawRectangle(r); // border
+ i1 := 0;
+ PreCalcColumnLeft;
+ UpdateScrollbars;
+ AVisibleHeight := VisibleHeight;
+
+
+// if not HasHandle then
+// Exit; //==>
+
{ TODO : Columns need to be redesigned completely }
if ShowColumns then
begin
@@ -1720,7 +1732,6 @@ begin
break; //==>
end;
end; { while h <> nil }
- Canvas.EndDraw;
end;
procedure TfpgTreeview.DrawHeader(ACol: integer; ARect: TfpgRect;
@@ -2021,8 +2032,8 @@ begin
FDefaultColumnWidth := 15;
FFirstColumn := nil;
FFont := fpgGetFont('#Label1');
- FWidth := 150;
- FHeight := 100;
+ Width := 150;
+ Height := 100;
FHScrollbar := TfpgScrollbar.Create(self);
FHScrollbar.Orientation := orHorizontal;