<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vacheslav Starikov&#039;s</title>
	<atom:link href="http://starikovs.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://starikovs.com</link>
	<description>BLOG</description>
	<lastBuildDate>Mon, 07 Dec 2009 17:06:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Centering horizontal CSS menu</title>
		<link>http://starikovs.com/2009/12/04/centering-horizontal-css-menu/</link>
		<comments>http://starikovs.com/2009/12/04/centering-horizontal-css-menu/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 17:00:16 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[codecharge]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=176</guid>
		<description><![CDATA[It&#8217;s a real headache to center a fluid block element horizontally with help of CSS. Some time ago I figured out how to center CodeCharge Studio&#8217;s CSS Menu because it doesn&#8217;t provide this functionality. In general, any block element without the fixed width can be centered with help of this method. 
By the way, if [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a real headache to center a fluid block element horizontally with help of CSS. Some time ago I figured out how to center CodeCharge Studio&#8217;s CSS Menu because it doesn&#8217;t provide this functionality. In general, any block element without the fixed width can be centered with help of this method. </p>
<p>By the way, if You have a fixed width block then You have to set its left and right margins to auto and You get the block centered. </p>
<p>In this article I&#8217;m going to explain the method I use to center a fluid block element. Here is the <a href="http://starikovs.com/my-examples/centering-horizontal-css-menu/test.php" target="_blank">Demo</a>.</p>
<p><span id="more-176"></span></p>
<p>With help of this method You can center:</p>
<ul>
<li>CodeCharge Studio&#8217;s Menu (CCS Menu)</li>
<li>Horizontal CSS Menu</li>
<li>Any block elements (DIV, SPAN, IMG, UL, etc.)</li>
</ul>
<h3>HTML</h3>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- BEGIN Menu Menu1 --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;MenuStyle&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Menu1Container&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;adxm {Menu1:MenuType} level1&quot;</span>&gt;</span>
  ...
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- END Menu Menu1 --&gt;</span></pre></div></div>

<h3>CSS</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#Menu1Container</span> <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#Menu1Container</span> ul <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/12/04/centering-horizontal-css-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting HTML for WebBrowser in C#</title>
		<link>http://starikovs.com/2009/11/25/set-html-webbrowser-csharp/</link>
		<comments>http://starikovs.com/2009/11/25/set-html-webbrowser-csharp/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 16:39:53 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=155</guid>
		<description><![CDATA[Today I tryed to insert HTML for WebBorwser in C#. I thought it&#8217;s a simple task. But when I tryed to use DocumentText property I got &#8220;&#60;HTML&#62;&#60;/HTML&#62;&#8221;. Then I tryed Document.Write("...") and I got that Document is null. After these tries I started to find out the easiest way to fill the WebBrowser with HTML [...]]]></description>
			<content:encoded><![CDATA[<p>Today I tryed to insert HTML for <code>WebBorwser</code> in C#. I thought it&#8217;s a simple task. But when I tryed to use <code>DocumentText</code> property I got &#8220;&lt;HTML&gt;&lt;/HTML&gt;&#8221;. Then I tryed <code>Document.Write("...")</code> and I got that <code>Document</code> is <code>null</code>. After these tries I started to find out the easiest way to fill the WebBrowser with HTML without writing to disk and navigating the written file. Here is my code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">WebBrowser browser <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> WebBrowser<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
browser.<span style="color: #0000FF;">Navigate</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;about:blank&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
browser.<span style="color: #0000FF;">Document</span>.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;&lt;html&gt;&lt;body&gt;...&lt;/body&gt;&lt;/html&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>When the <code>WebBrowser</code> has been made, the <code>Document</code> object is <code>null</code>. So, we should call <code>Navigate()</code> method to get <code>Document</code> available.</p>
<p>If You have Your way to fill the <code>WebBrowser</code> with HTML I&#8217;m expecting for Your comments <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/11/25/set-html-webbrowser-csharp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating dialog in CodeCharge Studio</title>
		<link>http://starikovs.com/2009/11/21/creating-dialog-in-ccs/</link>
		<comments>http://starikovs.com/2009/11/21/creating-dialog-in-ccs/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 14:33:54 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[codecharge]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=29</guid>
		<description><![CDATA[This article provides CodeCharge Studio developers with a truly easy way to create a custom IDE dialog for different purposes. Here You will learn how to extend CodeCharge Studio with Your own dialog. I am going to explain how to create a custom dialog through an example. We will create together a dialog for embedding [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://starikovs.com/wp-content/uploads/2009/11/first-ccs-dialog.PNG" alt="first-ccs-dialog" title="first-ccs-dialog" width="281" height="131" class="alignleft size-full wp-image-143" />This article provides CodeCharge Studio developers with a truly easy way to create a custom IDE dialog for different purposes. Here You will learn how to extend CodeCharge Studio with Your own dialog. I am going to explain how to create a custom dialog through an example. We will create together a dialog for embedding a Flash movie into the page. See <a href="http://starikovs.com/my-examples/first-ccs-dialog/default.php" target="_blank">online example</a> to understand what You will be able to do with help of the dialog. Also, here You can download a source code of the dialog and extend Your CodeCharge Studio with it. In addition to downloading a source code You can download a test project that has a page where a Flash Movie embeded by this dialog. So, let&#8217;s start! </p>
<p><span id="more-29"></span></p>
<h3>1. ToolBox</h3>
<p>First of all, we should add a button that runs a dialog. Usually, the dialogs of this type are run from ToolBox. Therefore, we should add a button to ToolBox. By default, ToolBox consists of three tabs: Builders, Forms and HTML. Let&#8217;s add our button to the HTML tab. For that we have to create a simple XML file in <em>Components/ToolBox/HTML</em>. Name it <em>FlashMovie.xml</em>.</p>
<p>The contents of this file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;ISO-8859-1&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;TB_FormsFlashMovieName&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">number</span>=<span style="color: #ff0000;">&quot;777&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">hint</span>=<span style="color: #ff0000;">&quot;TB_FormsFlashMovieHint&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">script</span>=<span style="color: #ff0000;">&quot;..\..\..\Components\Dialogs\HTML\FlashMovie\FlashMovie.js&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">img</span>=<span style="color: #ff0000;">&quot;..\..\Icons\Image.ico&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<table>
<tr>
<th>Attribute</th>
<th>Description</th>
</tr>
<tr>
<td>name</td>
<td>A name of the ToolBox item. Contains a translation key. Translation keys will be discussed a bit later. This attribute is mostly used for internal needs and we are able to use it for our needs.</td>
</tr>
<tr>
<td>number</td>
<td>An ordered number of the button. It specifies the position of the button in ToolBox tab. I set its value to 777 to have it last.</td>
</tr>
<tr>
<td>hint</td>
<td>Tooltip text. Appears as a hint when you move a mouse over the button. Contains a translation key.</td>
</tr>
<tr>
<td>script</td>
<td>Path to script that runs a dialog. We&#8217;ll discuss it later.</td>
</tr>
<tr>
<td>img</td>
<td>An icon for the button. I&#8217;ve chosen an icon that is used for &lt;img&gt; tag but You can create an icon yourself and put it to <em>Components/Icons</em>.</td>
</tr>
</table>
<h3>2. Translations</h3>
<p>All the translations are located in <em>Components/Translations/IDE</em>. To make the translation keys translated You should add them to the text file of your language. For example, to <em>English.txt</em>. CodeCharge Studio should be restarted then translations will be applicable.</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">TB_FormsFlashMovieName</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">Flash Movie</span>
<span style="color: #000099;">TB_FormsFlashMovieHint</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">Add Flash Movie</span></pre></div></div>

<p>Anyway, You may use just string constants instead of translation keys and everything will be working. Minuses of this approach are that our code isn&#8217;t translatable and it&#8217;s a bad form. Therefore, we are using translation keys in our example.</p>
<h3>3. Dialog HTML skeleton</h3>
<p>Most of Dialogs in CodeCharge Studio are made out of HTML, CSS and JavaScript. HTML and CSS makes a visual presentation of dialogs. A program logic of dialogs is realized with help of JavaScript. Also, JavaScript deals with IE and CodeCharge Studio object models. </p>
<p>It&#8217;s a good form to put script that runs a dialog and dialog&#8217;s HTML to the same directory. Let&#8217;s create a directory <em>Components/Dialogs/HTML/FlashMovie</em> and an empty text file with the name <em>FlashMovie.html</em>.</p>
<p>Please, put the contents below into the <em>FlashMovie.html</em>. It&#8217;s HTML skeleton of the dialog.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; </span>
<span style="color: #00bbdd;">&quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=iso-8859-1&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;../../dialogs.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;../../Common/Common.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
    var ccObject, ccApplication, ccProject, ccPage;
&nbsp;
    function body_onload() {
      // gets Project object
      // it comes from FlashMovie.js
      // FlashMovie.js starts the dialog
      ccObject = ccProject = window.external.dialogArguments;
      // gets current Page object
      ccPage   = ccObject.currentPage;
      // gets Application object
      ccApplication = ccProject.Application;
&nbsp;
      // translates all the translation keys in the dialog
      TranslateDlg();
      // sets event handlers
      SetUpKeysHandler();
      // sets dialog sizes and shows dialog
      dialogResize(400,175);
&nbsp;
      // sets dialog title
      window.external.caption(getTranslationString(&quot;FlashMovieDialog_Title&quot;));
    }
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span> <span style="color: #000066;">onload</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;body_onload()&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<table>
<tr>
<th nowrap="nowrap">FlashMovieDialog_Title</th>
<td>A translation key. You should put it and its value into <em>English.txt</em>, for example.</td>
</tr>
<tr>
<th nowrap="nowrap">../../dialogs.css</th>
<td>A standard styles file for CodeCharge Studio dialogs.</td>
</tr>
<tr>
<th nowrap="nowrap">../../Common/Common.js</th>
<td>A common JavaScript functions for CodeCharge Studio dialogs. It isn&#8217;t only one file with common functions. There are some others.</td>
</tr>
<tr>
<th nowrap="nowrap">body_onload()</th>
<td>This function is called when dialog runs. Here we will get some parameters, set dialog sizes, etc.</td>
</tr>
</table>
<p>Dialog HTML skeleton&#8217;s been done! </p>
<h3>4. Script that runs dialog</h3>
<p>As you remember, in the ToolBox button XML we specified what script runs dialog. It&#8217;s <em>FlashMovie.js</em>. It should be located in the <em>Components/Dialogs/HTML/FlashMovie</em> as well as <em>FlashMovie.html</em>. </p>
<p>Well, let&#8217;s analize the contents of this script:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// includes common functions</span>
#include ..\..\Common\Common.<span style="color: #660066;">js</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// ccPage - an object that comes from CCS OM</span>
<span style="color: #006600; font-style: italic;">// with help of ccPage we get reference to Project object</span>
<span style="color: #003366; font-weight: bold;">var</span> ccObject    <span style="color: #339933;">=</span> ccPage.<span style="color: #660066;">Project</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// if we have Project we can get current Page</span>
<span style="color: #003366; font-weight: bold;">var</span> currentPage <span style="color: #339933;">=</span> ccObject.<span style="color: #660066;">currentPage</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>currentPage<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// getTranslationString() - Components/Common.js</span>
  <span style="color: #006600; font-style: italic;">// starts a transaction for UnDo/ReDo</span>
  <span style="color: #003366; font-weight: bold;">var</span> trans <span style="color: #339933;">=</span> ccObject.<span style="color: #660066;">Application</span>.<span style="color: #660066;">undobuffer</span>.<span style="color: #660066;">starttransaction</span><span style="color: #009900;">&#40;</span>
    getTranslationString<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Toolbox_Undo_AddNewComponent&quot;</span><span style="color: #339933;">,</span> 
    getTranslationString<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;TB_FormsFlashMovieName&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">,</span> currentPage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>trans<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// RunDialog2() - Common.js</span>
      <span style="color: #006600; font-style: italic;">// Runs dialog FlashMovie.html and passes Project object into it</span>
      <span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> RunDialog2<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;HTML<span style="color: #000099; font-weight: bold;">\\</span>FlashMovie<span style="color: #000099; font-weight: bold;">\\</span>FlashMovie.html&quot;</span><span style="color: #339933;">,</span> ccObject<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span> trans.<span style="color: #660066;">commit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">else</span> trans.<span style="color: #660066;">rollback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// if something worng show an error</span>
      ccObject.<span style="color: #660066;">Application</span>.<span style="color: #660066;">ShowErrorInfoDlg</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> currentPage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      trans.<span style="color: #660066;">rollback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// MessageBox - Components/Common.js</span>
    MessageBox<span style="color: #009900;">&#40;</span>getTranslationString<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Toolbox_Undo_TransactionAlreadyOpened&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<table>
<tr>
<th>#include</th>
<td>A proprietary directive that includes scripts into scripts.</td>
</tr>
<tr>
<th>getTranslationString()</th>
<td>Declared in <em>Dialogs/Common/Common.js</em>. It returns a translated string by translation key. Translation keys may include <strong>%s</strong> placeholders. For example, look at the key &#8220;Toolbox_Undo_AddNewComponent=%s was added&#8221;. This key is used in the settransaction(). It gets two parameters: first one for translation key and the second one for the placeholder value.</td>
</tr>
</table>
<p>I think everything else in this script You can understand through comments in the script. If I am wrong You may ask me for some explanations.</p>
<p>Now, having the ToolBox button, translations, HTML and JavaScript code of the dialog, You may try to start the dialog. But at the moment You are having an empty window. That&#8217;s good! Let&#8217;s go ahead! <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>5. Preparing HTML template</h3>
<p>As our purpose is to understand how the CodeCharge Studio dialogs are created I&#8217;ve simplified the logic of the dialog. In the dialog we will ask user for the Flash Movie file, width and height of the movie. Nothing more. The HTML code that will be pasted to a page is based on the following template:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">object</span> <span style="color: #000066;">classid</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot;</span> </span>
<span style="color: #009900;">  <span style="color: #000066;">codebase</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0&quot;</span> </span>
<span style="color: #009900;">  <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{width}&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{height}&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;movie&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{movie}&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;quality&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;high&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;embed <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{movie}&quot;</span> quality<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;high&quot;</span> </span>
<span style="color: #009900;">      pluginspage<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.macromedia.com/go/getflashplayer&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;application/x-shockwave-flash&quot;</span> </span>
<span style="color: #009900;">      <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{width}&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{height}&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>embed&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">object</span>&gt;</span></pre></div></div>

<p>Placeholders:</p>
<table>
<tr>
<th>{movie}</th>
<td>Path to the Flash Movie (*.swf). It should be located in the project folder.</td>
</tr>
<tr>
<th>{width}</th>
<td>Width of the movie.</td>
</tr>
<tr>
<th>{height}</th>
<td>Height of the move.</td>
</tr>
</table>
<p>We will process this template when the OK button is clicked. The placeholders will be replaced with the real values. After processing the template the resultant HTML code will be pasted into a page.</p>
<h3>6. Dialog presentation</h3>
<p>As I&#8217;ve written above the HTML presentation of the dialog is made up with help of HTML and CSS. Sometimes, JavaScripts is used to add some dynamics. OK, here is HTML that should be placed to &lt;body&gt; of <em>FlashMovie.html</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- layout table --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">table</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;margin:5px;&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;table&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
    <span style="color: #808080; font-style: italic;">&lt;!-- label tags can contain translation keys --&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swf&quot;</span>&gt;</span>FlashMovieDialog_Swf<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span> <span style="color: #000066;">colspan</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2&quot;</span>&gt;</span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Flash Movie source --&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swf&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;40&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;255&quot;</span>&gt;</span>
    <span style="color: #808080; font-style: italic;">&lt;!-- shows an Open File dialog to select a Flash Movie --&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;browseForSwf();&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width:30px;&quot;</span>&gt;</span>
      ...
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swfWidth&quot;</span>&gt;</span>FlashMovieDialog_SwfWidth<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width:100px;&quot;</span>&gt;</span>
    <span style="color: #808080; font-style: italic;">&lt;!-- the width of a Flash Movie --&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swfWidth&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swfHeight&quot;</span>&gt;</span>FlashMovieDialog_SwfHeight<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width:100px;&quot;</span>&gt;</span>
    <span style="color: #808080; font-style: italic;">&lt;!-- the height of a Flash Movie --&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;swfHeight&quot;</span><span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">table</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">hr</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- calls OnCancel() to close the dialog without chages --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;OnCancel();&quot;</span> </span>
<span style="color: #009900;">  <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;float:right;margin-right:10px;&quot;</span>&gt;</span>
  Button_Cancel
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- calls OnOK() to insert a Flash Movie to the page --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;OnOK();&quot;</span> </span>
<span style="color: #009900;">  <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;float:right;margin-right:3px;&quot;</span>&gt;</span>
  Button_OK
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span></pre></div></div>

<h3>7. Dialog logic</h3>
<p>The last step is creating some JavaScript functions. These functions helps us to make the logic of our dialog. Here we define handlers for OK and Cancel buttons as well as for button that opnes an Open File dialog to select an swf (Flash Movie), also we can put here some checkers, etc. So, add this code after the body_onload() function.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// closes the dialog without changes</span>
<span style="color: #003366; font-weight: bold;">function</span> OnCancel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// closes the dialog and returns false to dialogs caller</span>
  window.<span style="color: #660066;">external</span>.<span style="color: #660066;">cancel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// applies changes and closes the dialog</span>
<span style="color: #003366; font-weight: bold;">function</span> OnOK<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// checks if the entered data is valid</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>CheckData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// applies changes</span>
  OnApply<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// closes the dialog and returns true to the dialogs caller</span>
  window.<span style="color: #660066;">external</span>.<span style="color: #660066;">ok</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> OnApply<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// defines HTML template for the Flash Movie</span>
  <span style="color: #003366; font-weight: bold;">var</span> htmlTemplate <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&lt;object classid=<span style="color: #000099; font-weight: bold;">\&quot;</span>clsid:D27CDB6E-AE6D-11cf-96B8-444553540000<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
  htmlTemplate <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot; codebase=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
  htmlTemplate <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot; width=<span style="color: #000099; font-weight: bold;">\&quot;</span>{width}<span style="color: #000099; font-weight: bold;">\&quot;</span> height=<span style="color: #000099; font-weight: bold;">\&quot;</span>{height}<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span>
  htmlTemplate <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;&lt;param name=<span style="color: #000099; font-weight: bold;">\&quot;</span>movie<span style="color: #000099; font-weight: bold;">\&quot;</span> value=<span style="color: #000099; font-weight: bold;">\&quot;</span>{movie}<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span>
  htmlTemplate <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;&lt;param name=<span style="color: #000099; font-weight: bold;">\&quot;</span>quality<span style="color: #000099; font-weight: bold;">\&quot;</span> value=<span style="color: #000099; font-weight: bold;">\&quot;</span>high<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span>
  htmlTemplate <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;&lt;embed src=<span style="color: #000099; font-weight: bold;">\&quot;</span>{movie}<span style="color: #000099; font-weight: bold;">\&quot;</span> quality=<span style="color: #000099; font-weight: bold;">\&quot;</span>high<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
  htmlTemplate <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot; pluginspage=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://www.macromedia.com/go/getflashplayer<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
  htmlTemplate <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot; type=<span style="color: #000099; font-weight: bold;">\&quot;</span>application/x-shockwave-flash<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
  htmlTemplate <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot; width=<span style="color: #000099; font-weight: bold;">\&quot;</span>{width}<span style="color: #000099; font-weight: bold;">\&quot;</span> height=<span style="color: #000099; font-weight: bold;">\&quot;</span>{height}<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;/embed&gt;&lt;/object&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// gets the Flash Movie source</span>
  <span style="color: #003366; font-weight: bold;">var</span> movie <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;swf&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// gets the width</span>
  <span style="color: #003366; font-weight: bold;">var</span> width <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;swfWidth&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// gets the height</span>
  <span style="color: #003366; font-weight: bold;">var</span> height <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;swfHeight&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// parses the template</span>
  <span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> htmlTemplate.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\{movie\}/gi</span><span style="color: #339933;">,</span> movie<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  result <span style="color: #339933;">=</span> result.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\{width\}/gi</span><span style="color: #339933;">,</span> width<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  result <span style="color: #339933;">=</span> result.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\{height\}/gi</span><span style="color: #339933;">,</span> height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// inserts HTML to the page</span>
  <span style="color: #006600; font-style: italic;">// declared in Components/Common.js	</span>
  pasteHTML<span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// checks the entered data for validity</span>
<span style="color: #003366; font-weight: bold;">function</span> CheckData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// put here some checks if You need</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// opens an Open File dialog to select swf (Flash Movie)</span>
<span style="color: #006600; font-style: italic;">// returns a project relative path to selected swf</span>
<span style="color: #003366; font-weight: bold;">function</span> browseForSwf<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> projectPath <span style="color: #339933;">=</span> ccProject.<span style="color: #660066;">Path</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// browseFile() - Components/Common.js</span>
  browseFile<span style="color: #009900;">&#40;</span>
    document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;swf&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009966; font-style: italic;">/* puts the path to this control */</span>
    <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #009966; font-style: italic;">/* relative path */</span>
    getTranslationString<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Dialogs_FileFilter_Swf&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009966; font-style: italic;">/* file filter */</span>
    projectPath<span style="color: #339933;">,</span> <span style="color: #009966; font-style: italic;">/* source directory */</span>
    <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009966; font-style: italic;">/* return with backslashes */</span>
    <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #009966; font-style: italic;">/* only project files */</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Conclusion</h3>
<p>And now Your dialog should work! Congratulations <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You can test it by placing a Flash Movie into a project folder and pasting it into a page with help of Your dialog. Then go to Project-&gt;Settings-&gt;Publishing and configure extesions of the publishing files, in general, add swf extension. Then publish a project and enjoy Your work! <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You can download here the source code of the dialog and copy it to Your <em>Components</em> folder. But be careful with translations, You should  copy text from the example file <em>Components/Translations/IDE/English_example.txt</em> and paste it to the end of the file <em>Components/Translations/IDE/English.txt</em> of Your Components.</p>
<p>I&#8217;ve tested this example in CodeCharge Studio 3 and 4.</p>
<p>If You have questions or wishes I am waiting for Your comments. I am also going to publish some other articles about extending CodeCharge Studio as well as about CCS features. </p>
<h3>Download</h3>
<p><a href='http://starikovs.com/wp-content/uploads/2009/11/FirstDialogSrc.zip'>Dialog Source Code (FirstDialogSrc.zip)</a></p>
<p><a href='http://starikovs.com/wp-content/uploads/2009/11/FirstDialog.zip'>Test Project (FirstDialog.zip)</a></p>
<h3>Links</h3>
<p><a href="http://www.yessoftware.com/?2628" target="_blank">CodeCharge Studio&#8217;s web site</a></p>
<p><a href="http://www.leconcombre.com/board/dl/us/mammyblue1us.html" target="_blank">Flash example</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/11/21/creating-dialog-in-ccs/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Inline YUI AutoComplete layout</title>
		<link>http://starikovs.com/2009/11/04/inline-yui-autocomplete-layout/</link>
		<comments>http://starikovs.com/2009/11/04/inline-yui-autocomplete-layout/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 11:28:27 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=71</guid>
		<description><![CDATA[ Recently, i had a problem with YUI AutoComplete layout. I wanted it being inline, fixed width and working with different browsers like IE6/7/8, Opera, FF etc. There were some problems that i solved primarily in CSS. More precisely, i needed an inline YUI AutoComplete layout in such a way that i can place autocomplete [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://starikovs.com/wp-content/uploads/2009/11/yuiautocompletelayout.PNG" alt="Inline YUI AutoComplete layout" title="Inline YUI AutoComplete layout" width="281" height="81" class="alignleft size-full wp-image-73" /> Recently, i had a problem with YUI AutoComplete layout. I wanted it being inline, fixed width and working with different browsers like IE6/7/8, Opera, FF etc. There were some problems that i solved primarily in CSS. More precisely, i needed an inline YUI AutoComplete layout in such a way that i can place autocomplete &lt;input&gt; next to the &lt;label&gt; without a line break. I just set my styles in CSS and override some existing styles and it works ok!</p>
<p><strong>So, problems i had to solve for my needs:</strong></p>
<ul>
<li>an outer container is a DIV so INPUT always goes on the next line</li>
<li>inline-block for DIV doesn&#8217;t work in IE6/7</li>
<li>an outer container has width of 100%</li>
<li>INPUT is absolutely positioned so an outer DIV is collapsed</li>
<li>width of 100% makes INPUT 6px larger then outer DIV in IE6</li>
<li>using inline-block, INPUT aligns vertically on the bottom in IE6</li>
</ul>
<p><span id="more-71"></span></p>
<h3>YUI files to include</h3>
<p>Let&#8217;s begin with files to include:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--CSS file (default YUI Sam Skin) --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://yui.yahooapis.com/2.8.0r4/build/autocomplete/assets/skins/sam/autocomplete.css&quot;</span>&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- Dependencies --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://yui.yahooapis.com/2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://yui.yahooapis.com/2.8.0r4/build/datasource/datasource-min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- Source file --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://yui.yahooapis.com/2.8.0r4/build/autocomplete/autocomplete-min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>Well, i&#8217;m explaining below how i&#8217;ve achieved an inline YUI AutoComplete layout. The code is well-commented to understand what is happening <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>HTML</h3>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- </span>
<span style="color: #808080; font-style: italic;">Let's use SPAN becase it has &quot;display: inline&quot; by default.</span>
<span style="color: #808080; font-style: italic;">IE6/7 can apply &quot;display: inline-block&quot; only for elements</span>
<span style="color: #808080; font-style: italic;">that have &quot;display: inline&quot; by default.</span>
<span style="color: #808080; font-style: italic;">Read more: http://www.quirksmode.org/css/display.html.</span>
<span style="color: #808080; font-style: italic;">--&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input&quot;</span>&gt;</span>YUI AutoComplete<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;autocomplete&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;results&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
/* creating a data source out of js array */
var ds = new YAHOO.util.LocalDataSource([&quot;apples&quot;, &quot;apricots&quot;, &quot;bananas&quot;]);
&nbsp;
/* creating a yui autocomplete */
var ac = new YAHOO.widget.AutoComplete(&quot;input&quot;, &quot;results&quot;, ds);
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<h3>CSS</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* outer container */</span>
<span style="color: #cc00cc;">#autocomplete</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* behaving like an inline element */</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> -moz-inline-box<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* for FF less then 3.0 */</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span> !important<span style="color: #00AA00;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #808080; font-style: italic;">/* standard width of a textbox */</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* align vertically on the center */</span>
    <span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">middle</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* input */</span>
<span style="color: #cc00cc;">#autocomplete</span> input <span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* preventing an outer container DIV collapsing */</span> 
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #808080; font-style: italic;">/* tweaking to traditional box model
     * width = border + padding + content
     */</span>
    box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
    -moz-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
    -webkit-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
    -ms-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* ie8 */</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* CSS Expression to calculate width for the input.
     * 2px border + 1px padding + 1px padding + 2px border = 6px.
     * Only for IE6/7 because traditional box model cannot
     * be tweaked by any css property.
     * currentStyle object - IE css styles as specified by 
     * global style sheets, inline styles, and HTML attributes.
     */</span>
    <span style="color: #00AA00;">*</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> expression<span style="color: #00AA00;">&#40;</span>parseInt<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">this.parentNode.currentStyle.width</span><span style="color: #00AA00;">&#41;</span>-<span style="color: #cc66cc;">6</span><span style="color: #00AA00;">+</span><span style="color: #ff0000;">'px'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>I&#8217;ve tested this soluting in <strong>FireFox 3.5</strong>, <strong>Opera 10</strong>, <strong>IE 6/7/8</strong>. YUI version i&#8217;m using is <strong>2.8</strong>.</p>
<h3>Further reading:</h3>
<ul>
<li><a href="http://developer.yahoo.com/yui/autocomplete/" target="_blank">YUI 2 Autocomplete</a></li>
<li><a href="http://www.quirksmode.org/css/box.html" target="_blank">CSS Box Models</a></li>
<li><a href="http://www.quirksmode.org/css/display.html" target="_blank">Display declarations</a></li>
<li><a href="http://wiki.orbeon.com/forms/doc/contributor-guide/ie-bugs#TOC-Inline-block" target="_blank">inline-block in IE</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms535889(VS.85).aspx" target="_blank">IE runtimeStyle Object</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms528441(VS.85).aspx" target="_blank">IE currentStyle Object</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms535898(VS.85).aspx" target="_blank">IE style Object</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/11/04/inline-yui-autocomplete-layout/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Welcome to my web development blog!</title>
		<link>http://starikovs.com/2009/10/14/welcome/</link>
		<comments>http://starikovs.com/2009/10/14/welcome/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 08:52:15 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://starikovs.com/2009/10/14/welcome/</guid>
		<description><![CDATA[So, my blog has arrived! Here I&#8217;m going to publish some articles about web development, to share my experience and thoughts with others. I hope that it will be the place where You always are able to find something new, useful and helpful. Also, I&#8217;m glad to contact with everybody by email if You have [...]]]></description>
			<content:encoded><![CDATA[<p>So, my blog has arrived! Here I&#8217;m going to publish some articles about web development, to share my experience and thoughts with others. I hope that it will be the place where You always are able to find something new, useful and helpful. Also, I&#8217;m glad to contact with everybody by email if You have some questions or wishes.</p>
<p>Several words about how I create this blog <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  After I decided to create an own blog I started to find how I can do it. As I&#8217;m familiar with WordPress and it&#8217;s very popular and flexible, I chose it. The second question, what theme to use. I wanted something special and unique so I decided to create theme with help of Artisteer. By the way, Artisteer can create themes not only for WordPress but for Blogger, Joomla, Drupal, DotNetNuke and just HTML templates. So, it&#8217;s cool!</p>
<blockquote><p>A good idea + Artisteer = great result!</p></blockquote>
<p>A couple of hours and theme&#8217;s done. And without any coding of XHTML, CSS and PHP. Of course, after generating a theme with help of Artisteer there&#8217;s a probability to modify a CSS to satisfy with requirements that couldn&#8217;t be done with Artisteer, but as usual it&#8217;s few lines of code. Well, i&#8217;m not going to stop with this design, but to improve it time to time.</p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/10/14/welcome/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
