<?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>RBDevZone &#187; User Interface</title>
	<atom:link href="http://www.rbdevzone.com/category/user-interface/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rbdevzone.com</link>
	<description>The REALbasic Resource</description>
	<lastBuildDate>Tue, 31 Aug 2010 19:55:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>UltraUpdater 1.0 Now Available</title>
		<link>http://www.rbdevzone.com/2010/03/ultraupdater-1-0-now-available/</link>
		<comments>http://www.rbdevzone.com/2010/03/ultraupdater-1-0-now-available/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 19:50:14 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[Controls]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/?p=405</guid>
		<description><![CDATA[UltraUpdater adds auto-update capability to your REAL Studio applications with only 2 lines of code!
Check it out here:
http://www.rbdevzone.com/ultraupdater/
]]></description>
			<content:encoded><![CDATA[<p>UltraUpdater adds auto-update capability to your REAL Studio applications with only 2 lines of code!</p>
<p>Check it out here:</p>
<p><a href="http://www.rbdevzone.com/ultraupdater/">http://www.rbdevzone.com/ultraupdater/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2010/03/ultraupdater-1-0-now-available/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Resizable Sheets</title>
		<link>http://www.rbdevzone.com/2008/04/resizable-sheets/</link>
		<comments>http://www.rbdevzone.com/2008/04/resizable-sheets/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 00:25:57 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[ResExcellence]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/2008/04/resizable-sheets/</guid>
		<description><![CDATA[I needed this in a project I was working on and it turned out that Seth Willits had written about how to do this in a ResExcellence post from 2006.
Download the code to try it out.  To use it, simply include the ResizableSheet class in your project and set your sheet&#8217;s Super to it. [...]]]></description>
			<content:encoded><![CDATA[<p>I needed this in a project I was working on and it turned out that Seth Willits had written about how to do this in a ResExcellence post from 2006.</p>
<p>Download the code to try it out.  To use it, simply include the ResizableSheet class in your project and set your sheet&#8217;s Super to it.  And of course, be sure to enable the resizable property on the sheet.</p>
<p>It worked pretty well for me in REALbasic 2008 Release 1.</p>
<p><a title="Resizable Sheet Project" href="http://www.rbdevzone.com/wp-content/uploads/2008/04/resizable-sheet.rbp">Download Resizable Sheet Project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2008/04/resizable-sheets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CGS Private Functions</title>
		<link>http://www.rbdevzone.com/2008/01/cgs-private-functions/</link>
		<comments>http://www.rbdevzone.com/2008/01/cgs-private-functions/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 16:00:46 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[ResExcellence]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/2008/01/cgs-private-functions/</guid>
		<description><![CDATA[by Seth Willits
Mac OS X is full of private APIs available only to Apple to use in their own software and the operating system. Clever developers, much more knowledgeable than I, have been able to reverse engineer some of these APIs and do some neat things with them. I was fiddling with the CGSPrivate functions [...]]]></description>
			<content:encoded><![CDATA[<p><em>by Seth Willits</em></p>
<p>Mac OS X is full of private APIs available only to Apple to use in their own software and the operating system. Clever developers, much more knowledgeable than I, have been able to reverse engineer some of these APIs and do some neat things with them. I was fiddling with the CGSPrivate functions that were made popuplar by a program called Desktop Manager which makes virtual desktops, and made a REALbasic module of (almost) all of the functions in that header as well as some others.</p>
<p>One of the neat things in this header are functions to transition the entire screen, like fast user switching does. I haven&#8217;t yet done anything useful with these methods, but I did write a tiny sample application that demonstrates these effects.<br />
<a href="http://www.rbdevzone.com/wp-content/uploads/2008/01/fastuserswitching.png" title="FastUserSwitching"><img src="http://www.rbdevzone.com/wp-content/uploads/2008/01/fastuserswitching.png" alt="FastUserSwitching" /></a><a href="http://www.rbdevzone.com/wp-content/uploads/2008/01/window.jpg" title="CGSPrivate Window"><img src="http://www.rbdevzone.com/wp-content/uploads/2008/01/window.jpg" alt="CGSPrivate Window" /></a></p>
<h2>Full Screen Effects</h2>
<p>The code below is pretty simple, and with a fair amount of work using more of the functions, you could do some wickedly cool stuff, like&#8230; a virtual desktop manager program made in REALbasic. <img src='http://www.rbdevzone.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> cid <span style="color: #000080;">as</span> <span style="color: #000080;">Integer</span> = _CGSDefaultConnection()<span style="color: #000080;">Dim</span> transNo <span style="color: #000080;">As</span> IntegerdimDim transSpec <span style="color: #000080;">As</span> CGSTransitionSpectransSpec.<span style="color: #000080;">Type</span> = CGSTransitionType(PopupMenu1.ListIndex + 1)
&nbsp;
transSpec.<span style="color: #000080;">Option</span> = CGSTransitionOption(PopupMenu2.ListIndex)
&nbsp;
transSpec.WindowID = 0 // Fullscreen
&nbsp;
transSpec.BackColorPtr = 0
&nbsp;
<span style="color: #000080;">Dim</span> err <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
err = CGSNewTransition(cid, transSpec, transNo)
&nbsp;
err = CGSSetWorkspace(cid, 0)
&nbsp;
err = CGSInvokeTransition(cid, transNo, 0.5)
&nbsp;
CGSPrivate.Delay(0.5)
&nbsp;
err = CGSReleaseTransition(cid, transNo)</pre></div></div>

<p>Finished</p>
<p>Download <a href="http://www.rbdevzone.com/wp-content/uploads/2008/01/cgsprivaterbp.zip" title="CGSPrivate Project">CGSPrivate Project</a></p>
<p><em>Originally published by ResExcellence<br />
Reprinted with permission</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2008/01/cgs-private-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alternating Color ListBox (like iTunes)</title>
		<link>http://www.rbdevzone.com/2007/10/alternating-color-listbox-like-itunes/</link>
		<comments>http://www.rbdevzone.com/2007/10/alternating-color-listbox-like-itunes/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 14:32:57 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[Controls]]></category>
		<category><![CDATA[ResExcellence]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/2007/10/alternating-color-listbox-like-itunes/</guid>
		<description><![CDATA[by Bob Keeney
Many years ago, Erick Tejkowski posted a tutorial on alternating row colors to get the same style as an iTunes type listbox. The solution is simple, but yet many people still ask how to do it. We’ll step through the process on how to do this with REALbasic 2007.
Create the Class
Code reusability is [...]]]></description>
			<content:encoded><![CDATA[<p>by Bob Keeney</p>
<p>Many years ago, Erick Tejkowski posted a tutorial on alternating row colors to get the same style as an iTunes type listbox. The solution is simple, but yet many people still ask how to do it. We’ll step through the process on how to do this with REALbasic 2007.</p>
<h2>Create the Class</h2>
<p>Code reusability is a good thing. We’ll subclass the standard REALbasic listbox. Add a new class to your project and name it “ARListBox”. In the properties list set its super to “ListBox” so it can inherit all of the listbox events and properties.</p>
<p><a href="http://www.rbdevzone.com/?attachment_id=26" rel="attachment wp-att-26" title="Add Class to Project"><img src="http://capeumc.fatcow.com/wp-content/uploads/2007/10/addclass.thumbnail.jpg" alt="Add Class to Project" /></a></p>
<p>Edit the ARListbox code and add a property called “bAlternateRows as Boolean” and set it’s scope to Public. Find the CellBackgroundPaint event and add this code:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Function</span> CellBackgroundPaint(g <span style="color: #000080;">As</span> Graphics, row <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>, column <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span>
<span style="color: #000080;">If</span> bAlternateRows <span style="color: #000080;">And</span> row <span style="color: #000080;">Mod</span> 2 = 0 <span style="color: #000080;">Then</span>
   g.ForeColor = RGB(237, 243, 254)
   g.FillRect(0, 0, g.Width, g.Height)
<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<p>The function is pretty straightforward but we’ll go through it line by line. The event is called by by REALbasic when it needs to draw the ListBox (as in a refresh event), you don’t have to do anything to get this to work. RB passes in the graphics object as well as the row and column of the cell in question.</p>
<p>If bAlternateRows is set to TRUE we take the row variable and use the MOD function to determine if the row is even or not. The MOD function is the same as saying, take the row, divide it by 2 and give me the remainder. If the remainder is zero, then do the painting.</p>
<p>When we want to make the row the alternate color we set the foreground of the graphics object to our alternate color. In this case, we’re using a hard coded color and you could easily substitute your own. Then we call the FillRect method of the graphics object and fill the entire graphics object starting at top, left (i.e. 0, 0) and filling the entire width and height of the graphics object.</p>
<h2>An Aside on the Event Handling</h2>
<p>Technically, we should return a True from this function if we’ve handled the DrawCellBackgroundPaint event so RB doesn’t try to do it twice. But since we haven’t created a new DrawCellBackgroundPaint event this isn’t an issue and RB doesn’t really care. If you ever want to override this functionality in the future, you would define a new event named exactly the same as the DrawCellBackgroundPaint (you could name it anything, but it helps using the same function name) with the same parameters and return value. To allow your instantiated class to override the behavior you then add this:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Function</span> CellBackgroundPaint(g <span style="color: #000080;">As</span> Graphics, row <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>, column <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span>
//<span style="color: #000080;">Call</span> our <span style="color: #000080;">event</span> <span style="color: #000080;">and</span> see <span style="color: #000080;">if</span> the user has handled it
<span style="color: #000080;">If</span> CellBackgroundPaint(g, row, column) <span style="color: #000080;">Then</span> Return <span style="color: #000080;">True</span> 
&nbsp;
//<span style="color: #000080;">If</span> we haven’t handled it, this <span style="color: #000080;">is</span> the default behavior
<span style="color: #000080;">If</span> bAlternateRows <span style="color: #000080;">And</span> row <span style="color: #000080;">Mod</span> 2 = 0 <span style="color: #000080;">Then</span>
   g.ForeColor = RGB(237, 243, 254)
   g.FillRect(0, 0, g.Width, g.Height)
<span style="color: #000080;">End</span> <span style="color: #000080;">If</span> 
&nbsp;
Return <span style="color: #000080;">True</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<h2>Edit Property List Behavior</h2>
<p>Now that we’ve defined our class go back to the project tab and right click on the ARListBox class. Select Property List Behavior from the options. Once the dialog opens, scroll down the properties list and check the bAlternateRows checkbox and then click the OK button.</p>
<p>Once we’ve checked this option, our bAlternateRows variable may be set through the IDE instead of having to set it via code. This is simply a shortcut and could easily have been done via code in the open event or done using Computed Properties. One could argue that Computed Properties may be the best way to do this if you decide to change the color or toggle the bAlternateRows value at runtime. In our simple example this isn’t an issue.</p>
<p><a href="http://www.rbdevzone.com/2007/10/alternating-color-listbox-like-itunes/realbasic-group-on-linkedin/" rel="attachment wp-att-27" title="Property List Behavior"><img src="http://capeumc.fatcow.com/wp-content/uploads/2007/10/propertylistbehavior.jpg" alt="Property List Behavior" /></a></p>
<h2>Add the Control To a Window</h2>
<p>Now go to Window1 that was created for you when you created a new project. Choose “Project Controls” from the tools pallet and drag a new instance of ARListbox on to your window. Resize and change properties as necessary. In the Properties List you’ll see the bAlternatveRows property under the ‘behavior’ heading. Make sure it’s checked.</p>
<p>Go into the code editor and find the Open event of ARListbox1 (the default name of our new ARListbox object. In the open event use this code:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Sub</span> <span style="color: #000080;">Open</span>()
<span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
<span style="color: #000080;">For</span> i = 1 <span style="color: #000080;">To</span> 15
   Me.AddRow <span style="color: #800000;">&quot;Row &quot;</span> + Str(i)
   Me.Cell(i - 1, 1) = <span style="color: #800000;">&quot;Cell (&quot;</span> + str(i) + <span style="color: #800000;">&quot;, 1)&quot;</span>
   Me.Cell(i - 1, 2) = <span style="color: #800000;">&quot;Cell (&quot;</span> + str(i) + <span style="color: #800000;">&quot;, 2)&quot;</span>
<span style="color: #000080;">Next</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></pre></div></div>

<p>This code simply gives us some sample data for our listbox to use. You can play around with the number of rows and the text in the cells, but the important point is that each even row in the listbox is colored!</p>
<h2>Conclusion</h2>
<p>With this sample project we’ve created a very simple and elegant variation of the standard listbox. It demonstrates how to subclass a control and some of the basics of events. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2007/10/alternating-color-listbox-like-itunes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MessageDialog Sheet</title>
		<link>http://www.rbdevzone.com/2007/10/messagedialog-sheet/</link>
		<comments>http://www.rbdevzone.com/2007/10/messagedialog-sheet/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 14:32:20 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[ResExcellence]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/2007/10/messagedialog-sheet/</guid>
		<description><![CDATA[by Seth Willits
The MessageDialog class is an important user interface element that if not done correctly, sticks out like a sore thumb on Mac OS X. Users expect a consistent message interface between applications, so it is critical that developers adopt and embrace the MessageDialog class as a part of becoming a good Mac OS [...]]]></description>
			<content:encoded><![CDATA[<p><em>by Seth Willits</em></p>
<p>The MessageDialog class is an important user interface element that if not done correctly, sticks out like a sore thumb on Mac OS X. Users expect a consistent message interface between applications, so it is critical that developers adopt and embrace the MessageDialog class as a part of becoming a good Mac OS X citizen.</p>
<h2>It&#8217;s a Sheet!</h2>
<p>This tutorial isn&#8217;t exactly the most indepth of them all. In the code below, you simply have a chunk which sets up a MessageDialog in the CancelClose event of a Window and displays it using ShowModalWithin.</p>
<p><a rel="attachment wp-att-24" href="http://www.rbdevzone.com/2007/10/messagedialog-sheet/messagedialog-sheet/" title="MessageDialog Sheet"><img src="http://www.rbdevzone.com/wp-content/uploads/2007/10/messagedialogsheet.png" alt="MessageDialog Sheet"></a></p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Function</span> CancelClose(appQuitting <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span>
<span style="color: #000080;">Dim</span> dlog <span style="color: #000080;">As</span> MessageDialog
&nbsp;
// Create Dialog
dlog = <span style="color: #000080;">New</span> MessageDialog
dlog.Message = <span style="color: #800000;">&quot;Do you want to save the changes you made in the document &quot;</span><span style="color: #800000;">&quot;&quot;</span> + self.Title + <span style="color: #800000;">&quot;&quot;</span><span style="color: #800000;">&quot;?&quot;</span>
dlog.Explanation = <span style="color: #800000;">&quot;Your changes will be lost if you don't save them.&quot;</span>
dlog.ActionButton.Caption = <span style="color: #800000;">&quot;&amp;Save...&quot;</span>
dlog.CancelButton.Caption = <span style="color: #800000;">&quot;Cancel&quot;</span>
dlog.AlternateActionButton.Caption = <span style="color: #800000;">&quot;&amp;Don't Save&quot;</span>
dlog.ActionButton.Visible = <span style="color: #000080;">True</span>
dlog.CancelButton.Visible = <span style="color: #000080;">True</span>
dlog.AlternateActionButton.Visible = <span style="color: #000080;">True</span>
&nbsp;
// Show Dialog
<span style="color: #000080;">Select</span> <span style="color: #000080;">Case</span> dlog.ShowModalWithin(self).Caption
<span style="color: #000080;">Case</span> <span style="color: #800000;">&quot;&amp;Save...&quot;</span>
MsgBox <span style="color: #800000;">&quot;Pretend this is a save dialog...&quot;</span>
Return <span style="color: #000080;">False</span>
<span style="color: #000080;">Case</span> <span style="color: #800000;">&quot;&amp;Don't Save&quot;</span>
Return <span style="color: #000080;">False</span>
<span style="color: #000080;">Case</span> <span style="color: #800000;">&quot;Cancel&quot;</span>
Return <span style="color: #000080;">True</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Select</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<h2>Finished</h2>
<p>What&#8217;s really nice about this class is that any cross-platform issues are already taken care of for you. If the ShowModalWithin method is used to create a sheet window in Mac OS X, the same code compiled for Windows and Linux has the dialos appear as a standalone window. In addition, the placement of the Save, Don&#8217;t Save, and Cancel buttons is different in Mac OS X than it is in Windows and Linux, but the MessageDialog class takes care of button placement as well.</p>
<p><a href="http://www.rbdevzone.com/wp-content/uploads/2007/10/messagedialogsheetsproject.zip" title="MessageDialogSheet project">Download MessageDialogSheet REALbasic project</a></p>
<p><em>Originally published by ResExcellence<br />
Reprinted with permission</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2007/10/messagedialog-sheet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quartz Gradients</title>
		<link>http://www.rbdevzone.com/2007/09/quartz-gradients/</link>
		<comments>http://www.rbdevzone.com/2007/09/quartz-gradients/#comments</comments>
		<pubDate>Sat, 15 Sep 2007 14:31:02 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[Controls]]></category>
		<category><![CDATA[ResExcellence]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/2007/09/quartz-gradients/</guid>
		<description><![CDATA[by Seth Willits
Continuing the article about drawing a simple rectangle with a Quartz shadow, in this article we take a look at axial gradients. The code for this is actually a major pain to explain (I admit I don&#8217;t know everything there is to know about it as well), so, sorry, but I&#8217;m going to [...]]]></description>
			<content:encoded><![CDATA[<p><em>by Seth Willits</em></p>
<p>Continuing the article about drawing a simple rectangle with a Quartz shadow, in this article we take a look at axial gradients. The code for this is actually a major pain to explain (I admit I don&#8217;t know everything there is to know about it as well), so, sorry, but I&#8217;m going to pull a &#8220;just look at the code if you want&#8221; here.</p>
<p>What I&#8217;ve done is add on an extension to the Graphics class which takes a bunch of parameters.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Sub</span> DrawAxialGradient(Extends g <span style="color: #000080;">as</span> Graphics,
c <span style="color: #000080;">as</span> Canvas,
vertical <span style="color: #000080;">as</span> <span style="color: #000080;">Boolean</span>,
color1 <span style="color: #000080;">as</span> Color,
color2 <span style="color: #000080;">as</span> Color,
Left <span style="color: #000080;">as</span> <span style="color: #000080;">Integer</span>,
Top <span style="color: #000080;">as</span> <span style="color: #000080;">Integer</span>,
Width <span style="color: #000080;">as</span> <span style="color: #000080;">Integer</span>,
Height <span style="color: #000080;">as</span> <span style="color: #000080;">Integer</span>)</pre></div></div>

<p>The canvas parameter is actually optional, but you won&#8217;t be able to see why in the example project. Right now, because of the way Canvases are implemented it&#8217;s a pain in the butt to deal with because the context you&#8217;re drawing into is actually the window&#8217;s. That is, a Canvas isn&#8217;t a &#8220;real&#8221; control, it&#8217;s just an abstract way to look at a certain rectangle in the window. That&#8217;s a problem because if you&#8217;re trying to draw into a canvas, you need to know about the window the canvas is in so you can translate the coordinates and clip appropriately. If you&#8217;re not drawing in canvas, you pass in nil and it should just do the right thing.</p>
<p>The vertical boolean parameter specifies if the axial shading is vertical or horizontal (there&#8217;s no start point and end point definition in this implementation, it&#8217;s a bit hardcoded). Color1 and Color2 are the two (not, not three or more in this implementation), and the next four parameters are the bounds of the gradient.</p>
<p>It&#8217;s relatively limiting (better than what RB has!), but that&#8217;s mostly because to do everything you can in Quartz, you really have to do it all yourself, or I&#8217;d really have to spend more time to abstract it out and provide a few different methods and ways of doing things. Have look around the code and you should see why it&#8217;d actually be a little tricky.</p>
<p><a href="http://www.rbdevzone.com/wp-content/uploads/2007/10/quartz_gradients.zip" title="Quartz Gradients REALbasic project">Download Quartz Gradients REALbasic project</a></p>
<p><em>Originally published by ResExcellence<br />
Reprinted with permission<br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2007/09/quartz-gradients/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wiggle Window</title>
		<link>http://www.rbdevzone.com/2007/09/wiggle-window/</link>
		<comments>http://www.rbdevzone.com/2007/09/wiggle-window/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 14:30:22 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[ResExcellence]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/2007/09/wiggle-window/</guid>
		<description><![CDATA[by Erick Tejkowski
Should you accidentally enter the wrong password while logging onto an OS X machine, you&#8217;ll notice that the login window wiggles back and forth a few times. In fact, it looks like the login window is shaking its head &#8220;NO!&#8221; at you. This week we&#8217;ll look at how to implement this functionality with [...]]]></description>
			<content:encoded><![CDATA[<p><em>by Erick Tejkowski</em></p>
<p>Should you accidentally enter the wrong password while logging onto an OS X machine, you&#8217;ll notice that the login window wiggles back and forth a few times. In fact, it looks like the login window is shaking its head &#8220;NO!&#8221; at you. This week we&#8217;ll look at how to implement this functionality with REALbasic. It turns out that it&#8217;s very simple to accomplish, so let&#8217;s get started.</p>
<h2>Build the Interface</h2>
<p>Launch REALbasic and open the default Window1. To this window, add a PushButton and a Timer. Set the Mode property of the Timer to 0 (zero). You can arrange the window however you wish.<br />
Add the Code<br />
Open the Code Editor for Window1 and add two properties to the window:</p>
<ul>
<li>OrigX As Integer</li>
<li>Wiggle As Integer</li>
</ul>
<p>Next, enter this code in the Action event of PushButton1:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Wiggle = 0
OrigX = Self.Left
Timer1.Period = 30
Timer1.Mode = 2</pre></div></div>

<p>Finally, add this code to the Action event of Timer1:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">If</span> Wiggle &amp;gt; 5 <span style="color: #000080;">Then</span>
   Me.Mode = 0
   Self.Left = OrigX
<span style="color: #000080;">Else</span>
   <span style="color: #000080;">If</span> (Wiggle <span style="color: #000080;">Mod</span> 2) = 0 <span style="color: #000080;">Then</span>
      Self.Left = OrigX - 20
   <span style="color: #000080;">Else</span>
      Self.Left = OrigX + 20
   <span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
   Wiggle = Wiggle + 1
<span style="color: #000080;">End</span> <span style="color: #000080;">If</span></pre></div></div>

<p>By clicking the PushButton, you reset some variables that keep track of the position of the window as well as the number of wiggles. Then, the timer starts firing. As the timer fires, it increases the wiggle counter and alternates the position of the window between its two positions. Once the counter exceeds 5, the timer stops. Simple, eh?</p>
<h2>Conclusion</h2>
<p>That&#8217;s all there is to it.</p>
<p><a href="http://www.rbdevzone.com/wp-content/uploads/2007/10/wigglewindow.zip" title="Wiggle Window REALbasic project">Download Wiggle Window REALbasic project</a></p>
<p><em>Originally published by ResExcellence<br />
Reprinted with permission</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2007/09/wiggle-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
