<?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 &#187; codecharge</title>
	<atom:link href="http://starikovs.com/cat/codecharge/feed/" rel="self" type="application/rss+xml" />
	<link>http://starikovs.com</link>
	<description>BLOG</description>
	<lastBuildDate>Thu, 03 May 2012 22:40:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to execute additional SQL in After Execute family events in CCS</title>
		<link>http://starikovs.com/2010/10/23/exec-additional-sql-after-exec-events-ccs/</link>
		<comments>http://starikovs.com/2010/10/23/exec-additional-sql-after-exec-events-ccs/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 20:38:18 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[codecharge]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=398</guid>
		<description><![CDATA[Hi! This article is about how to execute some addtitional SQL after the primary SQL in the CodeCharge Studio&#8217;s Record has been executed. Very often I have to perform some additional manipulations with the database after the Record submission. In this article I want to share the approach I use to reach the desired result. [...]]]></description>
			<content:encoded><![CDATA[<p>Hi! This article is about how to execute some addtitional SQL after the primary SQL in the CodeCharge Studio&#8217;s Record has been executed.</p>
<p>Very often I have to perform some additional manipulations with the database after the Record submission. In this article I want to share the approach I use to reach the desired result. If you use a different approach to reach the same result I&#8217;m waiting your comments! <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-398"></span></p>
<p>So, here&#8217;re some steps:</p>
<p>1. You should have already a Record that performs Insert, Update or Delete.</p>
<p>2. Choose the event you will work with. It may be <strong>After Execute Insert</strong>, <strong>After Execute Update</strong> or <strong>After Execute Delete</strong>. I&#8217;ve chosen After Execute Insert to test with it in this example.</p>
<p>3. Add the Custom Code to the After Execute Insert event of the Record.</p>
<p>4. Try this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">/* $master is a Record we work with.
     * In the next line condition we check that no errors have been occured.
     */</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$master</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ds</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Errors</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Count</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$master</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ds</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CmdExecution</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// In the code below, we get the ID that has been inserted last time.</span>
        <span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> clsDBTest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SQL</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT LAST_INSERT_ID() AS master_id'</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SQL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">next_record</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$master_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">f</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;master_id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> 
                <span style="color: #000088;">$master_id</span> <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/* In this code snippet, we insert a new record to
         * another &quot;details&quot; table with the &quot;master id&quot; value.
         */</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$master_id</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> clsDBTest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SQL</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO  details (`master`, `test_field`) &quot;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SQL</span> <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot;VALUES (<span style="color: #006699; font-weight: bold;">$master_id</span>, 'test')&quot;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SQL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</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></pre></div></div>

<p>By the way, in this example I use PHP and MySQL. If you have an another configuration I think you can simply adapt this example to your configuration.<!--more--></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/10/23/exec-additional-sql-after-exec-events-ccs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hiding Link by condition in CCS</title>
		<link>http://starikovs.com/2010/10/23/hide-link-by-condition-ccs/</link>
		<comments>http://starikovs.com/2010/10/23/hide-link-by-condition-ccs/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 13:20:46 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[codecharge]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=386</guid>
		<description><![CDATA[Once my friend asked me about how to hide the Link in CodeCharge Studio by the condition. For example, suppose that we want to hide the Link if the one particular parameter exists in the GET request. I tryed to show it quickly to him but I wasn&#8217;t able. I added Hide-Show Component action to [...]]]></description>
			<content:encoded><![CDATA[<p>Once my friend asked me about how to hide the Link in CodeCharge Studio by the condition. For example, suppose that we want to hide the Link if the one particular parameter exists in the GET request. I tryed to show it quickly to him but I wasn&#8217;t able. I added <strong>Hide-Show Component</strong> action to the <strong>Before Show</strong> event of the page. Link still was there. I was confused.</p>
<p><span id="more-386"></span></p>
<p>We decided to seek help in source material (Help topics F1) and we found! The problem was in <strong>Visible</strong> property of the Link. Let&#8217;s see the Visible Property description in CCS help.</p>
<blockquote><p>
When set to <strong>Dynamic</strong>, the component is wrapped within a special HTML template that allows it to be <strong>hidden programmatically at runtime</strong>.
</p></blockquote>
<p>In such a way, to fix this problem set <code>Visible</code> property of the Link to <code>Dynamic</code> and add <code>Hide-Show Component</code> action to the <code>Before Show</code> event of the Link.</p>
<p>This approach is valid also for:</p>
<ul>
<li>TextBox</li>
<li>TextArea</li>
<li>CheckBox</li>
<li>Image</li>
<li>Image Link</li>
<li>Radio Button</li>
<li>ListBox</li>
<li>May be some other controls <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/10/23/hide-link-by-condition-ccs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UTF-8 problem in CCS monolingual project</title>
		<link>http://starikovs.com/2010/10/16/utf-8-problem-ccs/</link>
		<comments>http://starikovs.com/2010/10/16/utf-8-problem-ccs/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 09:49:29 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[codecharge]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=379</guid>
		<description><![CDATA[Hi everybody! I&#8217;ve just run into an obstacle related with UTF-8 encoding in CodeCharge Studio. I have a one language project. The project is in russian. I want to use UTF-8 for my project but the project isn&#8217;t internationalized. So, I removed the english language and added a russian. Also, I turned off the using [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://starikovs.com/wp-content/uploads/2010/10/uft8ccs1.png" alt="uft8ccs1" title="uft8ccs1" width="204" height="81" class="alignleft size-full wp-image-380" /> Hi everybody! I&#8217;ve just run into an obstacle related with UTF-8 encoding in CodeCharge Studio. I have a one language project. The project is in russian. I want to use UTF-8 for my project but the project isn&#8217;t internationalized. So, I removed the english language and added a russian. Also, I turned off the using of internationalized features (Project Settings -> Locales and Encodings -> Use internationalized features) because the project isn&#8217;t multilingual. As a result, I have a corrupted text (question marks everywhere).</p>
<p>I started to experiment. The problem was in checkbox &#8220;Use internationalized features&#8221;. After I checked it the encoding fixed! Huh!</p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/10/16/utf-8-problem-ccs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing HTML standards of an existing CodeCharge Studio project</title>
		<link>http://starikovs.com/2010/10/01/change-template-type-existing-project-ccs/</link>
		<comments>http://starikovs.com/2010/10/01/change-template-type-existing-project-ccs/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 08:47:12 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[codecharge]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=360</guid>
		<description><![CDATA[I&#8217;ve just tryed to change the template type of an exiting project in CodeCharge Studio. To my surprise, there isn&#8217;t an option in CCS to change the project template or Section508 compatibility. When you create a new project in CodeCharge Studio, it allows to create a project that is compatible with HTML or XHTML standards. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just tryed to change the template type of an exiting project in CodeCharge Studio. To my surprise, there isn&#8217;t an option in CCS to change the project template or Section508 compatibility.</p>
<p>When you create a new project in CodeCharge Studio, it allows to create a project that is compatible with <strong>HTML</strong> or <strong>XHTML</strong> standards. Also, there&#8217;s an option that turns on <strong>Section508</strong> compatibility.</p>
<p>But what should you do when you need to change these options of an existing project?</p>
<p><span id="more-360"></span></p>
<p>As I&#8217;ve just found out that there&#8217;s only one way to change them. You should modify the project file. CCS project file is saved in XML format and it has a <code>*.ccs</code> extension.</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;Site</span> ... <span style="color: #000066;">htmlTemplateType</span>=<span style="color: #ff0000;">&quot;xHTML&quot;</span> <span style="color: #000066;">isSection508</span>=<span style="color: #ff0000;">&quot;True&quot;</span> ... <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>To change the template type you should change <code>htmlTemplateType</code> attribute. Allowed values are: <code>HTML</code> or <code>xHTML</code>.</p>
<p>To change Section508 compatibility you should change <code>isSection508</code> attribute. Allowed values are: <code>True</code> or <code>False</code>.</p>
<p>Before you changing these attributes you should close the project. And after changing these attributes you have to:</p>
<ul>
<li>Regenerate all the project by <code>Project Explorer -> Right Click -> Generate Code</code>.</li>
<li>Regenerate all the pages HTML templates by switching between Design mode, adding a space, for example, and switching to HTML.
<li>And you should switch to Code tab and back to HTML tab to regenerate JavaScript.</li>
</ul>
<p>After chese changes, <strong>there will be some complexities</strong> like <code>xmlns</code> attributes or XML comments in JavaScripts. You should change this code by hands. When you create new pages everything will be OK.</p>
<h3>Links</h3>
<p><a href="http://www.yessoftware.com/?2628" target="_blank">CodeCharge Studio&#8217;s web site</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/10/01/change-template-type-existing-project-ccs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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> <span style="color: #993333; font-weight: bold;">INT</span><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> <span style="color: #993333; font-weight: bold;">VARCHAR</span><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>7</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;">50%</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;">50%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>Links</h3>
<p><a href="http://www.yessoftware.com/?2628" target="_blank">CodeCharge Studio&#8217;s web site</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/12/04/centering-horizontal-css-menu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating dialog in CodeCharge Studio</title>
		<link>http://starikovs.com/2009/11/21/creating-dialog-in-ccs/</link>
		<comments>http://starikovs.com/2009/11/21/creating-dialog-in-ccs/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 14:33:54 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[codecharge]]></category>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

<h3>Conclusion</h3>
<p>And now Your dialog should work! Congratulations <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You can test it by placing a Flash Movie into a project folder and pasting it into a page with help of Your dialog. Then go to Project-&gt;Settings-&gt;Publishing and configure extesions of the publishing files, in general, add swf extension. Then publish a project and enjoy Your work! <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You can download here the source code of the dialog and copy it to Your <em>Components</em> folder. But be careful with translations, You should  copy text from the example file <em>Components/Translations/IDE/English_example.txt</em> and paste it to the end of the file <em>Components/Translations/IDE/English.txt</em> of Your Components.</p>
<p>I&#8217;ve tested this example in CodeCharge Studio 3 and 4.</p>
<p>If You have questions or wishes I am waiting for Your comments. I am also going to publish some other articles about extending CodeCharge Studio as well as about CCS features. </p>
<h3>Download</h3>
<p><a href='http://starikovs.com/wp-content/uploads/2009/11/FirstDialogSrc.zip'>Dialog Source Code (FirstDialogSrc.zip)</a></p>
<p><a href='http://starikovs.com/wp-content/uploads/2009/11/FirstDialog.zip'>Test Project (FirstDialog.zip)</a></p>
<h3>Links</h3>
<p><a href="http://www.yessoftware.com/?2628" target="_blank">CodeCharge Studio&#8217;s web site</a></p>
<p><a href="http://www.leconcombre.com/board/dl/us/mammyblue1us.html" target="_blank">Flash example</a></p>
<p><a target="_blank" href="http://click.linksynergy.com/fs-bin/click?id=NBbn9UMzm1Y&#038;offerid=173675.10000001&#038;type=3&#038;subid=0">Try Artisteer to generate themes for CodeCharge Studio</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/11/21/creating-dialog-in-ccs/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

