<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBS, Jscript, HTA, ActiveX. Рекурсивная генерация дерева TreeView]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=7140</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7140&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBS, Jscript, HTA, ActiveX. Рекурсивная генерация дерева TreeView».]]></description>
		<lastBuildDate>Sun, 29 Apr 2012 20:00:35 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: VBS, Jscript, HTA, ActiveX. Рекурсивная генерация дерева TreeView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=59830#p59830</link>
			<description><![CDATA[<p>HTA:<br /></p><div class="codebox"><pre><code>&lt;HTML&gt;
&lt;HEAD&gt;
&lt;META content = &quot;TEXT/HTML; charset=Windows-1251&quot;&gt;
&lt;TITLE&gt;Пример TreeView в HTA&lt;/TITLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;FORM ID = mForm&gt;
&lt;TABLE style = width:100%&gt;
&lt;TR&gt;&lt;TD style = width:30%&gt;
&lt;OBJECT ID = ExampleTreeView WIDTH = 600 HEIGHT = 400 PROGID = &quot;MSComctlLib.TreeCtrl.2&quot; CLASSID=&quot;clsid:C74190B6-8589-11D1-B16A-00C0F0283628&quot;&gt;
    &lt;param name = &quot;LineStyle&quot; value = &quot;1&quot; /&gt;
    &lt;param name = &quot;Style&quot; value = &quot;7&quot; /&gt;
    &lt;param name = &quot;Appearance&quot; value = &quot;0&quot;/&gt;
    &lt;param name = &quot;BorderStyle&quot; value = &quot;1&quot;/&gt;
&lt;/OBJECT&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;INPUT type = &quot;button&quot; name = &quot;fill&quot; value = &quot;Заполнить ...&quot;&gt;
&lt;/TD&gt;&lt;/TR&gt;
&lt;/TABLE&gt;
&lt;/FORM&gt;
&lt;SCRIPT for = ExampleTreeView event = NodeClick&gt;
    document.title=mForm.all(&quot;ExampleTreeView&quot;).SelectedItem.FullPath;
&lt;/SCRIPT&gt;
&lt;SCRIPT language = &quot;JScript&quot;&gt;
Enumerator.prototype.toArray = function ()
{
    var Result = [];
    for (;!this.atEnd();this.moveNext())
    Result.push(this.item())
    return Result;
}

var fso = new ActiveXObject(&quot;Scripting.FileSystemObject&quot;);

function GetSubFolders(Path) // return Array
{
    var F=fso.GetFolder(Path);
    return new Enumerator(F.SubFolders).toArray();
}

var WSH = new ActiveXObject(&quot;WScript.Shell&quot;);

function filltreeview()
{
    var TreeView = mForm.all(&quot;ExampleTreeView&quot;);
    TreeView.Nodes.Clear();
 
var nodes = GetSubFolders(&quot;C:\\&quot;);
var index=0;

for (var i=0, l=nodes.length; i&lt;l;i++)
{
    var node = TreeView.Nodes.Add();
    node.Text = nodes[i].Name;
    node.key = &quot;key&quot;+index++;
    node.selected = true;
    
    var childs = GetSubFolders(nodes[i].Path);
    for (var j=0, k=childs.length;j&lt;k;j++)
    {
        var subnode = TreeView.Nodes.Add();
        subnode.Text = childs[j].Name;
        subnode.key = &quot;key&quot;+index++;
        subnode.selected = false;
        subnode.Parent = node;
    }
    node.Expanded = false;
}
};

//Реакция на события
mForm.all(&quot;fill&quot;).onclick = filltreeview

&lt;/SCRIPT&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (JSmаn)]]></author>
			<pubDate>Sun, 29 Apr 2012 20:00:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=59830#p59830</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS, Jscript, HTA, ActiveX. Рекурсивная генерация дерева TreeView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=59820#p59820</link>
			<description><![CDATA[<p>Почему свойство Parent не используете?</p>]]></description>
			<author><![CDATA[null@example.com (JSmаn)]]></author>
			<pubDate>Sun, 29 Apr 2012 18:10:47 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=59820#p59820</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS, Jscript, HTA, ActiveX. Рекурсивная генерация дерева TreeView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=59816#p59816</link>
			<description><![CDATA[<p>Не получается даже без цикла добавлять ветки.</p>]]></description>
			<author><![CDATA[null@example.com (Mat Skywalker)]]></author>
			<pubDate>Sun, 29 Apr 2012 12:19:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=59816#p59816</guid>
		</item>
		<item>
			<title><![CDATA[VBS, Jscript, HTA, ActiveX. Рекурсивная генерация дерева TreeView]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=59663#p59663</link>
			<description><![CDATA[<p>Опять я со своими заморочками. Пилил я тему отображения treeview в HTA приложении.<br />Задача была такая, есть таблица из 3-х столбцов:<br />ИД | ИД родителя | Наименование<br />Нужно построить из него дерево.<br />Пробовал так:<br /></p><div class="codebox"><pre><code>
Set objRecordset = SQLConn.Execute(SQLstr)&#039; Строим список первого уровня
TreeView.Nodes.Clear()
While Not objRecordset.EOF
if objRecordset.Fields(2).Value = 1 then
set Node = TreeView.Nodes.Add(,,&quot;First&quot;)
with Node
   Node.Text = objRecordset.Fields(3).Value
   Node.key = &quot;n&quot;+cstr(objRecordset.Fields(0).Value) &#039; Заполняем
end with
end if
objRecordset.MoveNext
Wend</code></pre></div><p>Код выполняется и список получается. Но <strong>не</strong> получается добавить туда ветки. <a href="http://forum.script-coding.com/viewtopic.php?id=1219">http://forum.script-coding.com/viewtopic.php?id=1219</a> - тут вроде все понятно, но заставить генерировать дерево не получилось. Максимальная глубина вложения дерева 5 элементов. Т.е. можно написать в программе 5 раз заполнение листов дерева. Но как добавить листы не знаю.</p>]]></description>
			<author><![CDATA[null@example.com (Mat Skywalker)]]></author>
			<pubDate>Mon, 23 Apr 2012 07:10:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=59663#p59663</guid>
		</item>
	</channel>
</rss>
