procedure TForm1.Button1Click(Sender: TObject);
var
i : integer ;
s : string ;
begin
s := '' ;
for i := 0 to TreeView1.Count-1 do
s := s + TreeView1.Items[i].Text + #13 + #10 ;
ShowMessage(s);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
n : TTreeViewItem ;
s : string ;
begin
n := TreeView1.Selected ;
if (n = nil) then
s := '項目が選択されていません'
else
s := 'レベル:' + IntToStr(n.Level)
+ ' INDEX :' + IntToStr(n.Index)
+ ' 文字:' + n.Text ;
ShowMessage(s);
end;
function Button3_Sub(n:TTreeViewItem;s:string) : string;
var
i : integer ;
c : TTreeViewItem ;
begin
for i := 0 to n.Count-1 do begin
c := n.Items[i] ;
s := s + 'Lv' + IntToStr(c.Level)
+ ' Id' + IntToStr(c.Index)
+ ' ' + c.Text + #13 + #10 ;
s := Button3_Sub(c,s) ;
end;
Result := s ;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
i : integer ;
n : TTreeViewItem ;
s : string ;
begin
s := '' ;
for i := 0 to TreeView1.Count-1 do begin
n := TreeView1.Items[i] ;
s := s + 'Lv' + IntToStr(n.Level)
+ ' Id' + IntToStr(n.Index)
+ ' ' + n.Text + #13 + #10 ;
s := Button3_Sub(n,s) ;
end;
ShowMessage(s);
end;