<?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>Sat, 28 Aug 2010 07:56:28 +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>Simple ajax editing in CodeCharge Studio</title>
		<link>http://starikovs.com/2010/08/28/ajax-editing-ccs/</link>
		<comments>http://starikovs.com/2010/08/28/ajax-editing-ccs/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 07:54:09 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[codecharge]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=285</guid>
		<description><![CDATA[
How to implement an Ajax editing in CodeCharge Studio like in the picture above? Is it easy or not? Yes, it&#8217;s easy! It takes a half an hour at the maximum. In this article, I will provide step by step instructions. Also, you can download an example here. 
The main idea of this example is [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/ajax-editing-in-ccs.png" alt="Ajax editing in CCS" /><br />
How to implement an Ajax editing in CodeCharge Studio like in the picture above? Is it easy or not? Yes, it&#8217;s easy! It takes a half an hour at the maximum. In this article, I will provide step by step instructions. Also, you can download an example <a href="http://starikovs.com/my-examples/ccs-ajax-editing/NewProject3.zip">here</a>. </p>
<p>The main idea of this example is the ajax editing without the page refresh. When you click a link in the Grid the Show Modal dialog is opened. The Show Modal dialog contains a Record that allows to edit the data. All the actions are performed inside the Update Panels. Well, stay reading and you will see how to do it&#8230; <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-285"></span></p>
<h3>Steps</h3>
<p><strong>1.</strong> I use <code>test</code> db and a table named <code>countries</code> in my localhost MySQL server.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`test`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`countries`</span>;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span>  <span style="color: #ff0000;">`test`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`countries`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`name`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">45</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>InnoDB <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">9</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>latin1;</pre></div></div>

<p><strong>2.</strong> Add an UpdatePanel to the page and name it Panel1.</p>
<p><strong>3.</strong> Add a Grid to the Panel1. Grid should be created for the table <code>countries</code>. For the fields for Grid select only <code>name</code> field.</p>
<p><strong>4.</strong> After the Grid&#8217;s been created change the Label <code>name</code> to Link. Configure Href Source parameters for the Link. Add the <code>id</code> parameter with the SourceType of DataField and Parameter Source of <code>id</code> field. Leave the Link&#8217;s address empty. Also, add a Link for adding a new record. A new record Link should have no parameters and should remove the <code>id</code> parameter (Link->PW->Remove parameters->&#8221;id&#8221;).</p>
<p><strong>5.</strong> Add another UpdatePanel to the page and name it Panel2.</p>
<p><strong>6.</strong> Add ShowModal feature to Panel2 (Panel2->PW->Features->Add ShowModal). For the Show event select Panel1->countries->name->onclick and Panel1->countries->New->onclick. It makes ShowModal to be shown when Grid Row Link or Grid New Link is clicked.</p>
<p><strong>7.</strong> Add a new Record to a Panel2. A Record should be created on <code>countries</code> table and select only the <code>name</code> field.</p>
<p><strong>8.</strong> Add a Link to the end of the Panel2. This Link will hide the opened ShowModal. Also, go to Panel2->PW->Features->ShowModal and select for the Hide event this Link.</p>
<p><strong>9.</strong> Add this JavaScript to the end of the <code>&lt;head&gt;</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #006600; font-style: italic;">/* This function should be called by links that open the ShowModal dialog. 
 * It sets a new href for the UpdatePanel according of clicked link 
 * and loads the data to the corresponding Record.
 */</span>
<span style="color: #003366; font-weight: bold;">function</span> RelocatePanel2<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;">/* Panel2 is an UpdatePanel that contains a Record.
     * Also, Panel2 has a ShowModal feture.
     * Here, the location of the Panel2 is changed to have a new href 
     * with the id for Record.
     */</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Panel2&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">href</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">/* To load a new data to the Record according with the href that 
     * is set above, Panel2 should be reloaded. 
     */</span>
    AjaxPanel.<span style="color: #660066;">reload</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Panel2&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: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p><strong>10.</strong> Again, add to the end of the <code>&lt;head&gt;</code> this style:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
<span style="color: #808080; font-style: italic;">/* This style makes Show Modal dialog wider. */</span>
body <span style="color: #6666ff;">.ModalShowDiv</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">350px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p><strong>11.</strong> To the end of the Panel1 add this JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #006600; font-style: italic;">/* RelocatePanel2() is added to the click event chain so it will be called
     * by all the record links in Grid. 
     * RelocatePanel2() sets a new href for the Record Update Panel and 
     * reloads the Record Update Panel.
     */</span>
    addEventHandler<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Panel1countriesname&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> RelocatePanel2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009966; font-style: italic;">/* Call RelocatePanel2() when a new link is clicked, too. */</span>
    addEventHandler<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Panel1countriesNew&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> RelocatePanel2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">/* RelocatePanel2() and Panel2ShowModal1_show() are in the 
     * click event chain so they are called one after another. 
     */</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>When the Panel1 is loaded the corresponding click events are set for the Links. The events should be binded on every refresh of an UpdatePanel and this is exactly what we do here.</p>
<p><strong>12.</strong> Add to the end of the Panel2 this JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #009966; font-style: italic;">/* Reload the Grid Update Panel when some actions with Record are made. */</span>
    AjaxPanel.<span style="color: #660066;">reload</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Panel1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>This JavaScript refreshes the Panel1 with the Grid to reflect the changes that made with the Record.</p>
<h3>Conclusion</h3>
<p>So, with help of CodeCharge Studio and a bit of coding of JavaScript and CSS the professional ajax applications can be created. For this example, I use a Grid and Record components and UpdatePanel and ShowModal fetures. Also, I use a bit of JavaScript and CSS coding. Now, it&#8217;s time to you to try something like this to create <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Links</h3>
<p><a title="Rapid Web Application Development Tool" href="http://www.yessoftware.com/?2628" target="_blank">CodeCharge Studio</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/08/28/ajax-editing-ccs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using CSS3 rounded corners in practice</title>
		<link>http://starikovs.com/2010/08/24/css3-rounded-corners/</link>
		<comments>http://starikovs.com/2010/08/24/css3-rounded-corners/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 08:44:38 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=224</guid>
		<description><![CDATA[
	div.css3-rounded-corners {
		width: 100px;
		height: 50px;
		border: 2px solid #000;
		background-color: #fff;
	}
	#border-radius {
		border-color: red;
		border-radius: 20px; /* CSS3 declaration */
		-webkit-border-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 20px; /* Linux browsers */
		behavior: url(/my-examples/files/border-radius.htc); /* maybe ALL IE */
	}
	#border-top-right-radius {
		border-color: green;
		border-top-right-radius: 20px; /* CSS3 declaration */
		-webkit-border-top-right-radius: 20px; /* declaration [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css">
	div.css3-rounded-corners {
		width: 100px;
		height: 50px;
		border: 2px solid #000;
		background-color: #fff;
	}
	#border-radius {
		border-color: red;
		border-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 20px; /* Linux browsers */
		behavior: url(/my-examples/files/border-radius.htc); /* maybe ALL IE */
	}
	#border-top-right-radius {
		border-color: green;
		border-top-right-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-top-right-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius-topright: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-top-right-radius: 20px; /* Linux browsers */
	}
	#border-bottom-right-radius {
		border-color: blue;
		border-bottom-right-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-bottom-right-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius-bottomright: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-bottom-right-radius: 20px; /* Linux browsers */
	}
	#border-bottom-left-radius {
		border-color: orange;
		border-bottom-left-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-bottom-left-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius-bottomleft: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-bottom-left-radius: 20px; /* Linux browsers */
	}
	#border-top-left-radius {
		border-color: pink;
		border-top-left-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-top-left-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius-topleft: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-top-left-radius: 20px; /* Linux browsers */
	}
	#border-complex1-radius {
		border-color: Gold;</p>
