summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/gui/treeviewtest/treeviewtest.lpi10
-rw-r--r--examples/gui/treeviewtest/treeviewtest.lpr12
-rw-r--r--src/gui/gui_tree.pas15
3 files changed, 28 insertions, 9 deletions
diff --git a/examples/gui/treeviewtest/treeviewtest.lpi b/examples/gui/treeviewtest/treeviewtest.lpi
index 4990220b..4e659945 100644
--- a/examples/gui/treeviewtest/treeviewtest.lpi
+++ b/examples/gui/treeviewtest/treeviewtest.lpi
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
- <Version Value="5"/>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value=".\"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<VersionInfo>
@@ -17,14 +17,13 @@
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
- <DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -43,7 +42,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/examples/gui/treeviewtest/treeviewtest.lpr b/examples/gui/treeviewtest/treeviewtest.lpr
index 101668f2..562ca8bb 100644
--- a/examples/gui/treeviewtest/treeviewtest.lpr
+++ b/examples/gui/treeviewtest/treeviewtest.lpr
@@ -26,6 +26,7 @@ type
constructor TMainForm.Create(AOwner: TComponent);
var
n: TfpgTreeNode;
+ n2: TfpgTreeNode;
i: integer;
s: string;
begin
@@ -50,12 +51,21 @@ begin
for i := 1 to 3 do
begin
s := Format('Node 2.2.%d', [i]);
- n.AppendText(s);// + ' ' + s + ' ' + s);
+ if i = 2 then
+ n2 := n.AppendText(s)
+ else
+ n.AppendText(s);
end;
n.Parent.AppendText('Node 2.3');
tree.RootNode.FirstSubNode.Next.Collapse;
tree.RootNode.AppendText('Node 3');
tree.Selection := n;
+// n := tree.RootNode.FindSubNode('Node 2.2.2', True);
+ if Assigned(n2) then
+ begin
+ n2.AppendText('Child 1').AppendText('Child 2');
+ n2.Collapsed := False;
+ end;
end;
diff --git a/src/gui/gui_tree.pas b/src/gui/gui_tree.pas
index aef8507d..b1328b14 100644
--- a/src/gui/gui_tree.pas
+++ b/src/gui/gui_tree.pas
@@ -27,7 +27,7 @@ unit gui_tree;
text and data.
* Implement event handlers the user can hook into and do custom drawing.
- WARNING: This is still under heavy development! Do NOT use yet.
+ WARNING: This is still under heavy development. Use at own risk!
}
{.$Define Debug}
@@ -1268,12 +1268,23 @@ begin
end; { if/else }
Canvas.SetLineStyle(1, FTreeLineStyle);
- if h.Count > 0 then // subnodes?
+ if h.Count > 0 then // do we have subnodes?
begin
+ // small horizontal line above rectangle for first subnode (with children) only
+ if (h <> RootNode.FirstSubNode) then
+ begin
+ if (h.Parent.FirstSubNode = h) then
+ begin
+ Canvas.SetLineStyle(1, FTreeLineStyle);
+ Canvas.DrawLine(w - FXOffset - GetColumnWidth(i1) div 2 + 1, ACenterPos - 7, w - FXOffset - GetColumnWidth(i1) div 2 + 1, ACenterPos - 3);
+ end;
+ end;
+
// subnode rectangle around the "+" or "-"
Canvas.SetColor(FTreeLineColor);
Canvas.SetLineStyle(1, lsSolid); // rectangle is always solid line style
Canvas.DrawRectangle(w - FXOffset - GetColumnWidth(i1) div 2 - 3, ACenterPos - 3, 9, 9);
+
Canvas.SetColor(clText1);
if h.Collapsed then