diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2009-09-30 00:55:15 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2009-09-30 00:55:15 +0200 |
commit | 8f407a348cc872e90011df94bfb4dbd99fe28e51 (patch) | |
tree | b0db3862f7d631dbb69084af9938e39f1ebc3b5a /src/frm_main.pas | |
parent | f2521c3d72db3fe92c8290ca323f9766ef652095 (diff) | |
download | fpGUI-8f407a348cc872e90011df94bfb4dbd99fe28e51.tar.xz |
Implement AddChildNodes() but it still needs testing.
Signed-off-by: Graeme Geldenhuys <graemeg@gmail.com>
Diffstat (limited to 'src/frm_main.pas')
-rw-r--r-- | src/frm_main.pas | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/frm_main.pas b/src/frm_main.pas index 6aa96a9d..7851a5a0 100644 --- a/src/frm_main.pas +++ b/src/frm_main.pas @@ -227,10 +227,41 @@ end; procedure TMainForm.AddChildNodes(AHelpFile: THelpFile; AParentNode: TfpgTreeNode; ALevel: longint; var ATopicIndex: longint); +var + Topic: TTopic; + Node: TfpgTreeNode; begin - // ProfileEvent('SubNode with TopicIndex of ' + IntToStr(ATopicIndex)); - inc( ATopicIndex ); + + Node := nil; + while ATopicIndex < AHelpFile.TopicCount do + begin + Topic := AHelpFile.Topics[ ATopicIndex ]; + if Topic.ShowInContents then + begin + if Topic.ContentsLevel < ALevel then + break; + + if Topic.ContentsLevel = ALevel then + begin + Node := AParentNode.AppendText(Topic.Title); + Node.Data := Topic; + inc( ATopicIndex ); + end + else + begin + AddChildNodes( AHelpFile, + Node, + Topic.ContentsLevel, + ATopicIndex ); + Node := nil; + end + end + else + begin + inc( ATopicIndex ); + end; + end; { while } end; constructor TMainForm.Create(AOwner: TComponent); |