<p>		border-radius: 30px 0 30px 0; /* CSS3 declaration */</p>
<p>		-webkit-border-radius: 30px 0 30px 0; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 30px 0 30px 0; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 30px 0 30px 0; /* Linux browsers */
	}
	#border-complex2-radius {
		border-color: OrangeRed;</p>
<p>		border-radius: 10px 30px 10px 30px ; /* CSS3 declaration */</p>
<p>		-webkit-border-radius: 10px 30px 10px 30px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 10px 30px 10px 30px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 10px 30px 10px 30px; /* Linux browsers */
	}
	#border-complex3-radius {
		border-color: violet;</p>
<p>		border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px; /* CSS3 declaration */</p>
<p>		-webkit-border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px; /* Linux browsers */
	}
        table.css3-rounded-corners-table td { border: 0; padding: 7px; vertical-align: middle; }
</style>
<p>In this article, I am going to test CSS 3 rounded corners. I do want to know can if I can use them in practice in different browsers. Here are some examples of CSS3 rounded corners and if you can see some rounded corners &#8211; congratulations your browser supports them!</p>
<table border="0" class="css3-rounded-corners-table">
<tr>
<td>
<div id="border-radius" class="css3-rounded-corners"></div>
</td>
<td>border-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-top-right-radius" class="css3-rounded-corners"></div>
</td>
<td>border-top-right-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-bottom-right-radius" class="css3-rounded-corners"></div>
</td>
<td>border-bottom-right-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-bottom-left-radius" class="css3-rounded-corners"></div>
</td>
<td>border-bottom-left-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-top-left-radius" class="css3-rounded-corners"></div>
</td>
<td>border-top-left-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-complex1-radius" class="css3-rounded-corners"></div>
</td>
<td>border-radius: 30px 0 30px 0</td>
</tr>
<tr>
<td>
<div id="border-complex2-radius" class="css3-rounded-corners"></div>
</td>
<td>border-radius: 10px 30px 10px 30px</td>
</tr>
<tr>
<td>
<div id="border-complex3-radius" class="css3-rounded-corners"></div>
</td>
<td>border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px</td>
</tr>
</table>
<p><span id="more-224"></span></p>
<h3>Browsers</h3>
<p>Before CSS3 appeared, web developers had to use some combinations of DIV’s or other container elements with curved corner images to achieve the desired result. Today, when CSS3 is supported by almost all the popular browsers the approach to make rounded corners is very easier, shorter and faster.</p>
<p>The only one little problem has place, is the compatibility with IE.</p>
<p>Here’s the table of browsers I tested on:</p>
<table>
<tr>
<th>Browser</th>
<th>Supports rounded corners</th>
</tr>
<tr>
<td>FireFox 3.6</td>
<td>Yes</td>
</tr>
<tr>
<td>Safari 5</td>
<td>Yes</td>
</tr>
<tr>
<td>Opera 10</td>
<td>Yes</td>
</tr>
<tr>
<td>Chrome</td>
<td>Yes</td>
</tr>
<tr>
<td>IE 6+</td>
<td>Limited and only with hacks</td>
</tr>
<tr>
<td>IE 9</td>
<td>Microsoft pomised</td>
</tr>
</table>
<h3>IE workaround</h3>
<p>To make curved corners in IE the behavior htc file should be used. You can download the file from here <a href="http://code.google.com/p/curved-corner/" target="_blank">http://code.google.com/p/curved-corner/</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
...
behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border-radius.htc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>There&#8217;re some limitations, for example, this behaviour htc file can round only all the corners of the container, but it cannot round only one, two or three specific corners. So, the CSS3 allows to round only right corner, for example, but the behavior htc file doesn’t. Other issues you can find at the page of this htc file.</p>
<h3>CSS rules for all browsers</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> 
&nbsp;
<span style="color: #808080; font-style: italic;">/* declaration for WebKit browsers like: Safari, Chrome */</span>
-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> 
&nbsp;
<span style="color: #808080; font-style: italic;">/* declaration for Mozilla browsers like FireFox */</span>
-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> 
&nbsp;
 <span style="color: #808080; font-style: italic;">/* Linux browsers */</span>
-khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
 <span style="color: #808080; font-style: italic;">/* maybe ALL IE */</span>
behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border-radius.htc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<h3>Understanding syntax</h3>
<p>The curved corner is a quarter of the ellipse that defines the shape of the corner. To understand that see the image from the W3C:</p>
<p><img src="http://www.w3.org/TR/2002/WD-css3-border-20021107/corner.png" alt="Ellipse that defines the shape of the corners." /></p>
<p>So, to define the rounded corner the horizontal and vertical radii should be set, but the vertical radius parameter is optional. If you define only one parameter it will be applied to the horizontal and vertical radii.</p>
<p>Now, let’s see the syntax:</p>
<p><strong>border-radius:</strong> <span style="color:#D2691E">[&lt;length&gt; | &lt;percentage&gt;]{1,4}</span><span style="color:#228B22"> [ / [&lt;length&gt; | &lt;percentage&gt;]{1,4} ]?</span></p>
<p><span style="color:#D2691E">The first parameter defines the horizontal radius and if the second parameter is missed the vertical radius.</span></p>
<p><span style="color:#228B22">The second parameter defines the vertical radius of the ellipse that defines the shape of the corner.</span></p>
<p>The ‘border-radius’ sets values for all the four corners.</p>
<p><strong>Examples:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* all the corners have an equal curved corner */</span>
border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> 
&nbsp;
 <span style="color: #808080; font-style: italic;">/* works as in the picture above */</span>
