掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
TreeViewの展開 (ID:39521)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
TreeView1を配置しております、FORMを開いたときにBookMark.txtから読み込むようになっていますが読み込んだ際に全てのフォルダが開いた状態になってほしいのですが方法がわかりません、自分なりに//この部分 の所に TreeView1.FullExpand(); Node.Collapse(False); Node.Expand(False); などを入れてみましたが思ったようにいきません。 宜しくお願いします。 if FileExists('BookMark.txt') = True then begin SL1 := TStringList.Create; try SL1.LoadFromFile('BookMark.txt'); // ブックマークは、 intLevelB := 0; // ノードの階層レベル,タイトル,URL Node := nil; // の形式で格納してある。 for i := 0 to SL1.Count - 1 do begin strLine := SL1.Strings[i]; intA := Pos(',', strLine); for n := Length(strLine) downto 1 do begin if strLine[n] = ',' then begin intB := n; Break; end; end; try intLevelA := StrToInt(Copy(strLine, 1, intA - 1)); except on EConvertError do begin ShowMessage('ブックマークの読み込みに失敗しました。'); Exit; end; end; // 読み込んだ設定ファイルをFolderに反映 strTitle := Copy(strLine, intA + 1, intB - intA - 1); New(P); P^.URL := Copy(strLine, intB + 1, Length(strLine) - intB); Node := TreeView1.Items.AddObject(Node, strTitle, P); if intLevelB > intLevelA then begin intLevelB := intLevelA; while Node.Level > intLevelA do begin Node.MoveTo(Node.Parent, naAdd); //この部分 end; end else if intLevelB < intLevelA then begin Node.MoveTo(Node.GetPrev, naAddChild); intLevelB := intLevelA; //この部分 end; end; // TreeView1.FullCollapse; //この部分 finally SL1.Free; end; end; Book.txt の中身 0,検索,Folder 1,Google,http://www.google.co.jp/
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.