<?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>Installation Developer &#187; Controlling Visibility of Custom Dialog Box Controls</title>
	<atom:link href="http://www.installationdeveloper.com/590/controlling-visibility-of-custom-dialog-box-controls/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.installationdeveloper.com</link>
	<description>InstallShield Training - InstallShield Tutorials</description>
	<lastBuildDate>Tue, 27 Jul 2010 14:57:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Controlling Visibility of Custom Dialog Box Controls</title>
		<link>http://www.installationdeveloper.com/590/controlling-visibility-of-custom-dialog-box-controls/</link>
		<comments>http://www.installationdeveloper.com/590/controlling-visibility-of-custom-dialog-box-controls/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 00:01:09 +0000</pubDate>
		<dc:creator>Rod_Maupin</dc:creator>
				<category><![CDATA[InstallShield Training]]></category>
		<category><![CDATA[installshield class]]></category>
		<category><![CDATA[installshield classes]]></category>
		<category><![CDATA[installshield course]]></category>
		<category><![CDATA[installshield courses]]></category>
		<category><![CDATA[installshield programmer]]></category>
		<category><![CDATA[installshield tutorial]]></category>
		<category><![CDATA[installshield tutorials]]></category>

		<guid isPermaLink="false">http://www.installationdeveloper.com/?p=590</guid>
		<description><![CDATA[When you create a custom dialog box in an InstallScript or InstallScript MSI project, you may need to control the visibility of certain controls.  An example is radio buttons.
Let&#8217;s say you have several radio buttons in a custom dialog box. You do not need all of them to be visible all of the time. [...]]]></description>
			<content:encoded><![CDATA[<p>When you create a custom dialog box in an InstallScript or InstallScript MSI project, you may need to control the visibility of certain controls.  An example is radio buttons.</p>
<p>Let&#8217;s say you have several radio buttons in a custom dialog box. You do not need all of them to be visible all of the time.  Sometimes, you just need one, other times two, and so on.  As a result, you want to show the ones you need and hide the ones you don&#8217;t.</p>
<p>Here are the basic steps involved.</p>
<ol>
<li>Call CmdGetHwndDlg() to get the handle to the dialog.</li>
<li>Call GetDlgItem() to get the handle of a radio button control.</li>
<li>Call CtrlSetState() to set the state of a radio button (selected or unselected).</li>
<li>Call _WinSubEnableControl() to enable or disable a radio button.</li>
<li>Call _WinSubShowWindow() to show or hide a radio button.</li>
<li>Call CtrlSetText() to set the text for a radio button.</li>
</ol>
<p>Check out this code sample:<br />
<strong><br />
#define RADIO1&nbsp;&nbsp;&nbsp;1441<br />
#define RADIO2&nbsp;&nbsp;&nbsp;1442</p>
<p>HWND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hwndDlg,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hwndRadio1,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hwndRadio2;</p>
<p>STRING&nbsp;&nbsp;&nbsp;szDlg;</p>
<p>// set name of custom dialog</p>
<p>szDlg = &#8220;DialogName&#8221;;</p>
<p>// get handle to custom dialog</p>
<p>hwndDlg = CmdGetHwndDlg(szDlg);</p>
<p>// get handles to radio buttons</p>
<p>hwndRadio1 = GetDlgItem(hwndDlg,RADIO1);<br />
hwndRadio2 = GetDlgItem(hwndDlg,RADIO2);</p>
<p>// set radio button 1 to checked, visible, enabled.  finally, set radio button text.</p>
<p>CtrlSetState(szDlg,RADIO1,BUTTON_CHECKED);<br />
_WinSubShowWindow(hwndRadio1,1);<br />
_WinSubEnableControl(hwndDlg,RADIO1,1);<br />
CtrlSetText(szDlg,RADIO1,@IDS_TEXT_STRING1);</p>
<p>// set radio button 2 to unchecked, non-visible, disabled.  finally, clear radio button text</p>
<p>CtrlSetState(szDlg,RADIO2,BUTTON_UNCHECKED);<br />
_WinSubShowWindow(hwndRadio2,0);<br />
_WinSubEnableControl(hwndDlg,RADIO2,0);<br />
CtrlSetText(szDlg,RADIO2,@IDS_TEXT_STRING2);<br />
</strong><br />
The main point to remember is that you won&#8217;t always find InstallScript functions to do what you want.  At those times you have to use Windows functions.</p>
<p>
&nbsp;</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;title=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls&amp;bodytext=When%20you%20create%20a%20custom%20dialog%20box%20in%20an%20InstallScript%20or%20InstallScript%20MSI%20project%2C%20you%20may%20need%20to%20control%20the%20visibility%20of%20certain%20controls.%20%20An%20example%20is%20radio%20buttons.%0D%0A%0D%0ALet%27s%20say%20you%20have%20several%20radio%20buttons%20in%20a%20custom%20dialog%20box.%20You%20do" title="Digg"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;title=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls&amp;notes=When%20you%20create%20a%20custom%20dialog%20box%20in%20an%20InstallScript%20or%20InstallScript%20MSI%20project%2C%20you%20may%20need%20to%20control%20the%20visibility%20of%20certain%20controls.%20%20An%20example%20is%20radio%20buttons.%0D%0A%0D%0ALet%27s%20say%20you%20have%20several%20radio%20buttons%20in%20a%20custom%20dialog%20box.%20You%20do" title="del.icio.us"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;t=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls" title="Facebook"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;h=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls" title="NewsVine"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;title=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls" title="Reddit"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;title=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls" title="StumbleUpon"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;title=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls&amp;annotation=When%20you%20create%20a%20custom%20dialog%20box%20in%20an%20InstallScript%20or%20InstallScript%20MSI%20project%2C%20you%20may%20need%20to%20control%20the%20visibility%20of%20certain%20controls.%20%20An%20example%20is%20radio%20buttons.%0D%0A%0D%0ALet%27s%20say%20you%20have%20several%20radio%20buttons%20in%20a%20custom%20dialog%20box.%20You%20do" title="Google Bookmarks"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;submitHeadline=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls&amp;submitSummary=When%20you%20create%20a%20custom%20dialog%20box%20in%20an%20InstallScript%20or%20InstallScript%20MSI%20project%2C%20you%20may%20need%20to%20control%20the%20visibility%20of%20certain%20controls.%20%20An%20example%20is%20radio%20buttons.%0D%0A%0D%0ALet%27s%20say%20you%20have%20several%20radio%20buttons%20in%20a%20custom%20dialog%20box.%20You%20do&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls%20-%20http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F" title="Twitter"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F" title="Technorati"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;title=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls" title="Live"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;title=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls&amp;source=Installation+Developer+InstallShield+Training+-+InstallShield+Tutorials&amp;summary=When%20you%20create%20a%20custom%20dialog%20box%20in%20an%20InstallScript%20or%20InstallScript%20MSI%20project%2C%20you%20may%20need%20to%20control%20the%20visibility%20of%20certain%20controls.%20%20An%20example%20is%20radio%20buttons.%0D%0A%0D%0ALet%27s%20say%20you%20have%20several%20radio%20buttons%20in%20a%20custom%20dialog%20box.%20You%20do" title="LinkedIn"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.installationdeveloper.com%2F590%2Fcontrolling-visibility-of-custom-dialog-box-controls%2F&amp;t=Controlling%20Visibility%20of%20Custom%20Dialog%20Box%20Controls" title="MySpace"><img src="http://www.installationdeveloper.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.installationdeveloper.com/590/controlling-visibility-of-custom-dialog-box-controls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
