<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; HTA: Frame в качестве панели инструментов]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6412&amp;type=atom" />
	<updated>2011-11-08T05:41:35Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6412</id>
		<entry>
			<title type="html"><![CDATA[Re: HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53326#p53326" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Rumata пишет:</cite><blockquote><p>Ведь мы говорим о onchange именно в контексте реакции программы на изменения текста в поле ввода?</p></blockquote></div><p>Именно об этом. И без танцев с setTimeout/setInterval пожалуй в данном случае не обойтись. Положительные моменты пока не понял. Как вернусь к этой теме - попытаюсь прочувствовать. Спасибо за участие.</p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-11-08T05:41:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53326#p53326</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53325#p53325" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>dab00 пишет:</cite><blockquote><p>Некрасивое решение, согласитесь...</p></blockquote></div><p>Согласен, но лучшего нет. Когда-то я точно также расстроился по поводу onchange. Но поигравшись с setTimeout/setInterval в данном контексте я понял все положительные моменты. </p><p>setTimeout/setInterval позволяют очень гибко реагировать на изменения в поле ввода. Посмотрите хорошую статью по теме. Там кратко и просто расписано обсуждаеомое - <a href="http://alljs.ru/articles/timeout/patterns">http://alljs.ru/articles/timeout/patterns</a>. Ведь мы говорим о onchange именно в контексте реакции программы на изменения текста в поле ввода?</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2011-11-08T05:18:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53325#p53325</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53324#p53324" />
			<content type="html"><![CDATA[<p>onblur тоже пробовал - фишка в том, что событие не происходит, т.к. меняется фрейм, в общем один из минусов использования фреймов.<br /></p><div class="quotebox"><cite>Rumata пишет:</cite><blockquote><p>Для onchange существует обходное решение</p></blockquote></div><p>Некрасивое решение, согласитесь...</p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-11-08T05:00:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53324#p53324</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53318#p53318" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>dab00 пишет:</cite><blockquote><p>дизайнер я, конечно</p></blockquote></div><p>Да и я такой же. Умею всего по чуть-чуть. Когда-то приходилось немного заниматься различными модификациями html-страниц. Вот тогда и пришлось нахвататься верхушек. </p><div class="quotebox"><cite>dab00 пишет:</cite><blockquote><p>К полям ввода данных привязал событие onchange</p></blockquote></div><p>Эта задачка еще та... Хитрая очень. onchange срабатывает в момент потери элементом фокуса (blur). Посмотрите простейший пример в любом браузере:<br /></p><div class="codebox"><pre><code>&lt;input type=&quot;text&quot; onchange=&quot;alert(&#039;change: &#039; + this.value)&quot; onblur=&quot;alert(&#039;blur: &#039; + this.value)&quot; /&gt;
&lt;input type=&quot;text&quot; /&gt;</code></pre></div><p>.<br />Для onchange существует обходное решение <br /></p><div class="codebox"><pre><code>&lt;input type=&quot;text&quot; id=&quot;i&quot; /&gt;
&lt;div id=&quot;d&quot;&gt;&lt;/div&gt;
&lt;script&gt;

setInterval(function()
{
	document.getElementById(&#039;d&#039;).innerHTML = document.getElementById(&#039;i&#039;).value;
}, 100);

&lt;/script&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2011-11-07T20:01:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53318#p53318</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53309#p53309" />
			<content type="html"><![CDATA[<p>Спасибо, <strong>Rumata</strong>! Ни за что бы не догадался. Пришлось по-стариковски с фреймами <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />. <br />Честно говоря из-за фреймов с доступом к элементам немного напряженно было <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />. <br />И вот еще. К полям ввода данных привязал событие onchange, а если щелкаешь мышью в другом фрейме - событие не происходит. Чтобы хоть как-нибудь исправить ситуацию пришлось еще к этим же полям onkeydown привязывать и Enter ловить.<br />Короче респект, <strong>Rumata</strong>, найду время - обязательно перепишу без фреймов.<br />off: дизайнер я, конечно, никакой, &quot;но окошко очень красивое&quot; прям порадовало <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> - детям рисовал, старался <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-11-07T14:23:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53309#p53309</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53307#p53307" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>dab00 пишет:</cite><blockquote><p>особенно в этом направлении не морщился</p></blockquote></div><p>Мне приходилось. На самом деле решение довольно простое - надо установить относительное позиционирование элемента и фиксировать его верхнюю позицию. </p><p>Стилевое правило:<br /></p><div class="codebox"><pre><code>
.fixed	{
	position: relative;
	top: expression(content.scrollTop);
}</code></pre></div><p>.<br />Пример<br /></p><div class="codebox"><pre><code>
&lt;html&gt;
&lt;head&gt;
&lt;style type=&quot;text/css&quot;&gt;

.content	{
	height: 200px;
	overflow: auto;
	width: 200px;
}

.scrollable	{
	width: 100%;
}

th, 
td	{
	border: 1px solid #000;
	border-collapse: separate;
	width: 50%;
}

th	{
	background-color: #ccc;
}

.fixed	{
	position: relative;
	top: expression(content.scrollTop);
}

&lt;/style&gt;
&lt;head&gt;
&lt;body&gt;
&lt;div class=&quot;content&quot;&gt;

&lt;table class=&quot;scrollable&quot;&gt;
&lt;tr class=&quot;fixed&quot;&gt;&lt;th&gt;#&lt;/th&gt;&lt;th&gt;Square&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;9&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;16&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;25&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;36&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;49&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;64&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;9&lt;/td&gt;&lt;td&gt;81&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre></div><p>Можно поискать кросс-браузерное решение для фиксированного позиционирования элементов. Если это необходимо.</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2011-11-07T12:29:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53307#p53307</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53301#p53301" />
			<content type="html"><![CDATA[<p>Полностью согласен со всеми аргументами, может кроме стиля - ничто не мешает закинуть стиль из одного css-файла в любое количество HTA-, HTML-файлов. Я предпочитаю решать версткой, но в этом случае был необходим скролл в нижней части окна. Кто знает как реализовать версткой - пожалуйста, сообщите - я особенно в этом направлении не морщился - только фреймы на ум пришли - на вскидку не догоняю.</p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-11-07T05:41:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53301#p53301</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53299#p53299" />
			<content type="html"><![CDATA[<p>Панели и другие элементы взаимодействия с пользователем можно создавать с помощью фреймов, но лучше использовать блочную или табличную верстку. В этом есть определенные и вполне очевидные плюсы:<br />1. один файл, вместо 3 (панель управления + основное окно + каркас для фреймов) <br />2. единый набор стилевых правил в одном файле (внешнем либо встроенном) <br />3. единое пространство имен JavaScript и программных объектов (в случае программирования на VBScript это, видимо, не актуально, но ...) <br />4. инкапсуляция элементов управления и управляемых элементов в одном файле <br />5. смена дизайна осуществляется одного html-файла и одного css-файла (для табличной верстки) или только одного css-файла в случае блочной верстки</p><p>Если Вам нравится, а главное удобнее программировать на фреймах - ничто не мешает Вам делать именно так. </p><p>Не уверен, что мне понравился синий цвет в качестве фона, но окошко очень красивое.</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2011-11-06T20:56:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53299#p53299</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[HTA: Frame в качестве панели инструментов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53296#p53296" />
			<content type="html"><![CDATA[<p>Здравствуйте, уважаемые коллеги.<br />На досуге написал HTA для учета коллекции видео, чем хочу с вами поделиться. Предпосылкой стало отсутствие информированности детей на предмет наличия того или иного мультфильма в их домашней коллекции. Считаю интересным моментом использование фрейма в качестве панели инструментов. Кроме того, начинающих кодеров могут заинтересовать методы работы с XML, файловой системой, визуальными фильтрами Alpha и AlphaImageLoader, и пр.</p><p><span class="postimg"><img src="http://da440dil.narod.ru/videolib-images/VideoLib-v1.0-1-s.png" alt="http://da440dil.narod.ru/videolib-images/VideoLib-v1.0-1-s.png" /></span> <span class="postimg"><img src="http://da440dil.narod.ru/videolib-images/VideoLib-v1.0-2-s.png" alt="http://da440dil.narod.ru/videolib-images/VideoLib-v1.0-2-s.png" /></span></p><p>Сначала я переписал названия всех мультфильмов в TXT-файл, и лишь спустя некоторое время решил в качестве базы использовать файл XML, поэтому пришлось прочитать данные из TXT и закинуть их в XML, для чего я использовал следующий скрипт:<br /></p><div class="codebox"><pre><code>
Const TxtFile = &quot;data.txt&quot;
Const XMLFileName = &quot;data.xml&quot;
Dim dataArray()

ReadTXT
WriteXML
MsgBox &quot;Обновление файла &quot; &amp; XMLFileName &amp; &quot; завершено&quot;, vbInformation

Sub ReadTXT()
	Dim fso, objFile, i
	Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	If fso.FileExists(TxtFile) Then
		Set objFile = fso.OpenTextFile(TxtFile)
		i = 0
		Do Until objFile.AtEndOfStream
			ReDim Preserve dataArray(i)
			dataArray(i) = Trim(objFile.ReadLine)
			i = i + 1
		Loop
		Set objFile = Nothing		
	Else
		MsgBox &quot;Файл &quot; &amp; sTxtFile &amp; &quot; не найден&quot;, vbCritical, &quot;Ошибка&quot;
		WScript.Quit
	End If
	Set fso = Nothing
End Sub

Sub WriteXML()
	Dim xmlDoc, objNewNode, i
	Set xmlDoc = CreateObject(&quot;Microsoft.XMLDOM&quot;)
	If xmlDoc.Load(XMLFileName) Then		
		If xmlDoc.DocumentElement.hasChildNodes Then
			Do While xmlDoc.DocumentElement.childNodes.length &gt;= 1 
				xmlDoc.DocumentElement.removeChild(xmlDoc.DocumentElement.firstChild ) 
			Loop				
		End If		
		xmlDoc.DocumentElement.setAttribute &quot;date&quot;, Now()
		For i = 0 To UBound(dataArray)
			Set objNewNode = xmlDoc.createElement(&quot;film&quot;)				
			With objNewNode
				.setAttribute &quot;name&quot;, dataArray(i)
				.setAttribute &quot;year&quot;, &quot;?&quot;
				.setAttribute &quot;date&quot;, FormatDateTime(Now(),ddmmyyyyhhmmss)
				.setAttribute &quot;id&quot;, i
			End With
			xmlDoc.DocumentElement.AppendChild(objNewNode)
			Set objNewNode = Nothing										
		Next
		xmlDoc.Save(XMLFileName)
	Else
		MsgBox &quot;Ошибка загрузки файла &quot; &amp; XMLFileName, vbExclamation
		WScript.Quit
	End If
	Set xmlDoc = Nothing
End Sub</code></pre></div><p>Затем нарисовал основное окно, состоящее из HTA и двух HTML:<br /></p><div class="codebox"><pre><code>
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;VideoLib&lt;/title&gt;
	  &lt;HTA:APPLICATION 
		ID = &quot;VideoLib&quot;
		APPLICATIONNAME=&quot;VideoLib&quot; 
		SINGLEINSTANCE=&quot;yes&quot;
		MAXIMIZEBUTTON=&quot;no&quot;
		SELECTION=&quot;no&quot;
		Icon = &quot;daffodil.ico&quot;
		Version = &quot;1.0&quot;&gt;
		&lt;/HTA:APPLICATION&gt;
&lt;/head&gt;
&lt;script language=&quot;VBScript&quot; src=&quot;VideoLib.vbs&quot;&gt;&lt;/script&gt;
&lt;frameset rows=&quot;120,*&quot;&gt;
	&lt;frame id=&quot;menufrm&quot; src=&quot;Menu.html&quot; name=&quot;topFrame&quot; scrolling=&quot;no&quot; noresize&gt;
	&lt;frame id=&quot;mainfrm&quot; src=&quot;Main.html&quot; name=&quot;mainFrame&quot;&gt;	
&lt;/frameset&gt;
&lt;/html&gt;</code></pre></div><div class="codebox"><pre><code>
&lt;html&gt;
&lt;link href=&quot;VideoLib.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;body&gt;	
	&lt;div&gt;		
		&lt;span id=&quot;add&quot;&gt;&lt;/span&gt;		
		&lt;span id=&quot;del&quot;&gt;&lt;/span&gt;
		&lt;span id=&quot;save&quot;&gt;&lt;/span&gt;
		&lt;span id=&quot;search&quot;&gt;&lt;/span&gt;
		&lt;input id=&quot;find&quot; type=&quot;text&quot; size=&quot;41&quot;&gt;
		&lt;span id=&quot;help&quot;&gt;&lt;/span&gt;
		&lt;span id=&quot;about&quot;&gt;&lt;/span&gt;
		&lt;span id=&quot;tip&quot;&gt;Кнопки:&lt;br/&gt;
				- Добавить - добавляем новую строку в список&lt;br/&gt;
				- Удалить - отмечаем строку на удаление&lt;br/&gt;
				- Сохранить - сохраняем изменения в XML-файле&lt;br/&gt;
				- Поиск - ищем строку в наименовании&lt;br/&gt;
				Редактируем данные в ячейках над заголовками столбцов&lt;br/&gt;
				Сортируем данные нажатием на заголовки столбцов		
		&lt;/span&gt;
		&lt;span id=&quot;tip1&quot;&gt;
			VideoLib - приложение&lt;br/&gt;для учета коллекции видео&lt;br/&gt;
			Автор: Анатолий Демидович&lt;br/&gt;
			&lt;a href=&quot;http://da440dil.narod.ru/&quot;&gt;http://da440dil.narod.ru&lt;/a&gt;			
		&lt;/span&gt;		
	&lt;/div&gt;	
	&lt;div id=&quot;inp&quot;&gt;		
		&lt;input id=&quot;film&quot; type=&quot;text&quot; size=&quot;64&quot;&gt;
		&lt;input id=&quot;year&quot; type=&quot;text&quot; size=&quot;4&quot;&gt;
		&lt;span id=&quot;flcount&quot;&gt;&lt;/span&gt;
	&lt;/div&gt;
	&lt;div&gt;
		&lt;table border=&quot;1&quot; cols=&quot;3&quot; cellpadding=&quot;2&quot; width=&quot;555px&quot;&gt;
			&lt;tr align=&quot;center&quot;&gt;
				&lt;td id=&quot;fname&quot; width=&quot;75%&quot;&gt;Наименование&lt;/td&gt;
				&lt;td id=&quot;fyear&quot; width=&quot;10%&quot;&gt;Год&lt;/td&gt;
				&lt;td id=&quot;fdate&quot; width=&quot;15%&quot;&gt;Дата&lt;/td&gt;
			&lt;/tr&gt;
		&lt;/table&gt;
	&lt;/div&gt;	
&lt;/body&gt;
&lt;/html&gt;</code></pre></div><div class="codebox"><pre><code>
&lt;html&gt;
&lt;link href=&quot;VideoLib.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;body&gt;	
	&lt;div id=&quot;flinfo&quot;&gt;&lt;/div&gt;		
&lt;/body&gt;
&lt;/html&gt;</code></pre></div><p>Растусовал и нарядил элементы с помощью CSS:<br /></p><div class="codebox"><pre><code>	body{		
		font:bold 12 sans-serif;	
		color:#fff;
		background-color: #4169e1;
	}	
	table {
		font:bold 12 sans-serif;	 
	}	
	
	#find { margin: 0px 0px 11px 8px; }		
	
	#inp { margin-bottom: 2px; }
	
	#flcount{
		border: 4px ridge; 
		font:bold 14 sans-serif;
		margin: 1px 1px 2px 1px;
		padding: 2px 4px 2px 4px;
	}
	
	/* Кнопки */
	
	#add, #save, #del, #search, #help, #about {
		height:40px; 
		width:40px;
		margin: 0px 3px 3px 3px;
		cursor:hand;		
	}
	
	#add { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&quot;add.png&quot;,sizingMethod=&quot;scale&quot;); }	
	
	#save { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&quot;save.png&quot;,sizingMethod=&quot;scale&quot;); }
	
	#del { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&quot;del.png&quot;,sizingMethod=&quot;scale&quot;); }
	
	#search { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&quot;search.png&quot;,sizingMethod=&quot;scale&quot;); }
	
	#help { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&quot;help.png&quot;,sizingMethod=&quot;scale&quot;); }
	
	#about { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&quot;about.png&quot;,sizingMethod=&quot;scale&quot;); }
	
	/* Всплывающие подсказки */
	
	#tip , #tip1{
		display:none;
		position:absolute;		
		background:#fafafa;
		border:1px solid #ccc;
		color:#000;		
		padding:3px;
		font-size:12px;
		font-style:italic;		
		filter:progid:DXImageTransform.Microsoft.Alpha(opacity=80);
	}
	
	#tip{
		top:2px;
		left:106px;
		width:371px;
	}
	
	#tip1{
		top:10px;
		left:306px;
		width:220px;
		text-align:center;
	}
	
	a{ text-decoration:none; }</code></pre></div><p>Добавил png-картинки, скрипт:<br /></p><div class="codebox"><pre><code>
Const XMLFileName = &quot;data.xml&quot;
Const TableStart = &quot;&lt;table id=&quot;&quot;tbl&quot;&quot; border=&quot;&quot;1&quot;&quot; cols=&quot;&quot;3&quot;&quot; cellpadding=&quot;&quot;2&quot;&quot;&gt;&quot;
Const TableEnd = &quot;&lt;/table&gt;&quot;	
Const cColor = &quot;#ff9933&quot;
Dim arrInfo()
Dim curNode &#039;текущий узел
Dim strHTML
Dim fSort &#039;флаг сортировки
Dim intLastID 

Sub Window_OnLoad()	
	With Window		
		.ResizeTo 600, 500
		.MoveTo (Screen.Width \ 2) - 320, (Screen.Height \ 2) - 280
	End With	
	GetInfo	&#039;получаем информацию в массив
	ShowInfo &#039;отображаем информацию в окне
	SetEH &#039;устанавливаем обработчики событий	
End Sub	

&#039;получаем инфу
Sub GetInfo()	
	Dim xmlDoc, i, z
	Set xmlDoc = CreateObject(&quot;Microsoft.XMLDOM&quot;)
	If xmlDoc.Load(XMLFileName) Then
		If xmlDoc.DocumentElement.hasChildNodes Then
			z = xmlDoc.DocumentElement.childNodes.Length - 1
			For i = 0 To z
				Redim Preserve arrInfo(4,i)				
				With xmlDoc.DocumentElement.childNodes(i)
					arrInfo(0,i) = .GetAttribute(&quot;name&quot;)
					arrInfo(1,i) = .GetAttribute(&quot;year&quot;)
					arrInfo(2,i) = .GetAttribute(&quot;date&quot;)
					arrInfo(3,i) = .GetAttribute(&quot;id&quot;)
				End With
			Next
			intLastID = xmlDoc.DocumentElement.childNodes(z).GetAttribute(&quot;id&quot;)			
		End If
	Else
		MsgBox &quot;Ошибка загрузки файла &quot; &amp; XMLFileName, vbExclamation
	End If	
	Set xmlDoc = Nothing			
End Sub

&#039;закидываем инфу в окно
Sub ShowInfo()	
	If Not IsArray(arrInfo) Then Exit Sub
	strHTML = vbNullString
	For i = 0 To UBound(arrInfo,2)		
		strHTML = strHTML &amp; &quot;&lt;tr id=&quot;&quot;flm-&quot; &amp; i &amp; &quot;&quot;&quot;&gt;&lt;td width=&quot;&quot;75%&quot;&quot;&gt;&quot; &amp; arrInfo(0,i) &amp; _
				&quot;&lt;/td&gt;&lt;td width=&quot;&quot;10%&quot;&quot;&gt;&quot; &amp; arrInfo(1,i) &amp; &quot;&lt;/td&gt;&lt;td width=&quot;&quot;15%&quot;&quot;&gt;&quot; &amp; _
				DateValue(arrInfo(2,i)) &amp; &quot;&lt;/td&gt;&lt;/tr&gt;&quot;		
	Next	
	mainfrm.flinfo.InnerHTML = TableStart &amp; strHTML	&amp; TableEnd
	With menufrm
		.flcount.InnerHTML = &quot;Итого: &quot; &amp; UBound(arrInfo,2) + 1 
		.film.Value = vbNullString
		.year.Value = vbNullString
	End With
	SetColor
End Sub

&#039;обработчики событий	
Sub SetEH()
	&#039;сортировка
	menufrm.fname.onmousedown = GetRef(&quot;SortInfo&quot;)
	menufrm.fyear.onmousedown = GetRef(&quot;SortInfo&quot;)
	menufrm.fdate.onmousedown = GetRef(&quot;SortInfo&quot;)	
	&#039;выбор строки
	For Each childNode In mainfrm.flinfo.childNodes		
		childNode.onmousedown = GetRef(&quot;SetInfo&quot;)		
	Next	
	&#039;изменение значения
	menufrm.film.onchange = GetRef(&quot;ChangeInfo&quot;)
	menufrm.year.onchange = GetRef(&quot;ChangeInfo&quot;)
	&#039;добавление строки
	menufrm.add.onclick = GetRef(&quot;AddInfo&quot;)
	&#039;удаление строки
	menufrm.del.onclick = GetRef(&quot;DelInfo&quot;)
	&#039;сохранение информации в файле XML
	menufrm.save.onclick = GetRef(&quot;SaveInfo&quot;)	
	&#039;поиск информации
	menufrm.search.onclick = GetRef(&quot;SearchInfo&quot;)
	&#039;кнопки Enter
	menufrm.find.onkeydown = GetRef(&quot;SearchInfoOnKey&quot;)
	menufrm.film.onkeydown = GetRef(&quot;ChangeInfoOnKey&quot;)
	menufrm.year.onkeydown = GetRef(&quot;ChangeInfoOnKey&quot;)
	&#039;подсказки
	menufrm.help.onmouseover = GetRef(&quot;ShowTip&quot;)
	menufrm.help.onmouseout = GetRef(&quot;HideTip&quot;)
	menufrm.about.onmouseover = GetRef(&quot;ShowAbout&quot;)
	menufrm.about.onmouseout = GetRef(&quot;HideAbout&quot;)
	&#039;ссылка
	menufrm.about.onclick = GetRef(&quot;OnClickRef&quot;)
End Sub		

&#039;сортируем информацию в окне
Sub SortInfo()
	&#039;выбираем по какому полю сортировать
	If menufrm.event.srcElement.id = &quot;fname&quot; Then
		SortArray arrInfo,2,0
	ElseIf menufrm.event.srcElement.id = &quot;fyear&quot; Then
		SortArray arrInfo,2,1
	Else
		SortArray arrInfo,2,2
	End If
	ShowInfo &#039;отображаем
	SetEH &#039;устанавливаем обработчики	
End Sub

&#039;сортировка массива методом пузырька
Sub SortArray(arr,r,q)
	Dim m, n &#039;счетчики
	Dim b() &#039;буфер
	Dim f &#039;флаг
	If IsArray(arr) Then
		Redim b(UBound(arr))		
		fSort = Not fSort &#039;меняем флаг сортировки		
		For m = 0 To UBound(arr,r)-1
			f = True
			For n = 0 To UBound(arr,r)-1
				If fSort Then
					If arr(q,n) &gt; arr(q,n+1) Then						
						f = SortFinish(b,n,arr)						
					End If
				Else
					If arr(q,n) &lt; arr(q,n+1) Then						
						f = SortFinish(b,n,arr)						
					End If
				End If			
			Next
			If f Then Exit For
		Next
	End If        
End Sub

&#039;собственно сортировка
Function SortFinish(b,n,arr)
	Dim z
	For z = 0 To UBound(arr)
		b(z) = arr(z,n)
		arr(z,n) = arr(z,n+1)
		arr(z,n+1) = b(z)
		SortFinish = False
	Next
End Function

&#039;выбор строки
Sub SetInfo()
	On Error Resume Next
	Const bColor = &quot;#4169e1&quot;
	Const iColor = &quot;#0000ff&quot;
	If Not IsEmpty(curNode) Then
		If curNode.bgcolor &lt;&gt; cColor Then curNode.bgcolor = bColor
	End If
	With mainfrm.event.srcElement	
		Set curNode = .parentNode
		If IsEmpty(arrInfo(4,Mid(curNode.id,5))) Then .parentNode.bgcolor  = iColor
	End With
	With curNode
		menufrm.film.Value = arrInfo(0,Mid(.id,5))
		menufrm.year.Value = arrInfo(1,Mid(.id,5))
	End With		
End Sub

&#039;редактируем информацию
Sub ChangeInfo()
	On Error Resume Next
	Dim z	
	With menufrm.event.srcElement
		If .id = &quot;film&quot; Then
			z = 0					
		Else
			z = 1					
		End If
		curNode.childNodes(z).innerHTML = .Value		
		arrInfo(z,Mid(curNode.id,5)) = .Value
		&#039;меняем дату редактирования
		arrInfo(2,Mid(curNode.id,5)) = Now()
		&#039;ставим флаг - редактировать
		If arrInfo(4,Mid(curNode.id,5)) &lt;&gt; 1 Then arrInfo(4,Mid(curNode.id,5)) = 0
	End With
	curNode.bgcolor  = cColor
End Sub

&#039;добавляем информацию
Sub AddInfo()
	Dim i
	i = UBound(arrInfo,2) + 1	
	Redim Preserve arrInfo(4,i)	
	arrInfo(0,i) = &quot;Новый&quot;
	arrInfo(1,i) = &quot;?&quot;
	arrInfo(2,i) = Now()
	intLastID = intLastID + 1 &#039;увеличиваем значение последнего ID
	arrInfo(3,i) = intLastID
	arrInfo(4,i) = 1 &#039;ставим флаг - добавить	
	strHTML = strHTML  &amp; &quot;&lt;tr id=&quot;&quot;flm-&quot; &amp; i &amp; &quot;&quot;&quot;&gt;&lt;td width=&quot;&quot;75%&quot;&quot;&gt;&quot; &amp; arrInfo(0,i) &amp; _
				&quot;&lt;/td&gt;&lt;td width=&quot;&quot;10%&quot;&quot;&gt;&quot; &amp; arrInfo(1,i) &amp; &quot;&lt;/td&gt;&lt;td width=&quot;&quot;15%&quot;&quot;&gt;&quot; &amp; _
				DateValue(arrInfo(2,i)) &amp; &quot;&lt;/td&gt;&lt;/tr&gt;&quot;	
	mainfrm.flinfo.InnerHTML = TableStart &amp; strHTML &amp; TableEnd
	With menufrm
		.film.Value = arrInfo(0,i)
		.year.Value = arrInfo(1,i)
	End With
	&#039;сортируем по убыванию даты создания
	fSort = False
	SortArray arrInfo,2,2
	ShowInfo &#039;цвет выставляется здесь	
	SetEH
End Sub

&#039;устанавливаем цвет строк
Sub SetColor()
	Dim colElem, i
	Set colElem = mainfrm.tbl.getElementsByTagName(&quot;tr&quot;)
	For i = 0 To colElem.Length-1		
		&#039;если значение не сохранено в базе
		If Not IsEmpty(arrInfo(4,i)) Then colElem(i).bgcolor = cColor
	Next
	Set colElem = Nothing
End Sub

&#039;удаляем информацию
Sub DelInfo()
	With curNode
		.childNodes(0).innerHTML = &quot;Удален&quot;	
		.bgcolor  = cColor
		&#039;ставим флаг - удалить
		arrInfo(4,Mid(.id,5)) = 2
	End With
End Sub

&#039;сохраняем информацию
Sub SaveInfo()
	Dim xmlDoc, objNewNode, objEditNode, i	
	Set xmlDoc = CreateObject(&quot;Microsoft.XMLDOM&quot;)
	If xmlDoc.Load(XMLFileName) Then 		
		xmlDoc.documentElement.setAttribute &quot;dt&quot;, Now()
		For i = 0 To UBound(arrInfo,2)
			If Not IsEmpty(arrInfo(4,i)) Then &#039;если данные изменились
				If arrInfo(4,i) = 0 Then &#039;редактируем					
					Set objEditNode = xmlDoc.selectSingleNode(&quot;//film[@id=&#039;&quot; &amp; arrInfo(3,i) &amp;&quot;&#039;]&quot;)					
					For j = 0 To 3					
						objEditNode.Attributes(j).Text = arrInfo(j,i)						
					Next					
					Set objEditNode = Nothing
				ElseIf arrInfo(4,i) = 1 Then &#039;добавляем
				Set objNewNode = xmlDoc.createElement(&quot;film&quot;)				
				With objNewNode
					.setAttribute &quot;name&quot;, arrInfo(0,i)
					.setAttribute &quot;year&quot;, arrInfo(1,i)
					.setAttribute &quot;date&quot;, FormatDateTime(Now(),ddmmyyyyhhmmss)
					.setAttribute &quot;id&quot;, arrInfo(3,i) 
				End With
				xmlDoc.documentElement.AppendChild(objNewNode)
				Set objNewNode = Nothing
				ElseIf arrInfo(4,i) = 2 Then &#039;удаляем				
					xmlDoc.documentElement.removeChild(xmlDoc.selectSingleNode(&quot;//film[@id=&#039;&quot; &amp; arrInfo(3,i) &amp;&quot;&#039;]&quot;))					
				End If
			End If
		Next
		xmlDoc.Save(XMLFileName)
	Else
		MsgBox &quot;Ошибка загрузки файла &quot; &amp; XMLFileName, vbExclamation
	End If
	Set xmlDoc = Nothing	
	Erase arrInfo
	GetInfo
	ShowInfo
	SetEH	
End Sub

&#039;поиск информации
Sub SearchInfo()
	Dim strInput, regEx, i, j, s
	If menufrm.find.value = vbNullString Then
		MsgBox &quot;Введите строку&quot;,vbInformation
	Else
		strInput = menufrm.find.value		
		&#039;используем регулярное выражение
		Set regEx = New RegExp 
		With regEx		
			.Global = True 
			.IgnoreCase = True 
			.Pattern = strInput
		End With	
		For i = 0 To UBound(arrInfo,2)
			If regEx.Test(arrInfo(0,i)) Then
				j = j + 1
				s = s &amp; &quot;- &quot; &amp; arrInfo(0,i) &amp; vbCrLf
			End If
		Next
		Set regEx = Nothing
		If j Then
			MsgBox &quot;Совпадения найдены&quot; &amp; vbCrLf &amp; &quot;Количество: &quot; &amp; j &amp; vbCrLf &amp; s, vbInformation
		Else
			MsgBox &quot;Совпадений не найдено&quot;, vbInformation
		End If
	End If
End Sub

&#039;нажатие на Enter в строке поиска
Sub SearchInfoOnKey()
	If menufrm.event.keyCode=13 Then SearchInfo	
End Sub
&#039;нажатие на Enter в ячейках при изменении информации
Sub ChangeInfoOnKey()
	If menufrm.event.keyCode=13 Then ChangeInfo	
End Sub

&#039;показывываем Help
Sub ShowTip()
	menufrm.tip.style.display = &quot;block&quot;
End Sub

&#039;прячем Help
Sub HideTip()
	menufrm.tip.style.display = &quot;none&quot;
End Sub

&#039;показываем About
Sub ShowAbout()
	menufrm.tip1.style.display = &quot;block&quot;
End Sub

&#039;прячем About
Sub HideAbout()
	menufrm.tip1.style.display = &quot;none&quot;
End Sub

&#039;ссылка
Sub OnClickRef()	
	CreateObject(&quot;WScript.Shell&quot;).Run &quot;iexplore.exe http://da440dil.narod.ru/about.html&quot;	
End Sub</code></pre></div><p>В итоге получилось то, что получилось (на скриншотах выше).<br />Не безупречно, на что свободного времени хватило <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />. Может использованные приемы кому-нибудь пригодятся.<br />Скачать можно <a href="http://narod.ru/disk/30698981001/VideoLib-v1.0.ZIP.html">здесь</a>.</p>]]></content>
			<author>
				<name><![CDATA[dab00]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27085</uri>
			</author>
			<updated>2011-11-06T18:09:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53296#p53296</id>
		</entry>
</feed>