border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">55pt</span> / <span style="color: #933;">25pt</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>border-top-right-radius, <br />border-bottom-right-radius, <br />border-bottom-left-radius, <br />border-top-left-radius: </strong><span style="color:#D2691E">[&lt;length&gt; | &lt;percentage&gt;]</span><span style="color:#228B22"> [&lt;length&gt; | &lt;percentage&gt;]?</span></p>
<p><span style="color:#D2691E">The first parameter defines the horizontal radius and if the second parameter is missed the vertical radius.</span></p>
<p><span style="color:#228B22">The second parameter defines the vertical radius of the ellipse that defines the shape of the corner.</span></p>
<p>All of these properties set the only one specific corner.</p>
<p><strong>Examples:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* sets the top left corner */</span>
border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
 <span style="color: #808080; font-style: italic;">/* sets the top right corner as in the picture above */</span>
border-top-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">55pt</span> <span style="color: #933;">25pt</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>More info on syntax you can find at W3C site:</strong> <a href="http://www.w3.org/TR/2010/WD-css3-background-20100612/#the-border-radius" target="_blank">http://www.w3.org/TR/2010/WD-css3-background-20100612/#the-border-radius</a>.</p>
<h3>Practice</h3>
<p>Let&#8217;s create a div the corners of which we will curve.</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;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;curved-corners&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>To curve all the corners we should write these styles:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#curved-corners</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
	border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* declaration for WebKit browsers like: Safari, Chrome */</span>
	-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* declaration for Mozilla browsers like FireFox */</span>
	-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* Linux browsers */</span>
	-khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* maybe ALL IE  */</span>
	behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border-radius.htc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>By the way, you should download border-radius.htc from Google Code and copy it to the location you need, and then specify the correct path to border-radius.htc. So, let&#8217;s look at the example above in work:</p>
<div style="position:relative;width:100px;height:50px;border:2px solid red;border-radius:20px;-webkit-border-radius:20px;-moz-border-radius:20px;-khtml-border-radius: 20px;behavior:url(/my-examples/files/border-radius.htc);background-color:#fff;"></div>
<p>Now, let&#8217;s curve only top left and bottom right borders. We are still using the same DIV but define another styles.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#curved-corners</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
	border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
	border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* declaration for WebKit browsers like: Safari, Chrome */</span>
	-webkit-border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
	-webkit-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* declaration for Mozilla browsers like FireFox */</span>
	-moz-border-radius-topleft<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	-moz-border-radius-bottomright<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* Linux browsers */</span>
	-khtml-border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	-khtml-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>We aren&#8217;t using htc file for IE because it cannot curve specific corners. It can curve all the four corners only. So, let&#8217;s see the example above at work:</p>
