<?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>REALbasic City &#187; listbox</title>
	<atom:link href="http://realbasic.tutspolis.com/tag/listbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://realbasic.tutspolis.com</link>
	<description>Tutorials - Tutspolis.com</description>
	<lastBuildDate>Wed, 25 Aug 2010 11:44:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Listbox row info effect in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/listbox-row-info-effect-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/listbox-row-info-effect-in-realbasic/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 22:17:47 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[realbasic]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=242</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 242, userID 0, combination 1 -->In this tutorial we will learn how to add a nice looking Listbox row info effect that can be found for example in Apple Mail (new messages in Inbox) or in Chronories application (number of search results). Watch it, learn it, enjoy it! Add data to REALbasic Listbox Control Simply add a Listbox Control to [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 242, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Flistbox-row-info-effect-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Flistbox-row-info-effect-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this tutorial we will learn how to add a nice looking Listbox row info effect that can be found for example in Apple Mail (new messages in Inbox) or in Chronories application (number of search results). Watch it, learn it, enjoy it!</p>
<p><span id="more-242"></span></p>
<div style="margin-left:19px;float:left">
<h2>Add data to REALbasic Listbox Control</h2>
<p>Simply add a Listbox Control to Window1 and then in Listbox1 Sub Open () enter some code&#8230; Set also the DefaultRowHeight Property to 24.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">Listbox1.AddRow(<span style="color: #800000;">&quot;Folders&quot;</span>)
Listbox1.AddRow(<span style="color: #800000;">&quot;Files&quot;</span>)
Listbox1.AddRow(<span style="color: #800000;">&quot;Pictures&quot;</span>)
Listbox1.AddRow(<span style="color: #800000;">&quot;Movies&quot;</span>)
Listbox1.AddRow(<span style="color: #800000;">&quot;Music&quot;</span>)</pre></td></tr></table></div>

<h2>Add info effect and format data in REALbasic Listbox</h2>
<p>At this part we will format the look of our data, and we will also add row info effect with some random numbers inside. Add this code to Listbox1 Function CellTextPaint ().</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> r <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> <span style="color: #000080;">Random</span>
&nbsp;
&nbsp;
<span style="color: #000080;">if</span> column = 0 <span style="color: #000080;">then</span>
&nbsp;
    g.DrawString (me.Cell(row, 0), x, 18, g.Width - x, <span style="color: #000080;">true</span>) //draw the Listbox1.AddRow(<span style="color: #800000;">&quot;Folders&quot;</span>) etc.
&nbsp;
<span style="color: #000080;">end</span>
&nbsp;
&nbsp;
  g.ForeColor = &amp;cCDCDCD //change color <span style="color: #000080;">to</span> silver
  g.FillRoundRect(me.Width - 33, 3, 22,17, 15,15) //paint a round rectangle
&nbsp;
&nbsp;
  g.ForeColor = &amp;cFDFFFB //change color <span style="color: #000080;">to</span> white
  g.Bold = <span style="color: #000080;">true</span> //bold <span style="color: #000080;">on</span>
  g.TextSize = 11 //change font size <span style="color: #000080;">to</span> 11
&nbsp;
  g.DrawString(Str(r.InRange(0,9)),me.Width - 26, 15, g.Width - x, <span style="color: #000080;">true</span>) //draw a <span style="color: #000080;">String</span> <span style="color: #000080;">with</span> <span style="color: #000080;">random</span> number
&nbsp;
return <span style="color: #000080;">true</span></pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/listbox-row-info-effect-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PM: iPhone App Listbox for REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/pm-iphone-app-listbox-for-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/pm-iphone-app-listbox-for-realbasic/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 20:02:21 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[realbasic]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=233</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 233, userID 0, combination 1 -->In this tutorial for Premium Members we will learn how to create a similar to iPhone App Listbox available in iTunes for REALbasic. To get this kind of effect we will use a standard Listbox Control. Watch it, learn it, enjoy it and get a premium member account or buy access to only this material! [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 233, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fpm-iphone-app-listbox-for-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fpm-iphone-app-listbox-for-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this tutorial for Premium Members we will learn how to create a similar to iPhone App Listbox available in iTunes for REALbasic. To get this kind of effect we will use a standard Listbox Control. Watch it, learn it, enjoy it and get a premium member account or buy access to only this material!</p>
<p><span id="more-233"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating iPhone App Listbox GUI</h2>
<p>Add a Listbox Control to REALbasic and insert it on left side of Window1. Now in Property and Value panel lock the Listbox to left, top and bottom, disable UseFocusRing property, and change DefaultRowHeight to 40. Look on the screenshot to see what we will create.</p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/iphoneapplistbox.png" alt="iPhone App Listbox for REALbasic" /></p>
<p>	<div class='ArePayPalContent'>
	<p class='ArePayPalTextToShowIfNotLogedIn'>If you see this message you probably want access special material for Premium Members (Source Files, Bonus Tutorials, free Classes and More). You can do this by subscribing REALbasic City site for 10 USD (access for 3 months). There is also a option to buy access only to this material. Login or register to get option to buy and support REALbasic City.</p>
	<a class='ArePayPalLoginButton' href='http://tutspolis.com/wp-login.php'>Log in</a>
	</div></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/pm-iphone-app-listbox-for-realbasic/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Creating TreeView or hierarchical Listbox in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/creating-treeview-or-hierarchical-listbox-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/creating-treeview-or-hierarchical-listbox-in-realbasic/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 22:03:21 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[hierarchical]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[treeview]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=199</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 199, userID 0, combination 1 -->I know that some of you got problem with understanding how to create hierarchical Listbox in REALbasic. This tutorial will discover a method to create a TreeView using Listbox Control in two easy to follow steps. Watch it, learn it, enjoy it! Listbox hierarchical property Enabling Listbox hierarchical property in REALbasic will allows us to [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 199, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fcreating-treeview-or-hierarchical-listbox-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fcreating-treeview-or-hierarchical-listbox-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I know that some of you got problem with understanding how to create hierarchical Listbox in REALbasic. This tutorial will discover a method to create a TreeView using Listbox Control in two easy to follow steps. Watch it, learn it, enjoy it!</p>
<p><span id="more-199"></span></p>
<div style="margin-left:19px;float:left">
<h2>Listbox hierarchical property</h2>
<p>Enabling Listbox hierarchical property in REALbasic will allows us to disclosure triangles for rows added via the AddFolder method. On Windows, plus and minus signs are used instead of disclosure triangles.</p>
<h2>Creating TreeView in REALbasic</h2>
<p>Add to Window1 a Listbox Control and go to it Sub Open () event available in REALbasic Code Editor. Few things will happen here so look into the code comments. Before this I will explain you what NthField Function can do. The NthField function returns the field value from the source that precedes the fieldNumber occurrence of the separator in the source &#8211; NthField(source, separator, fieldNumber). We will use this to get our category menu and submenu options for each category (DEVICES,PLACES).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> menucat, submenu <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
<span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
me.Hierarchical = <span style="color: #000080;">true</span> //enabling the hierarchical Listbox <span style="color: #000080;">property</span>
me.ColumnWidths = <span style="color: #800000;">&quot;125,0&quot;</span> //setting the Listbox column width
&nbsp;
menucat = <span style="color: #800000;">&quot;DEVICES,PLACES&quot;</span> //creating the menu category list <span style="color: #000080;">for</span> Listbox
submenu = <span style="color: #800000;">&quot;Macintosh HD;Desktop,qbap,Applications,Documents,Downloads,Movies&quot;</span> //creating submenu list <span style="color: #000080;">for</span> menucat
&nbsp;
<span style="color: #000080;">for</span> i = 1 <span style="color: #000080;">to</span> CountFields (menucat, <span style="color: #800000;">&quot;,&quot;</span>) //count the category list by <span style="color: #800000;">&quot;,&quot;</span> mark
&nbsp;
  <span style="color: #000080;">if</span> NthField (submenu, <span style="color: #800000;">&quot;;&quot;</span>, i) &lt; &gt; <span style="color: #800000;">&quot;&quot;</span> <span style="color: #000080;">then</span>
    me.AddFolder <span style="color: #800000;">&quot;&quot;</span> //add a submenu 
    me.Cell (i-1,1) = NthField (submenu, <span style="color: #800000;">&quot;;&quot;</span>, i) //add submenu <span style="color: #000080;">to</span> menucat <span style="color: #000080;">and</span> separate the data by finding <span style="color: #800000;">&quot;;&quot;</span> mark
  <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
    me.Cell (i-1,0) = NthField (menucat, <span style="color: #800000;">&quot;,&quot;</span>, i) //add menucat items <span style="color: #000080;">to</span> Listbox
&nbsp;
<span style="color: #000080;">next</span>
&nbsp;
me.ColumnCount = 1</pre></td></tr></table></div>

<h2>Expand TreeView category menu</h2>
<p>As you probably can see our menu is now available in Listbox1 but it can&#8217;t expand. To get this effect done we must go to Listbox1 Sub ExpendRow () and make some fixes. Simply copy and paste this code there:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> menucat <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
<span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
menucat = me.Cell (row,1)
&nbsp;
//show <span style="color: #000080;">or</span> hide the submenu items  
<span style="color: #000080;">for</span> i = 1 <span style="color: #000080;">to</span> CountFields (menucat, <span style="color: #800000;">&quot;,&quot;</span>)
   me.AddRow <span style="color: #800000;">&quot;&quot;</span>
   me.Cell(me.LastIndex,0) = NthField (menucat, <span style="color: #800000;">&quot;,&quot;</span>, i)
<span style="color: #000080;">next</span></pre></td></tr></table></div>

<h3>Download</h3>
<p>	<div class='ArePayPalContent'>
	<p class='ArePayPalTextToShowIfNotLogedIn'>If you see this message you probably want access special material for Premium Members (Source Files, Bonus Tutorials, free Classes and More). You can do this by subscribing REALbasic City site for 10 USD (access for 3 months). There is also a option to buy access only to this material. Login or register to get option to buy and support REALbasic City.</p>
	<a class='ArePayPalLoginButton' href='http://tutspolis.com/wp-login.php'>Log in</a>
	</div></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/creating-treeview-or-hierarchical-listbox-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Drag reorder items in Listbox using REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/drag-reorder-items-in-listbox-using-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/drag-reorder-items-in-listbox-using-realbasic/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 13:27:59 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[items]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[reorder]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=160</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 160, userID 0, combination 1 -->In this quick and extreme easy tutorial we will learn how to reorder items in Listbox list using drag and drop method. This option can be used also as a function extension for iTunes like Sidebar from REALbasic City tutorial. Watch it, learn it, enjoy it! Enable drag reorder in Listbox Add a Listbox Control [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 160, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrag-reorder-items-in-listbox-using-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrag-reorder-items-in-listbox-using-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this quick and extreme easy tutorial we will learn how to reorder items in Listbox list using drag and drop method. This option can be used also as a function extension for <a href="http://realbasic.tutspolis.com/tutorials/creating-itunes-like-sidebar-for-realbasic/">iTunes like Sidebar from REALbasic City</a> tutorial. Watch it, learn it, enjoy it!</p>
<p><span id="more-160"></span></p>
<div style="margin-left:19px;float:left">
<h2>Enable drag reorder in Listbox</h2>
<p>Add a Listbox Control to Window1 in REALbasic. Now select it and in control Property and Value find EnableDragReorder and make sure it is enabled. And this is all.. from this moment you can reorder the items by drag and drop method. </p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/drag-reorder-items-in-listbox-using-realbasic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Listbox items count in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/listbox-items-count-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/listbox-items-count-in-realbasic/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 12:45:21 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[realbasic]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=156</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 156, userID 0, combination 1 -->In this quick tutorial we will learn how can we count how many rows are available in Listbox Control using REALbasic. This kind of effect is used in Apple Mail when we select a Inbox item. After this action in Window title is displayed a number of available emails. Watch it, learn it, enjoy it! [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 156, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Flistbox-items-count-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Flistbox-items-count-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this quick tutorial we will learn how can we count how many rows are available in Listbox Control using REALbasic. This kind of effect is used in Apple Mail when we select a Inbox item. After this action in Window title is displayed a number of available emails. Watch it, learn it, enjoy it!</p>
<p><span id="more-156"></span></p>
<div style="margin-left:19px;float:left">
<h2>Listbox list count</h2>
<p>Begin with adding a Listbox and some data to this control to REALbasic Window class. Now drag and drop PushButton Control to Window1 and in PushButton Sub Acton () insert this code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
<span style="color: #000080;">if</span>  ListBox1.ListCount &gt; 0 <span style="color: #000080;">then</span>
  <span style="color: #000080;">for</span> i = 0 <span style="color: #000080;">to</span> ListBox1.ListCount -1
    Window1.Title = <span style="color: #800000;">&quot;Inbox (&quot;</span> + Str(i + 1)  + <span style="color: #800000;">&quot; messeges)&quot;</span>
 <span style="color: #000080;">next</span>
<span style="color: #000080;">else</span>
    Window1.Title = <span style="color: #800000;">&quot;Inbox (0 messeges)&quot;</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/listbox-items-count-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Add Checkbox to Listbox in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/add-checkbox-to-listbox-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/add-checkbox-to-listbox-in-realbasic/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 12:12:47 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[celltype]]></category>
		<category><![CDATA[checkbox]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[realbasic]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=154</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 154, userID 0, combination 1 -->In this tutorial we will learn how can we add a Checkbox to Listbox Control in REALbasic. We will also learn how can we check the status of Checkbox in Listbox row. Watch it, learn it, enjoy it! Add Checkbox to Listbox Place a Listbox on Window1 Class and enter in this control some data [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 154, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fadd-checkbox-to-listbox-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fadd-checkbox-to-listbox-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this tutorial we will learn how can we add a Checkbox to Listbox Control in REALbasic. We will also learn how can we check the status of Checkbox in Listbox row. Watch it, learn it, enjoy it!</p>
<p><span id="more-154"></span></p>
<div style="margin-left:19px;float:left">
<h2>Add Checkbox to Listbox</h2>
<p>Place a Listbox on Window1 Class and enter in this control some data in Listbox1 Property InitalValue. Now can you add for example to Listbox1 Sub Open () a code to display a  Checkbox in each row available in column 0.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">me.ColumnType(0) = ListBox1.TypeCheckBox // ColumnType(column number)</pre></td></tr></table></div>

<h2>Checkbox status in Listbox Control</h2>
<p>In this part we will count how many Checkboxes are checked in our Listbox Control. To do this we will add to Window1 a PushButton control and by double clicking on it we will go to Code Editor PushButton1 Sub Action (). Here we enter this code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> i, c <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
c = 0
&nbsp;
<span style="color: #000080;">for</span> i = 0 <span style="color: #000080;">to</span> ListBox1.ListCount-1 // check every cell <span style="color: #000080;">in</span> Listbox <span style="color: #000080;">control</span>
&nbsp;
  <span style="color: #000080;">if</span> ListBox1.CellCheck(i,0) = <span style="color: #000080;">true</span> <span style="color: #000080;">then</span> // <span style="color: #000080;">if</span> checked state = <span style="color: #000080;">true</span>
    c = c + 1
  <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
&nbsp;
<span style="color: #000080;">next</span> i
&nbsp;
MsgBox <span style="color: #800000;">&quot;You selected &quot;</span> + Str(c) + <span style="color: #800000;">&quot; items&quot;</span> //display how many items are checked</pre></td></tr></table></div>

<h2>ListBox.CellType</h2>
<p>We can also beyond TypeCheckBox add some other settings to Lisbox Cell. Sets the type of the passed cell. Row and Column are zero-based. Use the following class constants to set the CellType. TypeDefault (0): Default, same as its column type; TypeNormal (1): Normal, not editable; TypeCheckBox (2): Add checkbox; TypeEditable (3): Inline editable.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">Listbox1.CellType(1,1) = ListBox1.TypeEditable</pre></td></tr></table></div>

<p>The values of CellType &gt; 0 override ColumnType. For example, if ColumnType is 2, but a cell in the column has CellType set to 1, the cell will be normal.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/add-checkbox-to-listbox-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating iTunes like Sidebar for REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/creating-itunes-like-sidebar-for-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/creating-itunes-like-sidebar-for-realbasic/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 01:42:14 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[finder]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[sidebar]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=151</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 151, userID 0, combination 1 -->I&#8217;m very excited to show you my new tutorial about creating a iTunes or Finder like Sidebar for REALbasic using standard Listbox control and some easy steps to follow. Watch it, learn it, enjoy it! Creating iTunes Sidebar GUI Add a Listbox Control to REALbasic Window1 and insert it on left side of class. Now [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 151, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fcreating-itunes-like-sidebar-for-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fcreating-itunes-like-sidebar-for-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;m very excited to show you my new tutorial about creating a iTunes or Finder like Sidebar for REALbasic using standard Listbox control and some easy steps to follow. Watch it, learn it, enjoy it!</p>
<p><span id="more-151"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating iTunes Sidebar GUI</h2>
<p>Add a Listbox Control to REALbasic Window1 and insert it on left side of class. Now in Property and Value panel lock the Listbox to left, top and bottom, disable UseFocusRing property, change DefaultRowHeight to 20 and set up TextFont to Lucida Grande and TextSize to 10. Look on the screenshot to get what will happen next.</p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/itunessidebarrealbasic.png" alt="iTunes like Sidebar for REALbasic" /></p>
<h2>Change Listbox control background</h2>
<p>Go to Listbox1 Function CellBackgroundPaint in REALbasic Code Editor and use this code to replace the standard white color with Finder Sidebar color.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"> g.ForeColor = RGB(214,221,229) //iTunes Sidebar background color
 g.FillRect (0,0,g.Width,g.Height) //paint the color into Listbox</pre></td></tr></table></div>

<h2>Change default Listbox item heightlight</h2>
<p>To change Listbox heightlight color we can simply use this code in Listbox1 Function CellBackgroundPaint ().</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> me.Selected(row) <span style="color: #000080;">and</span> row &gt; 0 <span style="color: #000080;">then</span> //<span style="color: #000080;">and</span> <span style="color: #000080;">if</span> selected row <span style="color: #000080;">is</span> bigger than 0 (position of our PLACES) <span style="color: #000080;">then</span> draw green <span style="color: #000080;">select</span>
 g.ForeColor = RGB(39,170,45) //green color
 g.FillRect (0,0,g.Width,g.Height)
<span style="color: #000080;">else</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
&nbsp;
return <span style="color: #000080;">true</span> //paint it, it's very impotent <span style="color: #000080;">to</span> have return <span style="color: #000080;">true</span> because without it this won't work</pre></td></tr></table></div>

<h2>Gradient Listbox item select</h2>
<p>We can make this even better by creating in fly a nice blue gradient with option to make it go to gray when the Window or Listbox Control isn&#8217;t active. Add a New Method and as method name enter selectgradient and in parameters write g as graphics. Now insert some code there&#8230; This gradient technology was created by Alex Restrepo and it&#8217;s very easy to understand. You can also find some gradient algorithms in ImagePlay Effect classes.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">integer</span>, ratio, endratio <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>
<span style="color: #000080;">Dim</span> StartColor, EndColor, TopColor <span style="color: #000080;">As</span> Color
&nbsp;
// <span style="color: #000080;">select</span> colors <span style="color: #000080;">for</span> <span style="color: #000080;">not</span> active Window
<span style="color: #000080;">if</span> Listbox1.Active = <span style="color: #000080;">false</span> <span style="color: #000080;">or</span> Listbox1.Enabled = <span style="color: #000080;">false</span> <span style="color: #000080;">then</span>
    StartColor = RGB(168, 168, 168)
    EndColor = RGB(121, 121, 121)
    TopColor = RGB(145, 145, 145)
<span style="color: #000080;">else</span> // <span style="color: #000080;">select</span> colors <span style="color: #000080;">for</span> active Listbox
    StartColor = RGB(80, 171, 233)
    EndColor = RGB(0, 117, 215)
    TopColor = RGB(15, 145, 224)
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
&nbsp;
// Draw the gradient
<span style="color: #000080;">for</span> i = 0 <span style="color: #000080;">to</span> g.Height
&nbsp;
// Determine the current <span style="color: #000080;">line</span><span style="color: #008000;">'s color
</span>ratio = ((g.Height-i)/g.Height)
endratio = (i/g.Height)
g.ForeColor = RGB(EndColor.Red * endratio + StartColor.Red * ratio, EndColor.Green * endratio + StartColor.Green * ratio, EndColor.Blue * endratio + StartColor.Blue * ratio)
&nbsp;
// Draw the <span style="color: #000080;">step</span>
g.DrawLine 0, i, g.Width, i
<span style="color: #000080;">next</span>
&nbsp;
g.ForeColor = TopColor
g.DrawLine 0, 0, g.Width, 0</pre></td></tr></table></div>

<p>In this moment your Listbox1 Function CellBackgroundPaint () should look like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">g.ForeColor = RGB(214,221,229) //iTunes Sidebar background color
g.FillRect (0,0,g.Width,g.Height)
&nbsp;
<span style="color: #000080;">if</span> me.Selected(row) <span style="color: #000080;">and</span> row &gt; 0 <span style="color: #000080;">then</span> selectgradient(g) //<span style="color: #000080;">and</span> <span style="color: #000080;">if</span> selected row <span style="color: #000080;">is</span> bigger than 0 (position of our PLACES) <span style="color: #000080;">then</span> draw gradient <span style="color: #000080;">select</span>
&nbsp;
return <span style="color: #000080;">true</span> //paint it</pre></td></tr></table></div>

<h2>Add row and column to Listbox</h2>
<p>Now is time to add some live to our Listbox Control. Create a new method and name it showplaces.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
Listbox1.DeleteAllRows //clear Listbox <span style="color: #000080;">control</span>
&nbsp;
Listbox1.AddRow <span style="color: #800000;">&quot;PLACES&quot;</span> //add row 
&nbsp;
ListBox1.AddRow <span style="color: #800000;">&quot;REALbasic City&quot;</span> //add REALbasic City <span style="color: #000080;">to</span> row 1 <span style="color: #000080;">and</span> 1 column
ListBox1.Cell(1, 1) = <span style="color: #800000;">&quot;R&quot;</span> //<span style="color: #000080;">and</span> remember this row <span style="color: #000080;">and</span> column <span style="color: #000080;">as</span> R
&nbsp;
ListBox1.AddRow <span style="color: #800000;">&quot;Movies&quot;</span>
ListBox1.Cell(2, 1) = <span style="color: #800000;">&quot;M&quot;</span>
&nbsp;
ListBox1.AddRow <span style="color: #800000;">&quot;Downloads&quot;</span>
ListBox1.Cell(3, 1) = <span style="color: #800000;">&quot;D&quot;</span> 
&nbsp;
ListBox1.AddRow <span style="color: #800000;">&quot;Desktop&quot;</span>
ListBox1.Cell(4, 1) = <span style="color: #800000;">&quot;De&quot;</span> 
&nbsp;
ListBox1.AddRow <span style="color: #800000;">&quot;Music&quot;</span>
ListBox1.Cell(5, 1) = <span style="color: #800000;">&quot;Mu&quot;</span>
&nbsp;
ListBox1.AddRow <span style="color: #800000;">&quot;System&quot;</span>
ListBox1.Cell(6, 1) = <span style="color: #800000;">&quot;S&quot;</span> 
&nbsp;
Listbox1.ColumnAlignmentOffset(0)= 38 //<span style="color: #000080;">set</span> the text position offset</pre></td></tr></table></div>

<p>Enter to Listbox1 Sub Open () code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"> showplaces</pre></td></tr></table></div>

<h2>Listbox Clear</h2>
<p>To clear our Listbox we will create a method that will delete all rows from this control. In REALbasic Code Editor add a new method and name it hideplaces and enter code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> g <span style="color: #000080;">As</span> Graphics
&nbsp;
Listbox1.DeleteAllRows //clear Listbox
Listbox1.AddRow <span style="color: #800000;">&quot;PLACES&quot;</span></pre></td></tr></table></div>

<h2>Displaying icons in Listbox Control</h2>
<p>You can find some <a href="http://www.deviantart.com/download/109228512/Finder_Sidebar_for_Explorer_by_Ausrif.rar">Finder icons at Finder Sidebar for Explorer by ~Ausrif.</a> Add few to Project Tab by drag and drop method. Now is time to attach them to appropriate rows. Go to Listbox1 Function CellTextPaint () and enter there:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> column = 0 <span style="color: #000080;">then</span>
    <span style="color: #000080;">if</span> Me.cell(row,1) = <span style="color: #800000;">&quot;R&quot;</span> <span style="color: #000080;">then</span>
      g.DrawPicture(Applications,15,2) //(graphic name from Project Tab, x position, y position)
    <span style="color: #000080;">elseif</span> Me.cell(row,1) = <span style="color: #800000;">&quot;M&quot;</span> <span style="color: #000080;">then</span>
      g.DrawPicture(Movies,15,2)
    <span style="color: #000080;">elseif</span> Me.Cell(row,1) = <span style="color: #800000;">&quot;D&quot;</span> <span style="color: #000080;">then</span>
      g.DrawPicture(Downloads,15,2)
    <span style="color: #000080;">elseif</span> Me.Cell(row,1) = <span style="color: #800000;">&quot;De&quot;</span> <span style="color: #000080;">then</span>
      g.DrawPicture(Desktop,15,2)
    <span style="color: #000080;">elseif</span> Me.Cell(row,1) = <span style="color: #800000;">&quot;Mu&quot;</span> <span style="color: #000080;">then</span>
      g.DrawPicture(Music,15,2)
    <span style="color: #000080;">elseif</span> Me.Cell(row,1) = <span style="color: #800000;">&quot;S&quot;</span> <span style="color: #000080;">then</span>
      g.DrawPicture(System1,15,2)
    <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<h2>Listbox and TreeView effect</h2>
<p>In this part of Creating iTunes like Sidebar for REALbasic tutorial we will hide the Listbox item selection heightlight for the first row (PLACES) and hide all items available under the PLACES &#8220;group&#8221; after double clicking on row 0 and showing it again after next double clicking. Add a New Property and as Declaration type showlist and Value: Boolen and = true. Now in Listbox1 Function CellTextPaint () enter this code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> showlist = <span style="color: #000080;">true</span> <span style="color: #000080;">and</span> row = 0 <span style="color: #000080;">then</span>
&nbsp;
    g.Bold = <span style="color: #000080;">true</span> //make the font bold
    g.ForeColor = RGB(60,60,60) //change color
    g.DrawPicture(Arrow01,2,2) //draw Arrow01 image
&nbsp;
<span style="color: #000080;">elseif</span> row = 0 <span style="color: #000080;">then</span>
&nbsp;
    g.Bold = <span style="color: #000080;">true</span>
    g.ForeColor = RGB(60,60,60)
    g.DrawPicture(Arrow02,2,2)
&nbsp;
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<h2>Listbox click check method</h2>
<p>The last thing we will do in Listbox1 Function CellTextPaint () today is checking if the user has clicked on selected row and if he is we execute a action (renaming Window title). So add this code below.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> Me.Selected(row) <span style="color: #000080;">and</span> row = 1 <span style="color: #000080;">then</span> //when we <span style="color: #000080;">select</span> row <span style="color: #000080;">and</span> the row number will be 1 (REALbasic City) <span style="color: #000080;">then</span> 
    Window1.Title = Me.list(row) //change the Window title text <span style="color: #000080;">to</span> row text
<span style="color: #000080;">elseif</span> Me.Selected(row) <span style="color: #000080;">and</span> row = 2 <span style="color: #000080;">then</span> //when we <span style="color: #000080;">select</span> row <span style="color: #000080;">and</span> the row number will be 2 (Movies) <span style="color: #000080;">then</span> 
    Window1.Title = Me.list(row) //change the Window title text <span style="color: #000080;">to</span> row text 
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<h2>Listbox and TreeView effect</h2>
<p>To make our TreeView effect complete we must add to Listbox1 Sub DoubleClick () a code that will check if the users has double clicked on PLACES and what is the status of PLACES (the item are visible or not).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> Listbox1.Selected(0) <span style="color: #000080;">and</span> showlist = <span style="color: #000080;">true</span> <span style="color: #000080;">then</span>
    hideplaces
    showlist = <span style="color: #000080;">false</span>
<span style="color: #000080;">elseif</span> showlist = <span style="color: #000080;">false</span> <span style="color: #000080;">then</span>
    showplaces
    showlist = <span style="color: #000080;">true</span>
<span style="color: #000080;">end</span></pre></td></tr></table></div>

<h3>Download</h3>
<p>	<div class='ArePayPalContent'>
	<p class='ArePayPalTextToShowIfNotLogedIn'>If you see this message you probably want access special material for Premium Members (Source Files, Bonus Tutorials, free Classes and More). You can do this by subscribing REALbasic City site for 10 USD (access for 3 months). There is also a option to buy access only to this material. Login or register to get option to buy and support REALbasic City.</p>
	<a class='ArePayPalLoginButton' href='http://tutspolis.com/wp-login.php'>Log in</a>
	</div></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/creating-itunes-like-sidebar-for-realbasic/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>REALbasic Listbox control in Mac style</title>
		<link>http://realbasic.tutspolis.com/tutorials/realbasic-listbox-control-in-mac-style/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/realbasic-listbox-control-in-mac-style/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 18:38:53 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=145</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 145, userID 0, combination 1 -->When you are using Mac OS you can see in many software like iTunes, Adium, AppCleaner, AirRadar a cool looking Mac style Listbox control with white and blue cells. In this quick tutorial we will learn how can we create this kind of effect using REALbasic Listbox control and cell background paint function. Listbox Cell [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 145, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Frealbasic-listbox-control-in-mac-style%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Frealbasic-listbox-control-in-mac-style%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>When you are using Mac OS you can see in many software like iTunes, Adium, AppCleaner, AirRadar a cool looking Mac style Listbox control with white and blue cells. In this quick tutorial we will learn how can we create this kind of effect using REALbasic Listbox control and cell background paint function.</p>
<p><span id="more-145"></span></p>
<div style="margin-left:19px;float:left">
<h2>Listbox Cell Background Paint</h2>
<p>Everything what we need is a Listbox control available on Window1 class and a code in Listbox1 Function CellBackgroundPaint (). After compiling the project we will get a nice looking Listbox control that we can admire in our application.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> row <span style="color: #000080;">mod</span> 2 = 0 <span style="color: #000080;">then</span>
   g.ForeColor = &amp;cFFFFFF // white color
<span style="color: #000080;">else</span>
   g.ForeColor = &amp;cf3f7fb // blue color
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
  g.FillRect 0,0, g.Width, g.Height</pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/realbasic-listbox-control-in-mac-style/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>REALbasic Tip: Speed up controls</title>
		<link>http://realbasic.tutspolis.com/articles/realbasic-tip-speed-up-controls/</link>
		<comments>http://realbasic.tutspolis.com/articles/realbasic-tip-speed-up-controls/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 09:24:17 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[speed up]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=134</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 134, userID 0, combination 1 -->If you are not satisfied with the time of add or load data into some controls there is a nice way to speed it up to 5-7 times. For example when you add 1 000 000 rows to Listbox control you must wait over 10 seconds to finish. We can make this in 2-3 seconds… [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 134, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Farticles%2Frealbasic-tip-speed-up-controls%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Farticles%2Frealbasic-tip-speed-up-controls%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>If you are not satisfied with the time of add or load data into some controls there is a nice way to speed it up to 5-7 times. For example when you add 1 000 000 rows to Listbox control you must wait over 10 seconds to finish. We can make this in 2-3 seconds… </p>
<p><span id="more-134"></span></p>
<div style="margin-left:19px;float:left">
<h2>Speed up solution</h2>
<p>The solution for increasing the speed of some actions made in REALbasic controls is practically easy. We will use our Listbox Control example. REALbasic redraws the Listbox each time we AddRow to our control. To make it 5-7 times faster we must hide it for the time of using loop for i = 1 to 1000000. And this works!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
Listbox1.Visible = <span style="color: #000080;">false</span>
&nbsp;
<span style="color: #000080;">for</span> i = 1 <span style="color: #000080;">to</span> 1000000
    Listbox1.AddRow Str(i)
<span style="color: #000080;">next</span>
    Listbox1.Visible = <span style="color: #000080;">true</span></pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/articles/realbasic-tip-speed-up-controls/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Search Listbox in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/search-listbox-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/search-listbox-in-realbasic/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 14:00:02 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[columns]]></category>
		<category><![CDATA[enter key]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=131</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 131, userID 0, combination 1 -->In this quick tutorial we will learn how to search rows and columns in Listbox Control available in REALbasic. You will also find here a tip to execute search after pressing Enter key from keyboard. Watch it, learn it, enjoy it! Creating the GUI We will use in this tutorial Listbox Control, TextField Control and [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 131, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fsearch-listbox-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fsearch-listbox-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this quick tutorial we will learn how to search rows and columns in Listbox Control available in REALbasic. You will also find here a tip to execute search after pressing Enter key from keyboard. Watch it, learn it, enjoy it!</p>
<p><span id="more-131"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating the GUI</h2>
<p>We will use in this tutorial Listbox Control, TextField Control and PushButton Control. Drag and drop this controls on Window1 Class wherever you like and fill Listbox with some data. If you have no idea what data can you insert there use this code in Listbox1 Sub Open ().</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">Listbox1.ColumnCount = 2
Listbox1.InitialValue = <span style="color: #800000;">&quot;United Nations Day&quot;</span> + chr(9) + <span style="color: #800000;">&quot;UFC 104&quot;</span> + EndOfLine + <span style="color: #800000;">&quot;Halloween Costumes&quot;</span> + chr(9) + <span style="color: #800000;">&quot;Garth Brooks&quot;</span> + EndOfLine + <span style="color: #800000;">&quot;Los Angeles Angels&quot;</span> + chr(9) + <span style="color: #800000;">&quot;Hilary Swank&quot;</span> // chr(9) = Tab key</pre></td></tr></table></div>

<h2>Search Listbox Control</h2>
<p>Ok, in this moment we will search in Listbox all data (irrespective of number of rows and columns) to find our words for search. Add to PushButton1 Sub Open () some code&#8230; Please have in mind that our search code can return more than one result.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> i, c <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
<span style="color: #000080;">for</span> i = 0 <span style="color: #000080;">to</span> ListBox1.ListCount -1 
    <span style="color: #000080;">for</span> c = 0 <span style="color: #000080;">to</span> ListBox1.ColumnCount - 1
      <span style="color: #000080;">if</span> InStr(ListBox1.Cell(i,c), TextField1.Text)  &lt; &gt; 0 <span style="color: #000080;">then</span> // different from 0 
        ListBox1.CellBold(i,c) = <span style="color: #000080;">true</span> // make the text bold
      <span style="color: #000080;">else</span>
        ListBox1.CellBold(i,c) = <span style="color: #000080;">false</span> 
      <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
    <span style="color: #000080;">next</span>
<span style="color: #000080;">next</span></pre></td></tr></table></div>

<h2>Enter key event in TextField Control</h2>
<p>To know if the users is pressing the Enter key in TextField go to code editor TextField Function Key Down () and enter there:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> key = chr(13) <span style="color: #000080;">then</span> 
// code from Search Listbox <span style="color: #000080;">Control</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/search-listbox-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