<div style="width:100px;height:50px;border:2px solid blue;border-top-left-radius:20px;border-bottom-right-radius: 20px;-webkit-border-top-left-radius:20px;-webkit-border-bottom-right-radius:20px;-moz-border-radius-topleft:20px;-moz-border-radius-bottomright:20px;-khtml-border-top-left-radius:20px;-khtml-border-bottom-right-radius:20px;"></div>
<h3>Conclusion</h3>
<p>After testing how CSS3 can round borders, I can say that it&#8217;s cool. Even if you want to curve borders in IE6+ there&#8217;s a workaround but it&#8217;s a bit limited. I hope that some issues for this IE htc file will be fixed soon. Microsoft promised that IE9 will support CCS3 technique to curve corners. By the way, there&#8217;re a lot of popular web sites that have already begun to use CSS3 technique to round corners.</p>
<h3>Links</h3>
<p><a href="http://www.w3.org/TR/2002/WD-css3-border-20021107/#the-border-radius" target="_blank">W3C CSS3 Border Radius</a></p>
<p><a href="http://www.w3.org/TR/2010/WD-css3-background-20100612/#the-border-radius" target="_blank">W3C CSS3 Border Radius newer doc</a></p>
<p><a href="http://code.google.com/p/curved-corner/" target="_blank">Rounded corner HTML elements using CSS3 in IE (Download at Google Code)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/08/24/css3-rounded-corners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting String to Single in C#</title>
		<link>http://starikovs.com/2010/03/16/converting-string-to-single-in-c/</link>
		<comments>http://starikovs.com/2010/03/16/converting-string-to-single-in-c/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 17:09:45 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=214</guid>
		<description><![CDATA[Some time ago, I needed to get Flash Movie sizes inside of my C# code. I googled and I found some great examples of how I can do it. It was Mike Swanson&#8217;s example project called FlashTools. I downloaded it and stated to use. While I was using this code I found a little bug [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, I needed to get Flash Movie sizes inside of my C# code. I googled and I found some great examples of how I can do it. It was <a href="http://blogs.msdn.com/mswanson/" target="_blank">Mike Swanson&#8217;s</a> example project called FlashTools. I downloaded it and stated to use. While I was using this code I found a little bug that was occured depending of regional settings in the system. An error occured when FlashTools library tryed to convert String to Single. When I used English locale everything was going OK but when I changed the locale I got &#8220;Input string was not in a correct format&#8221;. A fix was very simple, I just passed the <code>InvariantCulture</code> as the second parameter of <code>Convert.ToSingle</code> method.<br />
<span id="more-214"></span><br />
A code snippet that causes an error:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// private Single frameRate = 0.0F;</span>
<span style="color: #FF0000;">string</span> sFrameRate <span style="color: #008000;">=</span> <span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;{0}.{1}&quot;</span>, frameRateMajor, frameRateMinor<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">frameRate</span> <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToSingle</span><span style="color: #000000;">&#40;</span>sFrameRate<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>A workaround:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// private Single frameRate = 0.0F;</span>
<span style="color: #FF0000;">string</span> sFrameRate <span style="color: #008000;">=</span> <span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;{0}.{1}&quot;</span>, frameRateMajor, frameRateMinor<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">frameRate</span> <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToSingle</span><span style="color: #000000;">&#40;</span>sFrameRate, 
  <span style="color: #000000;">System.<span style="color: #0000FF;">Globalization</span></span>.<span style="color: #0000FF;">CultureInfo</span>.<span style="color: #0000FF;">InvariantCulture</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Using the <code>System.Globalization.CultureInfo.InvariantCulture</code> the <code>Convert.ToSingle</code> method converts String to Single using the specified culture-specific formatting information.</p>
<h3>Links</h3>
<p><a href="http://blogs.msdn.com/mswanson/archive/2006/10/15/example-c-code-for-reading-flash-swf-files.aspx" target="_blank">Example C# Code for Reading Flash (SWF) Files</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/w7zs80w4%28VS.85%29.aspx" target="_blank">Convert.ToSingle Method</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/03/16/converting-string-to-single-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compatibility Mode doesn&#8217;t work in Internet Explorer 8.. Why?</title>
		<link>http://starikovs.com/2010/03/12/compatibility-mode-doesnt-work-in-ie8/</link>
		<comments>http://starikovs.com/2010/03/12/compatibility-mode-doesnt-work-in-ie8/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 14:26:53 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[ie8]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=205</guid>
		<description><![CDATA[Today I had a problem with IE8. Compatibility Mode for IE7 didn&#8217;t work. The tag order does matter but I have never thought it would.

Note: The meta tag should be placed in the head section before any script or CSS.  Read more at blogs.msdn.com.
So, in my HTML the meta tag was going after the [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had a problem with IE8. Compatibility Mode for IE7 didn&#8217;t work. The tag order does matter but I have never thought it would.<br />
<span id="more-205"></span></p>
<blockquote><p><strong>Note:</strong> The meta tag should be placed in the head section before any script or CSS.  Read more at <a href="http://blogs.msdn.com/askie/archive/2009/03/23/understanding-compatibility-modes-in-internet-explorer-8.aspx" target="_blank">blogs.msdn.com</a>.</p></blockquote>
<p>So, in my HTML the <code>meta</code> tag was going after the script tag and therefore Compatibility Mode didn&#8217;t work! I had just moved the <code>meta</code> tag with Compatibility Mode to the beginning of the <code>head</code> and it was a workaround!</p>
<p>In this code Compatibility Mode doesn&#8217;t work:</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;">head</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> 
// some code 
<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: #000000; font-weight: bold;">title</span>&gt;</span>Title<span style="color: #009900;">&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;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'IE=EmulateIE7'</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'X-UA-Compatible'</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></pre></div></div>

<p>In this code Compatibility Mode works:</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;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'IE=EmulateIE7'</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'X-UA-Compatible'</span><span style="color: #66cc66;">/</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> 
// some code 
<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: #000000; font-weight: bold;">title</span>&gt;</span>Title<span style="color: #009900;">&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: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span></pre></div></div>

<h3>Compatibility Mode Button</h3>
<p><img src="http://starikovs.com/wp-content/uploads/2010/03/ie8compmode.jpg" alt="ie8compmode" title="ie8compmode" width="242" height="84" class="alignleft size-full wp-image-212" /> </p>
<p>If this buttons is visible the Compatibility Mode turned off and You can switch it. Otherwise, the Compatibility Mode turned on and You cannot switch between Standard Mode and Compatibility Mode. So, visibility of this button is a fast way to detect if the Compatibility Mode turned on or turned off.</p>
<h3>Links</h3>
<p><a href="http://blogs.msdn.com/askie/archive/2009/03/23/understanding-compatibility-modes-in-internet-explorer-8.aspx" target="_blank">http://blogs.msdn.com/askie/archive/2009/03/23/understanding-compatibility-modes-in-internet-explorer-8.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/03/12/compatibility-mode-doesnt-work-in-ie8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to test for an empty javascript object</title>
		<link>http://starikovs.com/2010/03/10/test-for-empty-js-object/</link>
		<comments>http://starikovs.com/2010/03/10/test-for-empty-js-object/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 08:43:16 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=191</guid>
		<description><![CDATA[Hi everybody! I&#8217;ve just had a discussion of how to test for an emtpy javascript object. As a result, I have several code snippets and I want to share them with You.
Problem

alert&#40;&#123;&#125;==null&#41;; // false
alert&#40;&#123;&#125;==&#123;&#125;&#41;; // false
alert&#40;&#123;&#125;==&#123;&#125;&#41;; // false
alert&#40;&#123;&#125;==0&#41;; // false
alert&#40;&#123;&#125;==&#34;&#34;&#41;; // false
alert&#40;&#123;&#125;==&#91;&#93;&#41;; // false
// etc :)

So, none of the expressions above can check for an [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everybody! I&#8217;ve just had a discussion of how to test for an emtpy javascript object. As a result, I have several code snippets and I want to share them with You.</p>
<h3>Problem</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// false</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">==</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// false</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">==</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// false</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// false</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// false</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">==</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// false</span>
<span style="color: #006600; font-style: italic;">// etc :)</span></pre></div></div>

<p>So, none of the expressions above can check for an empty javascript object. </p>
<p><span id="more-191"></span></p>
<h3>Pure javascript solution</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> empty<span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> o<span style="color: #009900;">&#41;</span> 
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>o.<span style="color: #660066;">hasOwnProperty</span><span style="color: #009900;">&#40;</span>i<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>
&nbsp;
    <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></pre></div></div>

<table>
<tr>
<th nowrap="nowrap" style="vertical-align:top;">object.hasOwnProperty(property)</th>
<td>Returns a boolean indicating whether the object has the specified property. This method does not check down the object&#8217;s prototype chain. </p>
<p>Learn details of <em>hasOwnProperty</em> <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object/hasOwnProperty" target="_blank">here</a> at developer.mozilla.org.</td>
</tr>
</table>
<h3>JQuery + JQuery.JSON solution</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> o <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">toJSON</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'{}'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// true</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> o <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>a<span style="color: #339933;">:</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">toJSON</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'{}'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// false</span></pre></div></div>

<p>The code above simply converts an object to JSON string.</p>
<h3>Your way</h3>
<p>Well, if You have Your way of checking for an empty javascript object I am waiting Your comments! Thanks in advance!</p>
<h3>Links</h3>
<p><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object/hasOwnProperty" target="_blank">hasOwnProperty documentation</a></p>
<p><a href="http://jquery.com/" target="_blank">JQuery JavaScript Library</a></p>
<p><a href="http://code.google.com/p/jquery-json/" target="_blank">jquery-json plugin for JQuery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/03/10/test-for-empty-js-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>2</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>
