<?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>Beginner Tips &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/beginner-tips/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Tue, 09 Dec 2025 16:31:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Introducing Jade, the Xojo AI Assistant</title>
		<link>https://blog.xojo.com/2025/12/09/introducing-jade-the-xojo-ai-assistant/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 09 Dec 2025 16:31:26 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[2025r3]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[AI Code Generation]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Jade]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15548</guid>

					<description><![CDATA[With Xojo 2025 Release 3, we are introducing Jade, an AI assistant for Xojo. This initial version is primarily for asking general Xojo-related questions and&#8230;]]></description>
										<content:encoded><![CDATA[
<p>With Xojo 2025 Release 3, we are introducing Jade, an AI assistant for Xojo. This initial version is primarily for asking general Xojo-related questions and can be used as an alternative to the documentation.</p>



<h2 class="wp-block-heading">Getting Started</h2>



<p>Jade uses Anthropic Claude as its engine, so before using Jade, you first need to sign up for an Anthropic API key to access Claude. You can do this from the <a href="https://console.anthropic.com" target="_blank" rel="noreferrer noopener">Anthropic Claude Console</a>.</p>



<p>From there you can create your account. After you&#8217;ve done that, you will want to get an API key to use with Xojo. Click on the &#8220;API keys&#8221; tab to see existing keys and create new ones. Click the &#8220;Create Key&#8221; button to generate a new key. In the dialog, give it a name to indicate its purpose.</p>



<figure class="wp-block-image size-full is-resized"><img fetchpriority="high" decoding="async" width="920" height="666" src="https://blog.xojo.com/wp-content/uploads/2025/11/Create-in-Workspace-®.png" alt="" class="wp-image-15551" style="width:381px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/Create-in-Workspace-®.png 920w, https://blog.xojo.com/wp-content/uploads/2025/11/Create-in-Workspace-®-300x217.png 300w, https://blog.xojo.com/wp-content/uploads/2025/11/Create-in-Workspace-®-768x556.png 768w" sizes="(max-width: 920px) 100vw, 920px" /></figure>



<p>When you click Add, the actual key will be shown. Copy it to the clipboard.</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="922" height="658" src="https://blog.xojo.com/wp-content/uploads/2025/11/Keep-a-record-of-the-key-below.-You-wont-be-able-to-view-it.png" alt="" class="wp-image-15552" style="width:390px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/Keep-a-record-of-the-key-below.-You-wont-be-able-to-view-it.png 922w, https://blog.xojo.com/wp-content/uploads/2025/11/Keep-a-record-of-the-key-below.-You-wont-be-able-to-view-it-300x214.png 300w, https://blog.xojo.com/wp-content/uploads/2025/11/Keep-a-record-of-the-key-below.-You-wont-be-able-to-view-it-768x548.png 768w" sizes="(max-width: 922px) 100vw, 922px" /></figure>



<p>Note that you cannot see the key again after closing that dialog, but you can always create a new key at any time.</p>



<p>Now go to Xojo Settings and in the General tab, paste it into the &#8220;Anthropic API Key&#8221; field.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="748" src="https://blog.xojo.com/wp-content/uploads/2025/11/4E41D4E3-6D1F-494E-B830-8FB73DC944FB-1024x748.jpeg" alt="" class="wp-image-15559" style="width:670px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/4E41D4E3-6D1F-494E-B830-8FB73DC944FB-1024x748.jpeg 1024w, https://blog.xojo.com/wp-content/uploads/2025/11/4E41D4E3-6D1F-494E-B830-8FB73DC944FB-300x219.jpeg 300w, https://blog.xojo.com/wp-content/uploads/2025/11/4E41D4E3-6D1F-494E-B830-8FB73DC944FB-768x561.jpeg 768w, https://blog.xojo.com/wp-content/uploads/2025/11/4E41D4E3-6D1F-494E-B830-8FB73DC944FB-1536x1122.jpeg 1536w, https://blog.xojo.com/wp-content/uploads/2025/11/4E41D4E3-6D1F-494E-B830-8FB73DC944FB.jpeg 1624w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Go back to the Claude Console and click on the Billing tab to buy credits. Interacting with Jade requires credits. The amount of credits used depends on the complexity of your interactions. Until you get used to Jade and credit usage, you’ll probably want to start with a small amount, like $5, and disable auto-reload.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="302" src="https://blog.xojo.com/wp-content/uploads/2025/11/CleanShot-2025-11-24-at-14.19.55@2x-1024x302.png" alt="" class="wp-image-15560" style="width:625px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/CleanShot-2025-11-24-at-14.19.55@2x-1024x302.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/11/CleanShot-2025-11-24-at-14.19.55@2x-300x88.png 300w, https://blog.xojo.com/wp-content/uploads/2025/11/CleanShot-2025-11-24-at-14.19.55@2x-768x226.png 768w, https://blog.xojo.com/wp-content/uploads/2025/11/CleanShot-2025-11-24-at-14.19.55@2x-1536x453.png 1536w, https://blog.xojo.com/wp-content/uploads/2025/11/CleanShot-2025-11-24-at-14.19.55@2x-2048x604.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Using Jade</h2>


<div class="wp-block-image">
<figure class="alignright size-full"><img loading="lazy" decoding="async" width="48" height="48" src="https://blog.xojo.com/wp-content/uploads/2025/11/Assistant@3x.png" alt="" class="wp-image-15556"/></figure>
</div>


<p>To use Jade, select Help-&gt;Ask Jade or click the Ask Jade button in the toolbar. You’ll get some short introductory text. Note: Using Jade requires an internet connection.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="982" src="https://blog.xojo.com/wp-content/uploads/2025/11/DF74EF37-BA6B-4A56-B933-0339A00359A2-1024x982.jpeg" alt="" class="wp-image-15558" style="width:668px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/DF74EF37-BA6B-4A56-B933-0339A00359A2-1024x982.jpeg 1024w, https://blog.xojo.com/wp-content/uploads/2025/11/DF74EF37-BA6B-4A56-B933-0339A00359A2-300x288.jpeg 300w, https://blog.xojo.com/wp-content/uploads/2025/11/DF74EF37-BA6B-4A56-B933-0339A00359A2-768x736.jpeg 768w, https://blog.xojo.com/wp-content/uploads/2025/11/DF74EF37-BA6B-4A56-B933-0339A00359A2-1536x1473.jpeg 1536w, https://blog.xojo.com/wp-content/uploads/2025/11/DF74EF37-BA6B-4A56-B933-0339A00359A2.jpeg 2044w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>You interact with Jade similarly to a chat app by typing prompts in the conversation area (bottom section) and pressing Send. Jade will think for a moment and then display its response.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="982" src="https://blog.xojo.com/wp-content/uploads/2025/11/DFF0253D-0333-46DD-9780-8A0322F652C0-1024x982.jpeg" alt="" class="wp-image-15562" style="width:680px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/DFF0253D-0333-46DD-9780-8A0322F652C0-1024x982.jpeg 1024w, https://blog.xojo.com/wp-content/uploads/2025/11/DFF0253D-0333-46DD-9780-8A0322F652C0-300x288.jpeg 300w, https://blog.xojo.com/wp-content/uploads/2025/11/DFF0253D-0333-46DD-9780-8A0322F652C0-768x736.jpeg 768w, https://blog.xojo.com/wp-content/uploads/2025/11/DFF0253D-0333-46DD-9780-8A0322F652C0-1536x1473.jpeg 1536w, https://blog.xojo.com/wp-content/uploads/2025/11/DFF0253D-0333-46DD-9780-8A0322F652C0.jpeg 2044w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>If Jade’s response includes Xojo source code you can click one of the buttons above the code block to copy the code to the clipboard or to directly insert it into the active code editor.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1010" height="1024" src="https://blog.xojo.com/wp-content/uploads/2025/11/99B34DEE-DD4E-47E6-A565-FD1437B9D552-1010x1024.jpeg" alt="" class="wp-image-15563" style="width:678px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/99B34DEE-DD4E-47E6-A565-FD1437B9D552-1010x1024.jpeg 1010w, https://blog.xojo.com/wp-content/uploads/2025/11/99B34DEE-DD4E-47E6-A565-FD1437B9D552-296x300.jpeg 296w, https://blog.xojo.com/wp-content/uploads/2025/11/99B34DEE-DD4E-47E6-A565-FD1437B9D552-768x779.jpeg 768w, https://blog.xojo.com/wp-content/uploads/2025/11/99B34DEE-DD4E-47E6-A565-FD1437B9D552-1515x1536.jpeg 1515w, https://blog.xojo.com/wp-content/uploads/2025/11/99B34DEE-DD4E-47E6-A565-FD1437B9D552-2020x2048.jpeg 2020w" sizes="auto, (max-width: 1010px) 100vw, 1010px" /></figure>



<p>When interacting with Jade, keep in mind that although it remembers the context from the current conversation, it has no knowledge of prior conversations. Click the &#8220;Start Over&#8221; button to clear things and start a new conversation. Starting a new conversation is useful when switching to a different topic as it prevents Jade from relying on information you previously discussed that is no longer relevant.</p>



<p>The Export button saves the current Jade conversation to a JSON file which is a great way to save information you want to retain and refer to later.</p>



<h2 class="wp-block-heading">Other Tips</h2>



<ul class="wp-block-list">
<li>Jade currently uses Claude Sonnet 4, but this may change as newer models become available.</li>



<li>The only thing Jade knows about your project is what type it is (Desktop, Web, iOS, etc.). If you want Jade to offer suggestions based on your code, you will need to copy/paste the relevant code into the Jade conversation area.</li>



<li>Your Jade conversation is restored when the IDE restarts. If you get errors, ensure that you have valid internet access, that the API key is valid and you have a positive credit amount.</li>
</ul>



<h2 class="wp-block-heading">Wrap</h2>



<p>We hope you find Jade helpful with your Xojo development. Remember, Jade in Xojo 2025r3 is the first version of an AI assistant for Xojo and will improve over time. In subsequent releases we expect to add more capabilities and project integration. Read more about <a href="https://documentation.xojo.com/getting_started/using_the_ide/ask_jade.html" target="_blank" rel="noreferrer noopener">Jade</a> in Xojo&#8217;s Documentation.</p>



<p><em>Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at <a href="https://goto10.substack.com" target="_blank" rel="noreferrer noopener">Goto 10</a> and </em>on Mastodon @lefebvre@hachyderm.io.</p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Building Blocks for Beginners: Modules, Classes, Interfaces, and Delegates</title>
		<link>https://blog.xojo.com/2025/09/24/building-blocks-for-beginners-modules-classes-interfaces-and-delegates/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Wed, 24 Sep 2025 15:50:00 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Classes]]></category>
		<category><![CDATA[Delegates]]></category>
		<category><![CDATA[Interfaces]]></category>
		<category><![CDATA[Module]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15381</guid>

					<description><![CDATA[If terms like “Modules,” “Classes,” “Interfaces,”, “Delegates” feel new or abstract, keep this article as a map. I’ll explain what each one does, why they&#8230;]]></description>
										<content:encoded><![CDATA[
<p>If terms like “Modules,” “Classes,” “Interfaces,”, “Delegates” feel new or abstract, keep this article as a map. I’ll explain what each one does, why they matter, and how to choose the right one. Think of these features as your toolkit:</p>



<ul class="wp-block-list">
<li><strong>Modules</strong>: organize shared helpers that don’t store data. They just do a job and return a result.</li>



<li><strong>Classes</strong>: represent objects that keep data and have actions.</li>



<li><strong>Interfaces</strong>: agreements about what methods exist so parts can work together without caring how they’re built.</li>



<li><strong>Delegates</strong>: a way to pass a function around so another part of your app can call it later (a callback).</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="modules">Modules</h2>



<p><strong>Purpose</strong></p>



<ul class="wp-block-list">
<li>Provide a&nbsp;<strong>namespace</strong>&nbsp;for related helpers, constants, and enums.</li>



<li>Offer reusable helpers that&nbsp;<strong>don’t remember data</strong>&nbsp;between calls.</li>



<li>Add&nbsp;<strong>extension methods</strong>&nbsp;that make calling code cleaner.</li>
</ul>



<p><strong>Use when</strong></p>



<ul class="wp-block-list">
<li>You need shared helpers (formatting, parsing, conversions).</li>



<li>You want to group constants/enums (error codes, log levels).</li>



<li>You’re adding behavior to existing types via extension methods.</li>
</ul>



<p><strong>Avoid when</strong></p>



<ul class="wp-block-list">
<li>You’re tempted to store&nbsp;changeable global data&nbsp;that creates hidden dependencies.</li>
</ul>



<p><strong>Benefits</strong></p>



<p>Read more: <a href="https://documentation.xojo.com/getting_started/using_the_xojo_language/modules.html" target="_blank" rel="noreferrer noopener">Xojo Modules Documentation</a></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="classes">Classes</h2>



<p><strong>Purpose</strong></p>



<ul class="wp-block-list">
<li>Represent real concepts in your app (e.g., an order, a report, a session).</li>



<li>Keep data and the related rules/actions in one place.</li>



<li>Separate concerns: core logic in classes, screen logic in the UI.</li>
</ul>



<p><strong>Use when</strong></p>



<ul class="wp-block-list">
<li>You have data that changes over time and rules to enforce.</li>



<li>You need&nbsp;<strong>services</strong>&nbsp;that coordinate steps (for example, “Export report” or “Sync data”).</li>



<li>You want testable units that don’t depend on UI elements.</li>
</ul>



<p><strong>Avoid when</strong></p>



<ul class="wp-block-list">
<li>You only need a simple helper that returns a result (that belongs in a Module).</li>



<li>Platform-specific calls would leak into core logic (hide those behind Interfaces).</li>
</ul>



<p><strong>Benefits</strong></p>



<ul class="wp-block-list">
<li>Clear rules kept close to the data they protect.</li>



<li>Clean boundaries between UI, core logic, and data access.</li>
</ul>



<p>Read more: <a href="https://documentation.xojo.com/getting_started/object-oriented_programming/oop_classes.html" target="_blank" rel="noreferrer noopener">Xojo OOP Classes Documentation</a></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="interfaces">Interfaces</h2>



<p><strong>Purpose</strong></p>



<ul class="wp-block-list">
<li>Define the&nbsp;<strong>what</strong>&nbsp;without the&nbsp;<strong>how</strong>.</li>



<li>Let you&nbsp;<strong>swap implementations</strong>&nbsp;(e.g., memory vs. SQLite vs. REST) without changing calling code.</li>



<li>Make testing simple by substituting&nbsp;<strong>fakes/mocks</strong>.</li>
</ul>



<p><strong>Use when</strong></p>



<ul class="wp-block-list">
<li>A feature may vary by platform or environment (file system, keychain, camera, notifications).</li>



<li>You want to keep app logic separate from the details of databases, files, or network calls.</li>



<li>You’ll have multiple strategies that share the same shape.</li>
</ul>



<p><strong>Avoid when</strong></p>



<ul class="wp-block-list">
<li>There’s only one implementation and you don’t need to test in isolation.</li>
</ul>



<p><strong>Benefits</strong></p>



<ul class="wp-block-list">
<li>Loose coupling&nbsp;and easier future changes.</li>



<li>Cleaner, more stable internal APIs.</li>
</ul>



<p>Read more: <a href="https://documentation.xojo.com/getting_started/object-oriented_programming/interfaces.html" target="_blank" rel="noreferrer noopener">Xojo Interfaces Documentation</a></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="delegates">Delegates</h2>



<p><strong>Purpose</strong></p>



<ul class="wp-block-list">
<li>Provide&nbsp;<strong>type-safe callbacks</strong>&nbsp;by letting you hand a function to another part of your app.</li>



<li>Enable flexible behavior without defining a whole interface and class.</li>



<li>Power progress updates, cancel handlers, filters, or small strategies.</li>
</ul>



<p><strong>Use when</strong></p>



<ul class="wp-block-list">
<li>You need a&nbsp;<strong>one-off callback</strong>&nbsp;(progress, completion, error reporting).</li>



<li>You want to inject small pieces of behavior (sorting, filtering, formatting).</li>



<li>You’re wiring up dynamic behavior at runtime.</li>
</ul>



<p><strong>Avoid when</strong></p>



<ul class="wp-block-list">
<li>You need a broader contract with multiple related methods (use an Interface instead).</li>



<li>You need lifecycle or semantic grouping (a Class with&nbsp;events&nbsp;may be clearer).</li>
</ul>



<p><strong>Benefits</strong></p>



<ul class="wp-block-list">
<li>Lightweight and expressive.</li>



<li>Less boilerplate than creating full classes for simple callbacks.</li>



<li>Encourages small, composable, testable pieces.</li>
</ul>



<p>Read more: <a href="https://documentation.xojo.com/getting_started/using_the_xojo_language/advanced_language_features.html#delegates" target="_blank" rel="noreferrer noopener">Xojo Delegates Documentation</a></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="quick-decision-guide">Quick Decision Guide</h2>



<ul class="wp-block-list">
<li><strong>I need to group common helpers and constants.</strong>&nbsp;→ Module</li>



<li><strong>I’m modeling an object with data and rules.</strong>&nbsp;→ Class</li>



<li><strong>I want to depend on behavior, not a specific implementation.</strong>&nbsp;→ Interface</li>



<li><strong>I need a small callback or injected behavior.</strong>&nbsp;→ Delegate</li>



<li><strong>I need many subscribers to a lifecycle change.</strong>&nbsp;→ Event on a class</li>
</ul>



<h3 class="wp-block-heading" id="quick-glossary">Quick glossary</h3>



<ul class="wp-block-list">
<li><strong>Interface</strong>: a contract, a named list of methods something promises to have.</li>



<li><strong>Delegate</strong>: a variable that holds a function to call later (a callback).</li>



<li><strong>Event</strong>: a signal that something happened; other parts can listen for it.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>Use&nbsp;Modules&nbsp;to organize shared helpers,&nbsp;Classes&nbsp;to model your world,&nbsp;Interfaces&nbsp;to decouple and swap implementations, and&nbsp;Delegates&nbsp;to pass behavior flexibly. Combined thoughtfully, these features keep Xojo projects easy to change, easy to test, and ready to ship across platforms.</p>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How To Create a Custom Button Control in Xojo – Part 4: Adding Focus</title>
		<link>https://blog.xojo.com/2025/06/23/how-to-create-a-custom-button-control-in-xojo-part-4-adding-focus/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Mon, 23 Jun 2025 22:35:31 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Custom Button Design]]></category>
		<category><![CDATA[Custom Classes]]></category>
		<category><![CDATA[Custom Control Design]]></category>
		<category><![CDATA[DesktopCanvas]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15007</guid>

					<description><![CDATA[In part 3 of this series&#160;we made our&#160;CanvasButton&#160;inspector-friendly by exposing all our colors, corner radius and other properties. Today we’re going to wire up real&#8230;]]></description>
										<content:encoded><![CDATA[
<p>In <a href="https://blog.xojo.com/2025/05/28/how-to-create-a-custom-button-control-in-xojo-part-3-make-your-controls-inspector-friendly/" target="_blank" rel="noreferrer noopener">part 3 of this series</a>&nbsp;we made our&nbsp;<code>CanvasButton</code>&nbsp;inspector-friendly by exposing all our colors, corner radius and other properties. Today we’re going to wire up real keyboard focus so that you can:</p>



<ul class="wp-block-list">
<li>Tab to the button</li>



<li>See a neat focus ring when it has focus</li>



<li>Grab focus on click</li>
</ul>



<figure class="wp-block-video"><video height="254" style="aspect-ratio: 332 / 254;" width="332" autoplay loop muted preload="auto" src="https://blog.xojo.com/wp-content/uploads/2025/06/CanvasButton-Focus-Demo.mp4" playsinline></video></figure>



<h3 class="wp-block-heading" id="track-the-focus-state">1. Track the Focus State</h3>



<p>Add a private property to keep track of whether the button has focus:</p>



<pre class="wp-block-code"><code>  Private IsFocused As Boolean = False</code></pre>



<h3 class="wp-block-heading" id="respond-to-focus-events">2. Respond to Focus Events</h3>



<p>Implement&nbsp;<code>FocusReceived</code>&nbsp;and&nbsp;<code>FocusLost</code>&nbsp;so we can set/clear the flag and force a redraw:</p>



<pre class="wp-block-code"><code>  Sub FocusReceived()
    If Enabled And AllowFocusRing Then
      IsFocused = True
      Refresh(False)
    End If
  End Sub

  Sub FocusLost()
    If Enabled And AllowFocusRing Then
      IsFocused = False
      Refresh(False)
    End If
  End Sub</code></pre>



<h3 class="wp-block-heading" id="grab-focus-on-mouse-click">3. Grab Focus on Mouse Click</h3>



<p>Modify your&nbsp;<code>MouseDown</code>&nbsp;to call&nbsp;<code>SetFocus</code>. Now clicking the button also gives it focus immediately:</p>



<pre class="wp-block-code"><code>  Function MouseDown(x As Integer, y As Integer) As Boolean
    #Pragma unused x
    #Pragma unused y

    If Enabled Then
      IsPressed = True
      SetFocus       // ← new
      Refresh(False)
      Return True
    Else
      Return False
    End If
  End Function</code></pre>



<h3 class="wp-block-heading" id="draw-an-inset-focus-ring">4. Draw an Inset Focus Ring</h3>



<p>In the&nbsp;<code>Paint</code>&nbsp;event, after drawing the border, add:</p>



<pre class="wp-block-code"><code>// … after the border code …
If IsFocused And AllowFocusRing Then
  g.DrawingColor = Color.HighlightColor
  g.PenSize = 1
  // Inset by 2px so it sits inside the border
  g.DrawRoundRectangle(2, 2, g.Width-4, g.Height-4, CornerRadius-2, CornerRadius-2)
End If</code></pre>



<h3 class="wp-block-heading" id="enable-canvas-focus">5. Enable Canvas Focus</h3>



<p>By default,&nbsp;<code>DesktopCanvas</code>&nbsp;won’t accept focus, so make sure to check&nbsp;AllowFocusRing&nbsp;in the Inspector when you drop&nbsp;<code>CanvasButton</code>&nbsp;onto a window.</p>



<h2 class="wp-block-heading" id="try-it-out">Try It Out</h2>



<ol class="wp-block-list">
<li>Run the app:
<ul class="wp-block-list">
<li>Tab to the button → you’ll see the focus ring</li>
</ul>
</li>
</ol>



<h2 class="wp-block-heading" id="what’s-next">What’s Next?</h2>



<p>Stay tuned for more awesome updates!</p>



<p>You can grab the latest source on GitHub: <a href="https://github.com/xolabsro/CanvasButton" target="_blank" rel="noreferrer noopener">GitHub &#8211; CanvasButton</a></p>



<p>More in this series:</p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/05/02/how-to-create-a-custom-button-control-in-xojo/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo</a></li>



<li><a href="https://blog.xojo.com/2025/05/14/how-to-create-a-custom-button-control-in-xojo-part-2/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 2</a></li>



<li><a href="https://blog.xojo.com/2025/05/28/how-to-create-a-custom-button-control-in-xojo-part-3-make-your-controls-inspector-friendly/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 3: Make Your Controls Inspector-Friendly</a></li>



<li><a href="https://blog.xojo.com/2025/06/23/how-to-create-a-custom-button-control-in-xojo-part-4-adding-focus/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 4: Adding Focus</a></li>



<li><a href="https://blog.xojo.com/2025/10/08/how-to-create-a-custom-button-control-in-xojo-part-5-adding-text-alignment/" target="_blank" rel="noreferrer noopener">How to Create a Custom Button Control in Xojo &#8211; Part 5: Adding Text Alignment</a></li>
</ul>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		<enclosure url="https://blog.xojo.com/wp-content/uploads/2025/06/CanvasButton-Focus-Demo.mp4" length="227730" type="video/mp4" />

			</item>
		<item>
		<title>How To Create a Custom Button Control in Xojo – Part 3: Make Your Controls Inspector-Friendly</title>
		<link>https://blog.xojo.com/2025/05/28/how-to-create-a-custom-button-control-in-xojo-part-3-make-your-controls-inspector-friendly/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Wed, 28 May 2025 17:54:20 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Custom Button Design]]></category>
		<category><![CDATA[Custom Classes]]></category>
		<category><![CDATA[Custom Control Design]]></category>
		<category><![CDATA[DesktopCanvas]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14925</guid>

					<description><![CDATA[In&#160;Part 1, we built a custom button control in Xojo by subclassing&#160;DesktopCanvas. In&#160;Part 2, we enhanced it with customizable colors, corner radius, and a disabled&#8230;]]></description>
										<content:encoded><![CDATA[
<p>In&nbsp;<a href="https://blog.xojo.com/2025/05/02/how-to-create-a-custom-button-control-in-xojo/">Part 1</a>, we built a custom button control in Xojo by subclassing&nbsp;<code>DesktopCanvas</code>. In&nbsp;<a href="https://blog.xojo.com/2025/05/14/how-to-create-a-custom-button-control-in-xojo-part-2/">Part 2</a>, we enhanced it with customizable colors, corner radius, and a disabled state.</p>



<p>Now, let’s make the&nbsp;<code>CanvasButton</code>&nbsp;control even easier to use in the Xojo IDE by leveraging the&nbsp;<strong><a href="https://documentation.xojo.com/topics/custom_controls/changing_properties_with_the_inspector.html" target="_blank" rel="noreferrer noopener">Inspector Behavior</a></strong>&nbsp;feature. This allows you (and anyone using your control) to configure its appearance and behavior at design time, right in the Properties panel.</p>



<h2 class="wp-block-heading" id="why-inspector-behavior-matters">Why Inspector Behavior Matters</h2>



<p>When you create a custom control, its custom properties will not appear in the Inspector by default.&nbsp;<strong>Inspector Behavior</strong>&nbsp;lets you choose which properties are shown and how they’re grouped. This makes your control feel polished and professional, and saves users from digging into code to tweak settings.</p>



<h2 class="wp-block-heading" id="step-1-open-inspector-behavior">Step 1: Open Inspector Behavior</h2>



<p>To customize Inspector options for your&nbsp;<code>CanvasButton</code>:</p>



<ol class="wp-block-list">
<li>In the Xojo IDE, select the&nbsp;<code>CanvasButton</code>&nbsp;class in the Project Navigator.</li>



<li>Right-click it and choose&nbsp;<strong>Inspector Behavior…</strong></li>
</ol>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="342" height="512" src="https://blog.xojo.com/wp-content/uploads/2025/05/inspector_behavior_01.jpg" alt="Inspector Behavior menu" class="wp-image-14929" srcset="https://blog.xojo.com/wp-content/uploads/2025/05/inspector_behavior_01.jpg 342w, https://blog.xojo.com/wp-content/uploads/2025/05/inspector_behavior_01-200x300.jpg 200w" sizes="auto, (max-width: 342px) 100vw, 342px" /></figure>



<h2 class="wp-block-heading" id="step-2-expose-and-organize-properties">Step 2: Expose and Organize Properties</h2>



<p>In the Inspector Behavior dialog, you’ll see a list of all public properties (inherited and custom).</p>



<ul class="wp-block-list">
<li><strong>Make the following properties visible:</strong>
<ul class="wp-block-list">
<li><code>ButtonText</code></li>



<li><code>CornerRadius</code></li>



<li><code>BackgroundColor</code>,&nbsp;<code>HoverColor</code>,&nbsp;<code>HighlightColor</code>,&nbsp;<code>BorderColor</code>,&nbsp;<code>TextColor</code>&nbsp;(all grouped under a custom “Button Colors” section)</li>
</ul>
</li>



<li><strong>Organize properties into logical groups</strong>&nbsp;for clarity.</li>
</ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="640" height="687" src="https://blog.xojo.com/wp-content/uploads/2025/05/inspector_behavior_02.jpg" alt="Inspector Behavior window" class="wp-image-14930" srcset="https://blog.xojo.com/wp-content/uploads/2025/05/inspector_behavior_02.jpg 640w, https://blog.xojo.com/wp-content/uploads/2025/05/inspector_behavior_02-279x300.jpg 279w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>Tip:</strong>&nbsp;Defining default values for your properties in the class code means they will be automatically populated in Inspector Behavior. However, Xojo gives you even more flexibility. You can override these default values directly in the Inspector Behavior dialog, so you have full control over what new instances of your control will look like by default.</p>
</blockquote>



<h2 class="wp-block-heading" id="step-3-enjoy-design-time-customization">Step 3: Enjoy Design-Time Customization</h2>



<p>With Inspector Behavior set up, you (or other developers) can now:</p>



<ul class="wp-block-list">
<li><strong>Change the button text</strong>&nbsp;right in the Properties panel.</li>



<li><strong>Pick custom colors</strong>&nbsp;for normal, hover, pressed, border, and text states using the color picker.</li>



<li><strong>Adjust the corner radius</strong>&nbsp;visually.</li>
</ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="297" height="466" src="https://blog.xojo.com/wp-content/uploads/2025/05/inspector_03.jpg" alt="Xojo Inspector showing custom CanvasButton properties" class="wp-image-14931" srcset="https://blog.xojo.com/wp-content/uploads/2025/05/inspector_03.jpg 297w, https://blog.xojo.com/wp-content/uploads/2025/05/inspector_03-191x300.jpg 191w" sizes="auto, (max-width: 297px) 100vw, 297px" /></figure>



<h2 class="wp-block-heading" id="step-4-best-practices-and-tips">Step 4: Best Practices and Tips</h2>



<ul class="wp-block-list">
<li><strong>Use clear group names</strong>&nbsp;(like “Button Colors”) to help users find related properties.</li>



<li><strong>Set sensible defaults</strong>&nbsp;for all properties in your code, but remember you can override them in Inspector Behavior.</li>
</ul>



<h2 class="wp-block-heading" id="conclusion">Conclusion</h2>



<p>With Inspector Behavior, your custom controls feel like first-class citizens in Xojo. You and others can now design beautiful, custom buttons by simply dragging, dropping, and tweaking settings in the Inspector. No code required!</p>



<p><strong>Stay tuned for future parts</strong>&nbsp;where we’ll explore even more advanced features.</p>



<p id="block-59a92dbb-c0d1-4b75-b250-f331b6ceb4c4">More in this series:</p>



<ul id="block-c7594468-ed0c-4be1-a999-04ef9789f34c" class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/05/02/how-to-create-a-custom-button-control-in-xojo/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo</a></li>



<li><a href="https://blog.xojo.com/2025/05/14/how-to-create-a-custom-button-control-in-xojo-part-2/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 2</a></li>



<li><a href="https://blog.xojo.com/2025/05/28/how-to-create-a-custom-button-control-in-xojo-part-3-make-your-controls-inspector-friendly/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 3: Make Your Controls Inspector-Friendly</a></li>



<li><a href="https://blog.xojo.com/2025/06/23/how-to-create-a-custom-button-control-in-xojo-part-4-adding-focus/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 4: Adding Focus</a></li>



<li><a href="https://blog.xojo.com/2025/10/08/how-to-create-a-custom-button-control-in-xojo-part-5-adding-text-alignment/" target="_blank" rel="noreferrer noopener">How to Create a Custom Button Control in Xojo &#8211; Part 5: Adding Text Alignment</a></li>
</ul>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Build Your First iOS App with Xojo: 10 Practical Steps</title>
		<link>https://blog.xojo.com/2025/05/16/build-your-first-ios-app-with-xojo-10-practical-steps/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Fri, 16 May 2025 15:45:00 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[App Marketing]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[App Store Connect]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Developer Marketing]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Mobile]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14876</guid>

					<description><![CDATA[Xojo is an extremely useful, fast and fun development environment for building your first (or next) iOS app. In this article, I offer a series&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Xojo is an extremely useful, fast and fun development environment for building your first (or next) iOS app. In this article, I offer a series of practical steps to guide you from idea to app.</p>



<span id="more-14876"></span>



<h2 class="wp-block-heading">1. Define Your Idea</h2>



<p>Start by summarizing your app’s purpose in a single, clear sentence. The more concise it is, the better defined your objective will be. This clarity will help guide your screen designs, navigation structure and code architecture.</p>



<p>This sentence can also double as your app’s short description in App Store Connect.</p>



<p>Focus on the essential features that form your app’s <a href="https://en.wikipedia.org/wiki/Minimum_viable_product">Minimum Viable Product</a> (MVP). It’s easy to get sidetracked by new ideas during development. Resist the urge! Instead, keep a list of potential features for future updates and base priorities on user feedback.</p>



<h2 class="wp-block-heading">2. Choose The Platform(s)</h2>



<p>Xojo supports both iPhone and iPad, but your app doesn’t have to. Choose the device type that best fits your app’s use case.</p>



<ul class="wp-block-list">
<li>iPhone apps often support quick, task-based interactions.</li>



<li>iPad apps are better suited to immersive, content-rich experiences.</li>
</ul>



<p>To target a specific device only, set the unused layout (iPhone or iPad) to “None” in the App item’s Inspector Panel.</p>



<p>You’ll also need to decide the minimum iOS version to support. Xojo currently defaults to iOS 14.0, but as of writing, over 60% of users are on iOS 18 or later.</p>



<h2 class="wp-block-heading">3. Prototyping</h2>



<p>Xojo’s visual layout editor makes it easy to dive in designing your app. But take time to prototype your app first, especially if it has more than basic functionality.</p>



<p>Use tools like Figma or MockUp, or simply sketch your ideas with pencil and paper. Choose whatever helps you plan best and clearly.</p>



<p>Also, review Apple’s <a href="https://developer.apple.com/design/human-interface-guidelines/">Human Interface Guidelines</a> to align your app with native iOS expectations.</p>



<p>When designing in Xojo, you can fine-tune layout behavior using the <a href="https://documentation.xojo.com/api/ios/ioslayoutconstraint.html#ioslayoutconstraint">iOSLayoutConstraint</a> class to adapt to orientation and screen size changes at runtime.</p>



<h2 class="wp-block-heading">4. Database Design</h2>



<p>Most apps use a database. For local storage on iOS, use <a href="https://documentation.xojo.com/api/databases/sqlitedatabase.html#methods">SQLiteDatabase</a>, and save your database file in <a href="https://documentation.xojo.com/api/files/specialfolder.html#specialfolder">SpecialFolder.Documents</a>.</p>



<p>Two key best practices:</p>



<ul class="wp-block-list">
<li>Add a Metadata table to track the database schema version. </li>



<li>Create a custom <a href="https://blog.xojo.com/2025/02/05/customize-and-extend-core-databases-functionality/">SQLiteDatabase subclass</a> to manage all read/write operations in one place.</li>
</ul>



<p>This setup allows you to always know which version is installed on the user&#8217;s device and to react accordingly as your app evolves.</p>



<h2 class="wp-block-heading">5. Graphic Resources</h2>



<p>For icons, buttons and tab bar images, use <a href="https://documentation.xojo.com/api/graphics/picture.html#picture-systemimage">Picture.SystemImage</a> with symbols from Apple’s <a href="https://developer.apple.com/sf-symbols/">SF Symbols</a> app. These scale beautifully across devices and adapt to light/dark mode. Just ensure compatibility with your minimum iOS version.</p>



<p>When using custom images, add them at multiple resolutions for optimal display across all screen sizes.</p>



<p>Typography also matters. Use system <a href="http://www.iosfont.com">fonts</a> thoughtfully, ideally no more than two font families. Vary sizes and weights to establish content hierarchy. Keep text readable with a minimum font size of 11pt.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Tip: When testing in the Simulator, set the window to physical size (Simulator &gt; Window &gt; Physical Size) to preview real-world readability.</p>
</blockquote>



<h2 class="wp-block-heading">6. Localization and Accessibility</h2>



<p>Nothing prevents you from publishing an app in a single language, whether it&#8217;s your native language or English; but supporting multiple languages can increase downloads by over 100x.</p>



<p>Start localizing early to avoid design issues later. Add a module to your Xojo project with localized String constants for all app text, and enable the “Localized” option for each one.</p>



<p>Suggested languages (in order of impact):</p>



<p>Core: English</p>



<p>High-impact additions: Chinese, Spanish, German, French, Japanese, Italian, Portuguese, Russian, Korean</p>



<p>Also, localize accessibility labels and App Store listings, including screenshots and descriptions, for each supported language.</p>



<h2 class="wp-block-heading">7. Testing the App</h2>



<p>Xojo provides multiple ways to test your app, both from a design and user experience perspective, as well as from a functionality perspective:</p>



<ul class="wp-block-list">
<li><strong>Simulators</strong>: Ideal for design, layout and localization testing. You can also use them to take App Store screenshots.</li>



<li><strong>On-device Debugging</strong>: Offers realistic input experience and access to hardware-only features.</li>



<li><strong>Build to Device</strong>: Lets you run the app outside the debugger, simulating real-world use.</li>
</ul>



<p>Once you’ve finished fixing bugs in your code and app design, move on to testing in the real world by compiling your app and using Xcode to copy that bundle to a physical device. Testing like this, you&#8217;ll likely find some optimizations, especially around design and usability.</p>



<p>TestFlight is your gateway to external beta testers. After uploading a build to App Store Connect, create a public link to invite testers. Remember to increment the version number with each new build.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Tip: Add <code>ITSAppUsesNonExemptEncryption = False</code> in your Property List to streamline build approvals.</p>
</blockquote>



<h2 class="wp-block-heading">8. Publish it!</h2>



<p>Publishing with Xojo is straightforward. The most time-consuming step is preparing your App Store Connect listing including text, artwork, screenshots, keywords and possibly localized pages. Read more about this in my earlier post <em><a href="https://blog.xojo.com/2025/03/25/how-to-publish-macos-and-ios-apps-to-the-app-store-directly-from-xojo/">How to Publish macOS and iOS Apps to the App Store Directly from Xojo</a></em>.</p>



<p>Make sure you select the correct build when submitting your app for review.</p>



<h2 class="wp-block-heading">9. Marketing</h2>



<p>Something you should be doing simultaneously is preparing the related materials to introduce your app to the world. Start your marketing efforts early. A simple website can significantly boost discoverability. Use it to:</p>



<ul class="wp-block-list">
<li>Provide tutorials and FAQs</li>



<li>Link to App Store and social media</li>



<li>Highlight features and updates</li>
</ul>



<p>Consider creating a YouTube channel for app demos and support videos, and maintain active social media profiles to stay visible.</p>



<p>Don&#8217;t forget to take advantage of the <a href="https://toolbox.marketingtools.apple.com">Marketing tools provided by Apple</a> to help you create badges, assets, links and even QR codes to promote your app.</p>



<h2 class="wp-block-heading">10. The Next Steps …</h2>



<p>After launch, gather user feedback and track any bugs that slipped through. At this stage, it’s common to manage:</p>



<ul class="wp-block-list">
<li>A public release (on the App Store)</li>



<li>A development version (next major update)</li>
</ul>



<p>Save your Xojo iOS project in text format and use a version control system. This helps you manage multiple branches and collaborate efficiently.</p>



<h2 class="wp-block-heading">To Summarize</h2>



<p>Even the simplest iOS apps require a fair amount of time and effort, but thanks to Xojo, both aspects are significantly reduced.</p>



<p>What iOS apps have you created with Xojo? What&#8217;s your methodology or any tips you&#8217;d like to share? Feel free to comment on the <a href="http://forum.xojo.com">Xojo forum</a>!</p>



<p><em>Javier Menendez is an engineer at Xojo and has been using Xojo since 1998. He lives in Castellón</em>, <em>Spain and hosts regular Xojo hangouts en español. Ask Javier questions on Twitter at <a href="https://twitter.com/xojoes" target="_blank" rel="noreferrer noopener">@XojoES</a> or on the <a href="https://forum.xojo.com/u/javier_menendez/summary" target="_blank" rel="noreferrer noopener">Xojo Forum</a>.</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How To Create a Custom Button Control in Xojo &#8211; Part 2</title>
		<link>https://blog.xojo.com/2025/05/14/how-to-create-a-custom-button-control-in-xojo-part-2/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Wed, 14 May 2025 15:00:00 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Custom Button Design]]></category>
		<category><![CDATA[Custom Classes]]></category>
		<category><![CDATA[Custom Control Design]]></category>
		<category><![CDATA[DesktopCanvas]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14898</guid>

					<description><![CDATA[In the first part of this tutorial, we built a basic custom button control using the&#160;DesktopCanvas&#160;class, giving it a custom appearance and handling the basic&#8230;]]></description>
										<content:encoded><![CDATA[
<p>In the <a href="https://blog.xojo.com/2025/05/02/how-to-create-a-custom-button-control-in-xojo/" data-type="post" data-id="14858" target="_blank" rel="noreferrer noopener">first part of this tutorial</a>, we built a basic custom button control using the&nbsp;<code>DesktopCanvas</code>&nbsp;class, giving it a custom appearance and handling the basic mouse events to provide visual feedback and raise a&nbsp;<code>Pressed</code>&nbsp;event when clicked.</p>



<p>In this second part, we will enhance our&nbsp;<code>CanvasButton</code>&nbsp;by adding more customization with new properties to:</p>



<ul class="wp-block-list">
<li>set the button&#8217;s colors for different states (default, hovered, pressed)</li>



<li>adjust the corner radius of the button</li>



<li>implement a disabled state</li>
</ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="278" height="146" src="https://blog.xojo.com/wp-content/uploads/2025/05/CanvasButton.gif" alt="" class="wp-image-14914"/></figure>



<p>Let&#8217;s get started!</p>



<h3 class="wp-block-heading" id="adding-new-properties-for-customization">Adding New Properties for Customization</h3>



<p>We need to add several properties to our&nbsp;<code>CanvasButton</code>&nbsp;class to store the custom colors for different states, the border color, the text color, the corner radius, and the enabled state.</p>



<ol class="wp-block-list">
<li>In the Project Navigator, select your&nbsp;<code>CanvasButton</code>&nbsp;class.</li>



<li>Go to&nbsp;<strong>Insert &gt; Property</strong>&nbsp;(or right-click the class and select Add to &#8220;CanvasButton&#8221; &gt; Property).</li>



<li>Add the following properties with the specified names, types, and default values:
<ul class="wp-block-list">
<li><strong>Name:</strong>&nbsp;<code>BackgroundColor</code>&nbsp;<strong>Type:</strong>&nbsp;<code>Color</code>&nbsp;<strong>Default Value:</strong>&nbsp;<code>&amp;c5e2d8b</code></li>



<li><strong>Name:</strong>&nbsp;<code>HoverColor</code>&nbsp;<strong>Type:</strong>&nbsp;<code>Color</code>&nbsp;<strong>Default Value:</strong>&nbsp;<code>&amp;c729fcf</code></li>



<li><strong>Name:</strong>&nbsp;<code>HighlightColor</code>&nbsp;<strong>Type:</strong>&nbsp;<code>Color</code>&nbsp;<strong>Default Value:</strong>&nbsp;<code>&amp;c628eff</code></li>



<li><strong>Name:</strong>&nbsp;<code>BorderColor</code>&nbsp;<strong>Type:</strong>&nbsp;<code>Color</code>&nbsp;<strong>Default Value:</strong>&nbsp;<code>&amp;c525252</code></li>



<li><strong>Name:</strong>&nbsp;<code>TextColor</code>&nbsp;<strong>Type:</strong>&nbsp;<code>Color</code>&nbsp;<strong>Default Value:</strong>&nbsp;<code>&amp;ceeeeee</code></li>



<li><strong>Name:</strong>&nbsp;<code>CornerRadius</code>&nbsp;<strong>Type:</strong>&nbsp;<code>Integer</code>&nbsp;<strong>Default Value:</strong>&nbsp;<code>4</code></li>
</ul>
</li>
</ol>



<p>These properties will hold the values that determine the button’s appearance and behavior.</p>



<h3 class="wp-block-heading" id="updating-event-handlers-for-the-enabled-state">Updating Event Handlers for the Enabled State</h3>



<p>We need to modify the existing mouse event handlers (<code>MouseDown</code>,&nbsp;<code>MouseEnter</code>,&nbsp;<code>MouseExit</code>,&nbsp;<code>MouseUp</code>) to check if the button is&nbsp;<code>Enabled</code>&nbsp;before processing any mouse actions.</p>



<p>Select each of the following event handlers in the&nbsp;<code>CanvasButton</code>&nbsp;class and update the code as shown:</p>



<p><strong><code>MouseDown(x As Integer, y As Integer) As Boolean</code></strong></p>



<pre class="wp-block-code"><code>#Pragma unused x
#Pragma unused y

// Only process if the button is enabled.
If Enabled Then
  // Set internal state to indicate the button is being pressed.
  IsPressed = True
  // Refresh the control to show the pressed state visually.
  Refresh(False)
  // Return True to indicate that this event was handled.
  Return True
Else
  // If disabled, do not handle the event.
  Return False
End If</code></pre>



<p><strong><code>MouseEnter()</code></strong></p>



<pre class="wp-block-code"><code>// Only process if the button is enabled.
If Enabled Then
  // Set internal state to indicate the mouse is hovering over the button.
  IsHovered = True
  // Refresh the control to show the hover state visually.
  Refresh(False)
End If</code></pre>



<p><strong><code>MouseExit()</code></strong></p>



<pre class="wp-block-code"><code>// Only process if the button is enabled.
If Enabled Then
  // Set internal state to indicate the mouse is no longer hovering.
  IsHovered = False
  // Reset pressed state if mouse leaves while pressed (prevents accidental clicks).
  IsPressed = False
  // Refresh the control to revert from the hover state.
  Refresh(False)
End If</code></pre>



<p><strong><code>MouseUp(x As Integer, y As Integer) As Boolean</code></strong></p>



<pre class="wp-block-code"><code>#Pragma unused x
#Pragma unused y

// Only process if the button is enabled.
If Enabled Then
  // Check if the button was pressed down AND the mouse is still hovering over it.
  If IsPressed And IsHovered Then
    // If true, the button was successfully clicked. Raise the custom Pressed event.
    RaiseEvent Pressed
  End If
  // Reset the pressed state regardless of whether the click was successful.
  IsPressed = False
  // Refresh the control to revert from the pressed state.
  Refresh(False)
End If</code></pre>



<p>In these updated event handlers, we added an&nbsp;<code>If Enabled Then</code>&nbsp;check at the beginning. If the button is not enabled, the code inside the&nbsp;<code>If</code>&nbsp;block is skipped, preventing the button from reacting to mouse interactions. We also added&nbsp;<code>#Pragma unused</code>&nbsp;to the parameters&nbsp;<code>x</code>&nbsp;and&nbsp;<code>y</code>&nbsp;in&nbsp;<code>MouseDown</code>&nbsp;and&nbsp;<code>MouseUp</code>&nbsp;as they are not used in the code, which helps avoid compiler warnings. In&nbsp;<code>MouseExit</code>, we added&nbsp;<code>IsPressed = False</code>&nbsp;to ensure the pressed state is reset if the mouse leaves the button while the mouse button is held down.</p>



<h3 class="wp-block-heading" id="updating-the-paint-event-for-enhanced-appearance">Updating the Paint Event for Enhanced Appearance</h3>



<p>The most significant changes will be in the&nbsp;<code>Paint</code>&nbsp;event where we will use the new properties to draw the button based on its current state (enabled/disabled, hovered, and pressed).</p>



<p>Select the&nbsp;<code>Paint(g As Graphics, areas() As Rect)</code>&nbsp;event handler and replace its content with the following code:</p>



<pre class="wp-block-code"><code>#Pragma unused areas

// Use the custom CornerRadius property.
Var currentCornerRadius As Integer = CornerRadius

// Declare variables for the colors used in drawing.
Var currentBgColor As Color
Var currentBorderColor As Color
Var currentTextColor As Color

// Determine colors based on the button's current state (enabled, pressed, hovered).
If Enabled Then
  If IsPressed Then
    // Use highlight color if pressed.
    currentBgColor = HighlightColor
    currentBorderColor = BorderColor
    currentTextColor = TextColor
  ElseIf IsHovered Then // Check for hover only if not pressed
    // Use hover color if hovered.
    currentBgColor = HoverColor
    currentBorderColor = BorderColor
    currentTextColor = TextColor
  Else
    // Use the custom background color for the default state.
    currentBgColor = BackgroundColor
    currentBorderColor = BorderColor
    currentTextColor = TextColor
  End If
Else
  // Use appropriate system or standard gray colors for the disabled state.
  currentBgColor = Color.LightGray
  currentBorderColor = Color.Gray
  currentTextColor = Color.DisabledTextColor // Use system disabled text color
End If

// Set the drawing color and draw the background shape with rounded corners.
g.DrawingColor = currentBgColor
g.FillRoundRectangle(0, 0, g.Width, g.Height, currentCornerRadius, currentCornerRadius)

// Set the drawing color and pen size for the border.
g.DrawingColor = currentBorderColor
g.PenSize = 2
// Draw the border shape just inside the background rectangle.
g.DrawRoundRectangle(1, 1, g.Width-2, g.Height-2, currentCornerRadius, currentCornerRadius)

// Enable anti-aliasing for smoother text rendering.
g.AntiAliasMode = Graphics.AntiAliasModes.HighQuality
g.AntiAliased = True
// Calculate the width and height of the button text.
Var tw As Double = g.TextWidth(ButtonText)
Var th As Double = g.TextHeight
// Calculate the X position to center the text horizontally.
Var tx As Double = (g.Width - tw) / 2
// Calculate the Y position to center the text vertically, with a small adjustment.
Var ty As Double = (g.Height + th) / 2 - 3
// Set the drawing color for the text.
g.DrawingColor = currentTextColor
// Draw the button text at the calculated centered position.
g.DrawText(ButtonText, tx, ty)</code></pre>



<p>Let’s break down the changes in the&nbsp;<code>Paint</code>&nbsp;event:</p>



<ul class="wp-block-list">
<li>We now use the&nbsp;<code>CornerRadius</code>&nbsp;property instead of a static constant for drawing the rounded rectangles.</li>



<li>We introduced an&nbsp;<code>If Enabled Then ... Else</code>&nbsp;block.</li>



<li>Inside the&nbsp;<code>If Enabled Then</code>&nbsp;block, we have a nested&nbsp;<code>If IsPressed Then ... ElseIf IsHovered Then ... Else</code>&nbsp;structure. This determines the&nbsp;<code>currentBgColor</code>:
<ul class="wp-block-list">
<li>If&nbsp;<code>IsPressed</code>&nbsp;is True,&nbsp;<code>currentBgColor</code>&nbsp;is set to&nbsp;<code>HighlightColor</code>.</li>



<li>If&nbsp;<code>IsPressed</code>&nbsp;is False but&nbsp;<code>IsHovered</code>&nbsp;is True,&nbsp;<code>currentBgColor</code>&nbsp;is set to&nbsp;<code>HoverColor</code>.</li>



<li>If neither&nbsp;<code>IsPressed</code>&nbsp;nor&nbsp;<code>IsHovered</code>&nbsp;is True,&nbsp;<code>currentBgColor</code>&nbsp;is set to&nbsp;<code>BackgroundColor</code>.</li>



<li>The&nbsp;<code>currentBorderColor</code>&nbsp;and&nbsp;<code>currentTextColor</code>&nbsp;are set directly from the&nbsp;<code>BorderColor</code>&nbsp;and&nbsp;<code>TextColor</code>&nbsp;properties when the button is enabled.</li>
</ul>
</li>



<li>Inside the&nbsp;<code>Else</code>&nbsp;block (when&nbsp;<code>Enabled</code>&nbsp;is False), we set the colors to standard gray values (<code>Color.LightGray</code>&nbsp;for background,&nbsp;<code>Color.Gray</code>&nbsp;for border, and&nbsp;<code>Color.DisabledTextColor</code>&nbsp;for text) to give the button a disabled appearance.</li>



<li>Finally, the drawing commands use these&nbsp;<code>currentBgColor</code>,&nbsp;<code>currentBorderColor</code>,&nbsp;<code>currentTextColor</code>, and&nbsp;<code>currentCornerRadius</code>&nbsp;variables.</li>
</ul>



<h3 class="wp-block-heading" id="using-the-enhanced-custom-control">Using the Enhanced Custom Control</h3>



<p>Now that our&nbsp;<code>CanvasButton</code>&nbsp;has more customization options and supports a disabled state, let’s see how to use these features.</p>



<ol class="wp-block-list">
<li>If you don’t already have an instance, drag the&nbsp;<code>CanvasButton</code>&nbsp;class from the Project Navigator onto a window in the Layout Editor.</li>



<li>You can now access and set the new properties programmatically. For example, in a button’s&nbsp;<code>Opening</code>&nbsp;event, you could add code like this:</li>
</ol>



<pre class="wp-block-code"><code>// Customize colors
Me.BackgroundColor = Color.RGB(200, 50, 50) // A shade of red
Me.HoverColor = Color.RGB(255, 100, 100) // A lighter red for hover
Me.HighlightColor = Color.RGB(150, 0, 0) // A darker red for pressed
Me.BorderColor = Color.Black
Me.TextColor = Color.White

// Adjust corner radius
Me.CornerRadius = 10</code></pre>



<p>You can experiment with different values to see how they affect the button’s appearance. To test the disabled state, you can set the&nbsp;<code>Enabled</code>&nbsp;property to&nbsp;<code>False</code>.</p>



<h3 class="wp-block-heading" id="conclusion">Conclusion</h3>



<p>We&#8217;ve now taken our custom button to the next level by adding extensive color customization, adjustable corners, and a disabled state.</p>



<p>This project can be downloaded from GitHub at:&nbsp;<a href="https://github.com/xolabsro/CanvasButton" target="_blank" rel="noreferrer noopener">https://github.com/xolabsro/CanvasButton</a></p>



<p>Hope you enjoyed making the button your own! While it&#8217;s much more flexible now, there might be other features we could add down the road, so stay tuned!</p>



<p id="block-59a92dbb-c0d1-4b75-b250-f331b6ceb4c4">More in this series:</p>



<ul id="block-c7594468-ed0c-4be1-a999-04ef9789f34c" class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/05/02/how-to-create-a-custom-button-control-in-xojo/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo</a></li>



<li><a href="https://blog.xojo.com/2025/05/14/how-to-create-a-custom-button-control-in-xojo-part-2/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 2</a></li>



<li><a href="https://blog.xojo.com/2025/05/28/how-to-create-a-custom-button-control-in-xojo-part-3-make-your-controls-inspector-friendly/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 3: Make Your Controls Inspector-Friendly</a></li>



<li><a href="https://blog.xojo.com/2025/06/23/how-to-create-a-custom-button-control-in-xojo-part-4-adding-focus/" target="_blank" rel="noreferrer noopener">How To Create a Custom Button Control in Xojo – Part 4: Adding Focus</a></li>



<li><a href="https://blog.xojo.com/2025/10/08/how-to-create-a-custom-button-control-in-xojo-part-5-adding-text-alignment/" target="_blank" rel="noreferrer noopener">How to Create a Custom Button Control in Xojo &#8211; Part 5: Adding Text Alignment</a></li>
</ul>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Year of Code 2025: May Project, Mobile Apps</title>
		<link>https://blog.xojo.com/2025/05/07/year-of-code-2025-may-project-mobile-apps/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 07 May 2025 16:00:00 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Year of Code]]></category>
		<category><![CDATA[#YearofCode]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14805</guid>

					<description><![CDATA[One of the most common things I love to use my phone for is sharing pictures of my pets with others. We have two cats&#8230;]]></description>
										<content:encoded><![CDATA[
<p>One of the most common things I love to use my phone for is sharing pictures of my pets with others. We have two cats and a dog: Shawmut, Christofur and Lucy. To be honest, I’m not much a cat person as I find that cats are almost all <a href="https://24hrtees.net/shop/dont-be-a-richard/">Richards</a>, constantly causing and getting into trouble. I’m 100% a dog person.</p>



<p>But even though I have my own pets, I do love looking at pet pictures. It&#8217;s a simple pleasure, but there&#8217;s not much that I find more calming.</p>



<p>Years ago I made a Xojo app (CatsUp) that displayed random cat pictures and it was a lot of fun. And one thing that Xojo excels at is making it fun to create software! That’s what the Year of Code is all about, after all.</p>



<p>Speaking of that, here is the Year of Code topic for May: <strong>Mobile Apps</strong>.</p>



<p>You can already find CatsUp for iOS and Android included in the Xojo examples, but why stop at just cats? Being a dog guy, I want to see some dogs. All the dogs.</p>



<p>Since I’m not here to start a cats vs. dogs war, I thought, why not both? It turns out I’m not the only one that thinks this as there are actually public web services that serve up pictures of cats and dogs. Web services and mobile apps go together like peanuts butter and chocolate.</p>



<p>The web service for cats that I’ve previously used is called TheCatAPI and is available here: <a href="https://thecatapi.com">https://thecatapi.com</a></p>



<p>There is an equivalent dog one called, unsurprisingly, TheDogAPI: <a href="https://www.thedogapi.com">https://www.thedogapi.com</a></p>



<p>For my mobile app this month, I’ve created an all-new app that can show pictures of cats, dogs or both! I call it Pawz.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="1024" height="1024" src="https://blog.xojo.com/wp-content/uploads/2025/04/Pawz.png" alt="" class="wp-image-14806" style="width:344px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/04/Pawz.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/04/Pawz-300x300.png 300w, https://blog.xojo.com/wp-content/uploads/2025/04/Pawz-150x150.png 150w, https://blog.xojo.com/wp-content/uploads/2025/04/Pawz-768x768.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">Pawz app icon</figcaption></figure>



<p>Actually, it&#8217;s two apps since I made versions for iOS and Android. Here’s a look:</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="497" height="1024" src="https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.44.54@2x-497x1024.png" alt="" class="wp-image-14810" style="width:309px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.44.54@2x-497x1024.png 497w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.44.54@2x-145x300.png 145w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.44.54@2x-768x1584.png 768w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.44.54@2x-745x1536.png 745w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.44.54@2x.png 867w" sizes="auto, (max-width: 497px) 100vw, 497px" /><figcaption class="wp-element-caption">Pawz on iOS</figcaption></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="480" height="1024" src="https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.41.34@2x-480x1024.png" alt="" class="wp-image-14809" style="width:298px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.41.34@2x-480x1024.png 480w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.41.34@2x-141x300.png 141w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.41.34@2x-768x1637.png 768w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.41.34@2x-721x1536.png 721w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.41.34@2x.png 915w" sizes="auto, (max-width: 480px) 100vw, 480px" /><figcaption class="wp-element-caption">Pawz on Android</figcaption></figure>
</div>
</div>



<p>Although they are separate projects, both use basically the same code. In fact there is only about 50 lines of code in each project! The UI itself is just a big ImageViewer that is used to show the picture and several toolbar buttons.</p>



<p>There are three buttons to request a cat picture, dog picture or a surprise picture that could be either. There is also an extra button that lets you share the picture, if you really like it.</p>



<p>You can find the source for the iOS and Android versions of Pawz on GitHub here:</p>



<p><a href="https://github.com/paullefebvre/pawz">https://github.com/paullefebvre/pawz</a></p>



<p>Year of Code is all about having some fun making an app. As you can see with Pawz, it doesn&#8217;t have to be anything extravagant. Even fun apps can be made quickly with very little code!</p>



<p>I can&#8217;t wait to see what great mobile apps you all create this month. <a href="https://forum.xojo.com/t/2025-year-of-code-may-is-mobile/85272">Share your creations in the Forum topic</a>.</p>



<h2 class="wp-block-heading"><strong>One More Thing</strong></h2>



<p>Although phones and tablets are what we usually think of when talking about Mobile Apps, you know what else is rather mobile? A vehicle! And it just so happens that many vehicle manufacturers, such as  Cadillac, Chevy, Ford, Honda, Polestar, Renault and Volvo are now using Android to run their infotainment systems. Technically it&#8217;s Android Automotive OS (AAOS), but it is very similar to regular Android.</p>



<p>Because Xojo builds standard Android Runtime (ART) apps, Xojo Android apps also work on Android Automotive OS as a &#8220;parked app&#8221;. You can test with this by using Android Studio to install an Android Automotive VM for the Emulator. Once you’ve added that you can run your Xojo Android projects on it just like any other device. Pawz works fine in an AAOS Emulator.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="1008" src="https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.55.26@2x-1024x1008.png" alt="" class="wp-image-14813" srcset="https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.55.26@2x-1024x1008.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.55.26@2x-300x295.png 300w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.55.26@2x-768x756.png 768w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.55.26@2x-1536x1512.png 1536w, https://blog.xojo.com/wp-content/uploads/2025/04/CleanShot-2025-04-16-at-13.55.26@2x-2048x2016.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Why do I bring this up? No reason, although I believe Xojo 2025 Release 2 pre-release testing might be starting soon&#8230;</p>



<p><em>Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at <a href="https://goto10.substack.com" target="_blank" rel="noreferrer noopener">Goto 10</a> and </em>on Mastodon @lefebvre@hachyderm.io.</p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>



<p><strong>Year of Code Project</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/">Year of Code: Kickoff</a></li>



<li><a href="https://blog.xojo.com/2025/01/15/year-of-code-2025-january-project/" target="_blank" rel="noreferrer noopener">January Project: Desktop Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/year-of-code-2025-january-project-sharing/83927" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/02/11/year-of-code-2025-february-project/">February Project: Database Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/2025-year-of-code-february" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/03/05/year-of-code-2025-march-project-web-apps/">March Project: Web Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-march/84474?u=alyssa_foley">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/04/08/year-of-code-2025-april-project-user-interface/">April Project: User Interface</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-april-user-interface/84926">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/05/07/year-of-code-2025-may-project-mobile-apps/">May Project: Mobile Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-may-is-mobile/85272">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/06/10/year-of-code-2025-june-project-cross-platform-code-class/">June Project: Code Sharing</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-june-is-code-sharing/85612">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/07/10/year-of-code-2025-july-project-charting/">July Project: Charting</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-july-is-charting/85896">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/08/07/year-of-code-2025-august-project-console-apps/">August Project: Console Apps</a> | <a href="https://forum.xojo.com/t/august-2025-year-of-code-console-apps/86203">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/09/08/year-of-code-2025-september-project-games/">September Project: Games</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-septgamer">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/10/13/year-of-code-2025-october-project-multi-platform-communication/">October Project: Multi-Platform</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-october-multi-platform-communication/86717">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/11/10/year-of-code-2025-november-project-pdf-postcard-generator/">November Project: PDF</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-november-pdf/86969">Forum Discussion</a></li>
</ul>



<p><strong>How to Play:</strong></p>



<p>Each month we&#8217;ll announce a new theme and share an example project of our own. Share your projects to the Xojo Forum thread for that month via GitHub (all the links you need are posted above ↑ ). Learn how to use <a href="https://blog.xojo.com/2024/04/02/using-xojo-and-github/">Xojo and GitHub</a>.</p>



<p><strong>The Prizes:</strong></p>



<p>Monthly winners get $100 at the Xojo store. Every month you submit a project is another chance to win the grand prize. The grand prize is $250 cash plus a Xojo Pro license and a year of GraffitiSuite and will be announce in December. Learn more about the <a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/#prizes">prizes</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How To Create a Custom Button Control in Xojo</title>
		<link>https://blog.xojo.com/2025/05/02/how-to-create-a-custom-button-control-in-xojo/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Fri, 02 May 2025 14:00:00 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Custom Button Design]]></category>
		<category><![CDATA[Custom Classes]]></category>
		<category><![CDATA[Custom Control Design]]></category>
		<category><![CDATA[DesktopCanvas]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14858</guid>

					<description><![CDATA[This tutorial demonstrates how to create a custom button control in Xojo using the&#160;DesktopCanvas&#160;class. It covers defining properties, handling mouse events for visual feedback, and&#8230;]]></description>
										<content:encoded><![CDATA[
<p>This tutorial demonstrates how to create a custom button control in Xojo using the&nbsp;<code>DesktopCanvas</code>&nbsp;class. It covers defining properties, handling mouse events for visual feedback, and drawing the control in the&nbsp;<code>Paint</code>&nbsp;event.</p>



<p>You can read more about <code>DesktopCanvas</code> <a href="https://documentation.xojo.com/api/user_interface/desktop/desktopcanvas.html" target="_blank" rel="noreferrer noopener">in the Xojo Docs.</a></p>



<p>Let&#8217;s begin!</p>



<h3 class="wp-block-heading" id="add-a-custom-class">Add a Custom Class:</h3>



<ul class="wp-block-list">
<li>In the Project Navigator, add a new&nbsp;<strong>Class</strong>.</li>



<li>Name it&nbsp;<code>CanvasButton</code>.</li>



<li>Set its&nbsp;<strong>Super</strong>&nbsp;class to&nbsp;<code>DesktopCanvas</code>.</li>
</ul>



<h4 class="wp-block-heading" id="add-properties">Add Properties:</h4>



<ul class="wp-block-list">
<li><code>ButtonText As String</code>&nbsp;(Set Scope to&nbsp;<code>Public</code>, Default Value to&nbsp;<code>"Click Me"</code>. To make this property visible in the Inspector, right-click the&nbsp;<code>CanvasButton</code>&nbsp;class in the Project Navigator, select ‘Inspector Behaviour…’, scroll through the property list to find the&nbsp;<code>ButtonText</code>&nbsp;variable, and make sure its checkbox is checked.)</li>



<li><code>IsHovered As Boolean</code>&nbsp;(Set Scope to&nbsp;<code>Private</code>, Default Value to&nbsp;<code>False</code>)</li>



<li><code>IsPressed As Boolean</code>&nbsp;(Set Scope to&nbsp;<code>Private</code>, Default Value to&nbsp;<code>False</code>)</li>
</ul>



<h4 class="wp-block-heading" id="define-pressed-custom-event">Define&nbsp;<code>Pressed</code>&nbsp;Custom Event:</h4>



<ul class="wp-block-list">
<li>Go to&nbsp;<strong>Insert &gt; Event Definition</strong>.</li>



<li>Name the event&nbsp;<code>Pressed</code>. This is the event that will be raised when the button is clicked.</li>
</ul>



<h4 class="wp-block-heading" id="add-event-handlers">Add Event Handlers:</h4>



<ul class="wp-block-list">
<li>Select the&nbsp;<code>CanvasButton</code>&nbsp;class in the Project Navigator.</li>



<li>Go to&nbsp;<strong>Insert &gt; Event Handler</strong>. Add the following event handlers and paste the corresponding code into each:</li>
</ul>



<p><strong><code>MouseDown(x As Integer, y As Integer)</code></strong></p>



<pre class="wp-block-code"><code>// Set internal state to indicate the button is being pressed.
IsPressed = True
// Refresh the control to show the pressed state visually.
Me.Refresh(False)
// Return True to indicate that this event was handled.
Return True</code></pre>



<p><strong><code>MouseEnter</code></strong></p>



<pre class="wp-block-code"><code>// Set internal state to indicate the mouse is hovering over the button.
IsHovered = True
// Refresh the control to show the hover state visually.
Me.Refresh(False)</code></pre>



<p><strong><code>MouseExit</code></strong></p>



<pre class="wp-block-code"><code>// Set internal state to indicate the mouse is no longer hovering.
IsHovered = False
// Refresh the control to revert from the hover state.
Me.Refresh(False)</code></pre>



<p><strong><code>MouseUp(x As Integer, y As Integer)</code></strong></p>



<pre class="wp-block-code"><code>// Check if the button was pressed down AND the mouse is still hovering over it.
If IsPressed And IsHovered Then
   // If true, the button was successfully clicked. Raise the custom Pressed event.
  RaiseEvent Pressed
End If
// Reset the pressed state regardless of whether the click was successful.
IsPressed = False
// Refresh the control to revert from the pressed state.
Me.Refresh(False)</code></pre>



<p><strong><code>Paint(g As Graphics, areas() As Rect)</code></strong></p>



<pre class="wp-block-code"><code>// Corner radius of the button shape.
Static CornerRadius As Integer = 4

 // Declare variables for the colors used in drawing.
Var bgColor As Color
Var borderColor As Color = Color.DarkBevelColor
Var TextColor As Color = Color.LightTingeColor

 // Determine the background color based on the button's current state (pressed or hovered).
If IsPressed Or IsHovered Then
  // Use a highlight color if pressed or hovered.
  bgColor = Color.HighlightColor
Else
  // Use the accent theme color for the default state.
  bgColor = Color.AccentThemeColor
End If

// Set the drawing color and draw the background shape with rounded corners.
g.DrawingColor = bgColor
g.FillRoundRectangle(0, 0, g.Width, g.Height, CornerRadius, CornerRadius)

// Set the drawing color and pen size for the border.
g.DrawingColor = borderColor
g.PenSize = 2
// Draw the border shape just inside the background rectangle.
g.DrawRoundRectangle(1, 1, g.Width-2, g.Height-2, CornerRadius, CornerRadius)

// Enable anti-aliasing for smoother text rendering.
g.AntiAliasMode = Graphics.AntiAliasModes.HighQuality
g.AntiAliased = True
// Calculate the width and height of the button text.
Var tw As Double = g.TextWidth(ButtonText)
Var th As Double = g.TextHeight
// Calculate the X position to center the text horizontally.
Var tx As Double = (g.Width - tw) / 2
 // Calculate the Y position to center the text vertically, with a small adjustment.
Var ty As Double = (g.Height + th) / 2 - 3
// Set the drawing color for the text.
g.DrawingColor = TextColor
// Draw the button text at the calculated centered position.
g.DrawText(ButtonText, tx, ty)</code></pre>



<p><strong>Use the Custom Control:</strong></p>



<ul class="wp-block-list">
<li>Open&nbsp;<code>Window1</code>.</li>



<li>Drag the&nbsp;<code>CanvasButton</code>&nbsp;class from the Project Navigator onto the window.</li>
</ul>



<p><strong>Handle the Click Event:</strong></p>



<ul class="wp-block-list">
<li>Double-click the&nbsp;<code>CanvasButton</code>&nbsp;instance on the window layout.</li>



<li>Add the custom&nbsp;<code>Pressed</code>&nbsp;event handler.</li>



<li>Add code inside this handler:&nbsp;<code>MessageBox("Custom Button Clicked!")</code>.</li>
</ul>



<h4 class="wp-block-heading" id="run-the-project">Run the Project:</h4>



<ul class="wp-block-list">
<li>Run the project. Test the button by hovering, pressing, and clicking to see the visual feedback and trigger the&nbsp;<code>Pressed</code>&nbsp;event.</li>
</ul>



<p>And just like that, you’ve built your own custom button! Hope you had fun following along. Keep an eye out for our next tutorials, where we’ll take this button and give it some awesome upgrades!</p>



<p>This project can be downloaded from GitHub at: <a href="https://github.com/xolabsro/CanvasButton" target="_blank" rel="noreferrer noopener">https://github.com/xolabsro/CanvasButton</a></p>



<p id="block-59a92dbb-c0d1-4b75-b250-f331b6ceb4c4">More in this series:</p>



<ul id="block-c7594468-ed0c-4be1-a999-04ef9789f34c" class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/05/02/how-to-create-a-custom-button-control-in-xojo/">How To Create a Custom Button Control in Xojo</a></li>



<li><a href="https://blog.xojo.com/2025/05/14/how-to-create-a-custom-button-control-in-xojo-part-2/">How To Create a Custom Button Control in Xojo – Part 2</a></li>



<li><a href="https://blog.xojo.com/2025/05/28/how-to-create-a-custom-button-control-in-xojo-part-3-make-your-controls-inspector-friendly/">How To Create a Custom Button Control in Xojo – Part 3: Make Your Controls Inspector-Friendly</a></li>



<li><a href="https://blog.xojo.com/2025/06/23/how-to-create-a-custom-button-control-in-xojo-part-4-adding-focus/">How To Create a Custom Button Control in Xojo – Part 4: Adding Focus</a></li>
</ul>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Year of Code 2025: April Project, User Interface</title>
		<link>https://blog.xojo.com/2025/04/08/year-of-code-2025-april-project-user-interface/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Tue, 08 Apr 2025 15:30:00 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Year of Code]]></category>
		<category><![CDATA[#YearofCode]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Listbox]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[UI-Design]]></category>
		<category><![CDATA[User Interface]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14788</guid>

					<description><![CDATA[April&#8217;s Year of Code theme is all about a great User Interface, I decided to focus on refining the user experience of an existing application.&#8230;]]></description>
										<content:encoded><![CDATA[
<p>April&#8217;s Year of Code theme is all about a great User Interface, I decided to focus on refining the user experience of an existing application. My project involves a user interface revamp of the familiar built-in ToDo desktop app example provided with Xojo.</p>



<p>The goal wasn&#8217;t to add new features but to explore how applying thoughtful UI design principles can significantly enhance the look and feel of an application, making it more visually appealing and cohesive.</p>



<p>Here are some of the key aspects of the UI revamp:</p>



<ul class="wp-block-list">
<li><strong>Design System Foundation:</strong>&nbsp;I started by establishing a basic design system. This involved defining core visual elements to ensure consistency across the entire application interface.</li>



<li><strong>Typography Definition:</strong>&nbsp;Specific styles were defined for how titles and standard text should appear. This helps create a clear visual hierarchy and improves readability.</li>



<li><strong>Consistent Color Palette:</strong>&nbsp;A specific set of colors (Light &amp; Dark mode) was chosen and implemented throughout the project, contributing to a unified and more polished look.</li>



<li><strong>Refined ListBox Appearance:</strong>&nbsp;The standard&nbsp;DesktopListBox&nbsp;control received some visual tweaks to better align with the overall updated aesthetic.</li>
</ul>



<p>The aim was to demonstrate how focusing on UI details can elevate even a simple example application.</p>



<p>Here’s a glimpse of the revamped ToDo app:</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="602" height="452" data-id="14792" src="https://blog.xojo.com/wp-content/uploads/2025/04/ToDoOrig-1.jpg" alt="" class="wp-image-14792" srcset="https://blog.xojo.com/wp-content/uploads/2025/04/ToDoOrig-1.jpg 602w, https://blog.xojo.com/wp-content/uploads/2025/04/ToDoOrig-1-300x225.jpg 300w" sizes="auto, (max-width: 602px) 100vw, 602px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="602" height="584" data-id="14793" src="https://blog.xojo.com/wp-content/uploads/2025/04/ToDoFresh-1.jpg" alt="" class="wp-image-14793" srcset="https://blog.xojo.com/wp-content/uploads/2025/04/ToDoFresh-1.jpg 602w, https://blog.xojo.com/wp-content/uploads/2025/04/ToDoFresh-1-300x291.jpg 300w" sizes="auto, (max-width: 602px) 100vw, 602px" /></figure>
</figure>



<p>You can find the complete source code for this UI-enhanced <a href="https://github.com/xolabsro/ToDoFresh" data-type="link" data-id="https://github.com/xolabsro/ToDoFresh" target="_blank" rel="noreferrer noopener">ToDo app project on GitHub</a>. </p>



<p>Stay tuned for more exciting projects as we continue our Year of Code 2025 journey!</p>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>



<p><strong>Year of Code Project</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/">Year of Code: Kickoff</a></li>



<li><a href="https://blog.xojo.com/2025/01/15/year-of-code-2025-january-project/" target="_blank" rel="noreferrer noopener">January Project: Desktop Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/year-of-code-2025-january-project-sharing/83927" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/02/11/year-of-code-2025-february-project/">February Project: Database Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/2025-year-of-code-february" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/03/05/year-of-code-2025-march-project-web-apps/">March Project: Web Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-march/84474?u=alyssa_foley">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/04/08/year-of-code-2025-april-project-user-interface/">April Project: User Interface</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-april-user-interface/84926">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/05/07/year-of-code-2025-may-project-mobile-apps/">May Project: Mobile Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-may-is-mobile/85272">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/06/10/year-of-code-2025-june-project-cross-platform-code-class/">June Project: Code Sharing</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-june-is-code-sharing/85612">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/07/10/year-of-code-2025-july-project-charting/">July Project: Charting</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-july-is-charting/85896">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/08/07/year-of-code-2025-august-project-console-apps/">August Project: Console Apps</a> | <a href="https://forum.xojo.com/t/august-2025-year-of-code-console-apps/86203">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/09/08/year-of-code-2025-september-project-games/">September Project: Games</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-septgamer">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/10/13/year-of-code-2025-october-project-multi-platform-communication/">October Project: Multi-Platform</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-october-multi-platform-communication/86717">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/11/10/year-of-code-2025-november-project-pdf-postcard-generator/">November Project: PDF</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-november-pdf/86969">Forum Discussion</a></li>
</ul>



<p><strong>How to Play:</strong></p>



<p>Each month we&#8217;ll announce a new theme and share an example project of our own. Share your projects to the Xojo Forum thread for that month via GitHub (all the links you need are posted above ↑ ). Learn how to use <a href="https://blog.xojo.com/2024/04/02/using-xojo-and-github/">Xojo and GitHub</a>.</p>



<p><strong>The Prizes:</strong></p>



<p>Monthly winners get $100 at the Xojo store. Every month you submit a project is another chance to win the grand prize. The grand prize is $250 cash plus a Xojo Pro license and a year of GraffitiSuite and will be announce in December. Learn more about the <a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/#prizes">prizes</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Handling Feature Requests</title>
		<link>https://blog.xojo.com/2025/03/15/handling-feature-requests/</link>
		
		<dc:creator><![CDATA[Anthony Cyphers]]></dc:creator>
		<pubDate>Sat, 15 Mar 2025 20:12:28 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14686</guid>

					<description><![CDATA[As a developer, feature requests are a fact of life and one’s stress level may vary based on the complexity of the requests you receive.&#8230;]]></description>
										<content:encoded><![CDATA[
<p>As a developer, feature requests are a fact of life and one’s stress level may vary based on the complexity of the requests you receive. So what’s the best way to handle a feature request? Well, I’m not sure if there’s a best way, but here’s how I do it.</p>



<h3 class="wp-block-heading">Understand the Need</h3>



<p>The first step when I tackle a feature request is to thoroughly understand what the request is really about. People rarely have the ability to articulate exactly what they need, but are great at giving you just enough details — in small bursts — to figure it out if you carefully investigate their use case.</p>



<p>If you’re unsure of what they’re really trying to accomplish, ask for clarification. It’s better to spend more time up-front finding out what you really need to do than it is to rewrite your changes later. If you find yourself frequently modifying new code based on additional requests shortly after writing it then you may need to work on your communication.</p>



<p>Slow down, ask questions, try to get it right the first time. It’s not always as simple as a specification document (assuming you have one).</p>



<h3 class="wp-block-heading">Understand the Code</h3>



<p>Now that you understand the request, it’s time to analyze the code. Let’s be real, very few people can keep their entire codebase in their mind. Read through your code. Like a book. Follow function calls, property setters, everything. Make sure you understand what you’re modifying before you proceed, and look for the areas you’ll need to modify.</p>



<p>Sometimes this is much easier than others depending on the complexity of the project. And take notes! This step is especially important if you’re working on Other People’s Code (OPC).</p>



<h3 class="wp-block-heading">Understand the Path</h3>



<p>Next, develop a plan. Since you’ve read through code and, presumably, developed some ideas on the best way to implement, develop your own specification for the change. Give yourself time to fully work out the new implementation — I use private notes in my support system for wrapping my head around everything, which has the benefit of giving me greater insight if I need to come back later for some reason.</p>



<p>Work out the path forward before you ever modify any code by noting where you’ll make changes and what those changes might entail, keeping in mind that your previous functionality should continue to work as expected. This might involve creating new code paths specifically for the new feature to ensure that you don’t break old, working code. It’s also important to note things outside the scope of the new feature that you’ll need to test afterward to be sure that you didn’t break anything.</p>



<h3 class="wp-block-heading">Build the Road</h3>



<p>After you have a plan, it’s time to start building. If your strategy has been adequately outlined and you enjoy writing code, this is probably the most fun part. Follow your plan and make changes as you’ve outlined them. Be on the lookout for edge cases or caveats that you may have missed in your specification notes, chances are that they do exist.</p>



<h3 class="wp-block-heading">Test&nbsp;<strong><em>Everything</em></strong></h3>



<p>Finally, testing! Don’t just test the new feature, test the old functionality as well. It’s common that feature requests require modifying existing systems and you don’t want to push out that new release with a cool new feature only to have existing functionality break. Your work will look rushed and careless, and that’s worse than it taking a bit longer to complete.</p>



<h3 class="wp-block-heading">Bonus Tip</h3>



<p>Know when to rewrite. Over time codebases can become monolithic and overly complex based on continually adding features that were never considered when the project or features being modified were first created. If you find yourself spending more and more time trying to understand your code paths or fixing old functionality that new features break, it may be time to develop a new project specification and start from scratch. Don’t be afraid of tossing out something that causes you endless headaches to modify.</p>



<h3 class="wp-block-heading">Conclusion</h3>



<p>Whether working in a team or solo, a slow and methodical approach to feature requests will ensure that your changes last and customers are happy. Don’t rely on code reviews to catch issues or multiple requests after the fact to get everything right. You’ll make mistakes and miss things, but your work will be much better received with a little additional care.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>5 Tips for Optimizing Your Xojo Apps for Performance</title>
		<link>https://blog.xojo.com/2025/02/27/5-tips-for-optimizing-your-xojo-apps-for-performance/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Thu, 27 Feb 2025 14:00:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[App Optimization]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14541</guid>

					<description><![CDATA[Performance can be a make-or-break feature for any application, especially when users expect smooth interactions and quick results. Luckily, Xojo provides tools and techniques you&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Performance can be a make-or-break feature for any application, especially when users expect smooth interactions and quick results. Luckily, <a href="https://xojo.com" data-type="link" data-id="https://xojo.com" target="_blank" rel="noreferrer noopener">Xojo</a> provides tools and techniques you can leverage to ensure your apps run as efficiently as possible.</p>



<p>However, functionality should take priority during the initial implementation. Focus on getting the app or feature working correctly and bug-free before considering optimization. Performance improvements are best handled in subsequent iterations. Remember, &#8220;Early optimization is the root of all evil.&#8221;</p>



<p>Here are five tips to consider when building or refining your Xojo applications.</p>



<h2 class="wp-block-heading">1. Identify Bottlenecks with the Xojo Profiler</h2>



<p>Before diving into specific optimizations, you need to determine where your app is spending the most time. Xojo’s built-in Profiler provides detailed information on method execution time, helping you isolate trouble spots.</p>



<ul class="wp-block-list">
<li><strong>Enable the Profiler</strong>: In the Build Settings for your project, ensure “Profiling” is turned on. Then run your application in Debug mode.</li>



<li><strong>Analyze Results</strong>: After closing your app, review the profiler report to see which methods and lines of code took the longest time.</li>



<li><strong>Focus on High-Impact Areas</strong>: Tackle the biggest time sinks first—a small fix in a heavily accessed function can lead to noticeable performance gains.</li>
</ul>



<p><strong>Pro Tip</strong>: Limit changes to one area at a time, then re-profile. This approach helps confirm whether your optimizations actually improved performance. Read more about the Code Profiler feature: <a href="https://documentation.xojo.com/getting_started/debugging/code_profiler.html#getting-started-debugging-code-profiler-using-the-code-profiler">https://documentation.xojo.com/getting_started/debugging/code_profiler.html#getting-started-debugging-code-profiler-using-the-code-profiler</a></p>



<h2 class="wp-block-heading">2. Use Efficient Data Structures and Algorithms</h2>



<p>Choosing data structures wisely can dramatically impact speed, especially in data-intensive applications.</p>



<ul class="wp-block-list">
<li><strong>Arrays vs. Dictionaries</strong>: For large datasets with frequent lookups, a Dictionary can deliver faster lookups compared to an array, especially when searching by a key.</li>



<li><strong>Avoid Repetitive Property Lookups</strong>: If you access the same class property or control value repeatedly inside a loop, store it in a local variable first. This minimizes overhead each iteration.</li>



<li><strong>Algorithmic Complexity</strong>: Review algorithms for large tasks. Nested loops that appear simple could become extremely slow for bigger data sets. If possible, replace them with more efficient sorting and searching methods.</li>
</ul>



<p><strong>Example</strong>: Instead of repeatedly using&nbsp;<code>myArray.IndexOf(item)</code>&nbsp;inside a loop, store the index in a variable once or switch to a Dictionary for faster lookups.</p>



<h2 class="wp-block-heading">3. Offload Work to Threads</h2>



<p>Making your application responsive often means running time-consuming tasks in the background.</p>



<ul class="wp-block-list">
<li><strong>Why Threads Help</strong>: Xojo threads let you perform lengthy computations without freezing the main UI. This creates a better user experience and can let users continue working while the app processes data.</li>



<li><strong>Identify Good Candidates</strong>: Processing data, network transactions, or any tasks that take more than a fraction of a second can benefit from being threaded.</li>
</ul>



<p><strong>Pro Tip</strong>: If you only have a short delay (like reading a small file), threading may introduce complexity. Focus on threading tasks that truly benefit from parallel or asynchronous execution.</p>



<h2 class="wp-block-heading">4. Manage File and Network I/O Efficiently</h2>



<p>Disk access and network requests tend to be some of the biggest performance bottlenecks.</p>



<ul class="wp-block-list">
<li><strong>Batch Operations</strong>: Rather than reading or writing data one line at a time in a loop, try batching reads/writes to minimize overhead.</li>



<li><strong>Cache Strategically</strong>: If your app frequently loads the same data (like configuration files), store it in memory for quick access.</li>



<li><strong>Asynchronous Calls</strong>: For tasks requiring large data transfers or multiple network requests, consider asynchronous approaches so the UI remains responsive.</li>
</ul>



<p><strong>Example</strong>: When generating reports, accumulate data in a buffer or in-memory structure, and then perform a single file write at the end, instead of dozens or hundreds of small writes.</p>



<h2 class="wp-block-heading">5. Mind Your Loops and String Operations</h2>



<p>Nested loops and repetitive string concatenations are particularly notorious performance killers.</p>



<ul class="wp-block-list">
<li><strong>Minimize Nested Loops</strong>: Combine or break up loops that needlessly repeat the same work. For example, a single pass that filters and sorts data is typically faster than two separate loops.</li>



<li><strong>Efficient String Handling</strong>: Building long strings in a tight loop using the&nbsp;<code>+</code>&nbsp;operator can degrade performance because strings are immutable in many languages, and repeated concatenation can cause extra memory allocations.</li>



<li><strong>Use Add</strong>: If you’re concatenating parts of a string repeatedly, consider using an array combined with&nbsp;<code>String.FromArray</code> for more efficient handling.</li>
</ul>



<p><strong>Example</strong>: Instead of doing:</p>



<pre class="wp-block-code"><code>Var largeString As String
For i As Integer = 0 To 1000
  largeString = largeString + "line " + i.ToString
Next</code></pre>



<p>…collect lines in a String array, then&nbsp;<code><code>String.FromArray</code>()</code>&nbsp;them once. You’ll often see a significant speed boost in large-scale operations.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Optimizing your Xojo apps for performance doesn’t have to be an intimidating process. With the right tools (such as the Code Profiler) and a focus on data structures, threading, efficient I/O, and mindful loop/ string operations, you can significantly speed up your apps and keep the user experience smooth.</p>



<p>Remember to quantify the results by measuring before and after each change. By continuously profiling and fine-tuning your code, you’ll create compelling, efficient Xojo applications that delight your users.</p>



<p>Have fun optimizing and don’t forget to share your own performance tips or success stories in the <a href="https://forum.xojo.com/" data-type="link" data-id="https://forum.xojo.com/" target="_blank" rel="noreferrer noopener">Xojo community forums</a>!</p>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Introduction to PocketBase: A Backend Alternative for Xojo Developers</title>
		<link>https://blog.xojo.com/2025/02/19/introduction-to-pocketbase-a-backend-alternative-for-xojo-developers/</link>
		
		<dc:creator><![CDATA[Ezekiel Burke]]></dc:creator>
		<pubDate>Wed, 19 Feb 2025 16:02:00 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PocketBase]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLite]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14488</guid>

					<description><![CDATA[Introduction When developing applications with Xojo, choosing the right backend is crucial for managing data efficiently. Traditionally, Xojo developers rely on SQL databases such as&#8230;]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p>When developing applications with Xojo, choosing the right backend is crucial for managing data efficiently. Traditionally, Xojo developers rely on SQL databases such as SQLite, MySQL, or PostgreSQL for their desktop, web, and mobile applications. However, there is an alternative that provides a more flexible and modern approach to backend development: <a href="https://pocketbase.io/" target="_blank" rel="noreferrer noopener">PocketBase</a>.</p>



<p>PocketBase is an open-source backend perfect for your multi-platform Xojo application. It offers a simple-to-use API and a built-in admin panel to manage the data from any web browser. No other tool such as MySQL, Workbench, or SQL Studio is needed. In this post, I will explain how it compares to traditional SQL databases and demonstrate how to integrate it into a Xojo project.</p>



<h3 class="wp-block-heading">Why Choose PocketBase for Your Xojo App Backend?</h3>



<p>PocketBase is a lightweight, self-hosted backend designed for simplicity and flexibility. Unlike traditional SQL databases that require a separate backend service or API layer, PocketBase is an all-in-one solution that combines the database and API.</p>



<h3 class="wp-block-heading">Key Features:</h3>



<p>Embedded Database – Powered by SQLite, eliminating the need for a separate database server.</p>



<p>Built-in User Authentication – Supports email/password logins, OAuth2 sign-ups, and one-time password (OTP) with minimal setup.</p>



<p>File Storage – Store and retrieve files locally or via S3.</p>



<p>Cross-Platform Compatibility – Runs on macOS, Windows, and Linux. Can communicate via URLConnection making it ideal for Xojo’s desktop, web, and mobile platforms.</p>



<p>Easy Deployment – A single binary file that can be self-hosted or deployed anywhere with minimal configuration.</p>



<h2 class="wp-block-heading">Setting Up PocketBase for a Xojo App</h2>



<p>To get started, I have simplified some steps below. If you get stuck or want more in-depth instructions take a look at the <a href="https://pocketbase.io/docs/" target="_blank" rel="noreferrer noopener">documentation</a>.</p>



<ul class="wp-block-list">
<li>Download PocketBase
<ul class="wp-block-list">
<li>Visit <a href="https://pocketbase.io/" target="_blank" rel="noreferrer noopener">PocketBase</a> and download the latest release for your operating system.</li>



<li>Extract the files to your project directory.</li>
</ul>
</li>



<li>Run PocketBase
<ul class="wp-block-list">
<li>Start the PocketBase server by navigating to the extracted folder in the command prompt/terminal.</li>



<li>Run the command: <code>./pocketbase serve</code> to start the server.</li>
</ul>
</li>



<li>Access the Admin Panel
<ul class="wp-block-list">
<li>Open <code>http://127.0.0.1:8090/_/</code> in a web browser and set up an admin account.</li>
</ul>
</li>



<li>Add a User
<ul class="wp-block-list">
<li>In the PocketBase admin panel, create a new record in the users collection. (Collections are the equivalent of a table in SQL.)</li>
</ul>
</li>
</ul>



<h2 class="wp-block-heading">Connect Xojo to PocketBase</h2>



<p>Now that your PocketBase server is running, integrate authentication into your Xojo desktop app. In this example, we will handle authentication in the open event of the main window. This will demonstrate how Xojo interacts with PocketBase’s authentication API.</p>



<h3 class="wp-block-heading">Implement the Login Request</h3>



<p>Add the following code to the open event of your main window:</p>



<pre class="wp-block-code"><code>Var userEmail As String = "email@email.com"
Var userPassword As String = "MyPassword!"
Var loginURL As String = "http://127.0.0.1:8090" + "/api/collections/users/auth-with-password"
Var conn As New URLConnection
conn.RequestHeader("Content-Type") = "application/json"
 
Var loginPayload As New JSONItem
loginPayload.Value("identity" ) = userEmail
loginPayload.Value("password") = userPassword
conn.SetRequestContent(loginPayload.ToString, "application/json")
 
Var loginResponse As String = conn.SendSync("POST", loginURL)
Var jsonResponse As New JSONItem(loginResponse)
Var userInfo As JSONItem = jsonResponse.Lookup("record", New JSONItem)
Var userID As String = userInfo.Lookup("id", "")
Var authToken As String = jsonResponse.Lookup("token", "")
 
If authToken.Length > 0 Then
  MessageBox("Login successful! Welcome, User ID: " + userID)
Else
  MessageBox("Login failed. Please check your credentials.")
End If</code></pre>



<h3 class="wp-block-heading">Update Your Credentials and URL</h3>



<p>Replace userEmail and userPassword with the credentials you used to create a user in PocketBase. Also, ensure the loginURL matches your PocketBase instance (without <code>/_/</code> at the end).</p>



<h3 class="wp-block-heading">Run The App</h3>



<p>Launch your Xojo app. If authentication is successful, a message box will display the user&#8217;s ID. Otherwise, you will see an error message indicating that the credentials are incorrect.</p>



<h3 class="wp-block-heading">Wrapping Up</h3>



<p>In this article, you have successfully set up a PocketBase server, created a record, and integrated authentication into your Xojo app. PocketBase simplifies backend development by handling authentication and data storage—all without the need for a traditional SQL database.</p>



<p>With PocketBase, there is no need to set up complex user tables, hash passwords, or build a custom API. Collections can be easily managed directly from the web via the admin panel. This means you can spend less time managing infrastructure and more time focusing on bringing your app to market.</p>



<p>To help you get started, I’ve created a collection of example projects, which you can find here:</p>



<p><a href="https://github.com/Iron-Elephant-Solutions/Xojo-Pocketbase-Examples">Xojo-Pocketbase-Examples</a></p>



<p>If you’d like to discuss how Iron Elephant Solutions has used Xojo and PocketBase in real-world applications, feel free to reach out through our <a href="https://ironelephantsolutions.com/">website</a> or add me on <a href="https://www.linkedin.com/in/ezekiel-zeke-burke/">LinkedIn</a>.</p>



<p><a href="https://www.linkedin.com/in/ezekiel-zeke-burke/overlay/about-this-profile/" target="_blank" rel="noreferrer noopener">Ezekiel Burke</a><em> is the founder of <a href="https://ironelephantsolutions.com/" target="_blank" rel="noreferrer noopener">Iron Elephant Solutions</a>. He focuses on building custom, scalable, and affordable software that helps businesses work smarter. With 15+ years of experience, he specializes in full-stack development, process automation and systems integration, creating solutions that simplify complex workflows.</em></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Year of Code 2025: February Project, Database Apps</title>
		<link>https://blog.xojo.com/2025/02/11/year-of-code-2025-february-project/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 11 Feb 2025 16:48:26 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Year of Code]]></category>
		<category><![CDATA[#YearofCode]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Database Applications]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14441</guid>

					<description><![CDATA[February&#8217;s&#160;Year of Code 2025&#160;topic is Databases and my project is a SQLite object-relation mapping library that I call Storm. I first created Storm in 2008&#8230;]]></description>
										<content:encoded><![CDATA[
<p>February&#8217;s&nbsp;<a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/" target="_blank" rel="noreferrer noopener">Year of Code 2025</a>&nbsp;topic is Databases and my project is a SQLite object-relation mapping library that I call Storm.</p>



<p>I first created Storm in 2008 when I was working on consulting projects as a way to more rapidly create database apps for clients. It has been updated over the years and the latest version is available on GitHub:</p>



<p><a href="https://github.com/paullefebvre/storm">Storm</a></p>



<p>An ORM lets you write code like this to set database column values and save them:</p>



<pre class="wp-block-code"><code>Var dodgers As New Team
dodgers.Name = "LA Dodgers"
dodgers.Coach = "Dave Roberts"
dodgers.Save</code></pre>



<p>Team is a table in the database with a corresponding class in Xojo that inherits from Storm.DBObject.</p>



<p>The included demo projects shows how you can implement a simple UI for a database with Team and Player tables.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="851" src="https://blog.xojo.com/wp-content/uploads/2025/02/CleanShot-2025-02-04-at-16.45.54@2x-1024x851.png" alt="" class="wp-image-14445" style="width:550px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2025/02/CleanShot-2025-02-04-at-16.45.54@2x-1024x851.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/02/CleanShot-2025-02-04-at-16.45.54@2x-300x249.png 300w, https://blog.xojo.com/wp-content/uploads/2025/02/CleanShot-2025-02-04-at-16.45.54@2x-768x639.png 768w, https://blog.xojo.com/wp-content/uploads/2025/02/CleanShot-2025-02-04-at-16.45.54@2x.png 1424w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>The docs for Storm are contained within its <a href="https://github.com/paullefebvre/storm/wiki">Github repository wiki</a>.</p>



<p>In addition to accessing the full repository on GitHub, you can also download <a href="https://github.com/paullefebvre/storm/archive/refs/tags/v1.2.1.zip">Storm as a ZIP</a>.</p>



<p>I’ve created a&nbsp;<a href="https://forum.xojo.com/t/2025-year-of-code-february/84239">forum topic</a>&nbsp;for you to start sharing your Year of Code projects and I’ll also be sure to include this one as well. Remember, <a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/">participants can win a $100</a> to use in the Xojo Store!</p>



<p><em>Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at <a href="https://goto10.substack.com" target="_blank" rel="noreferrer noopener">Goto 10</a> and </em>on Mastodon @lefebvre@hachyderm.io.</p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>



<p><strong>Year of Code Project</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/">Year of Code: Kickoff</a></li>



<li><a href="https://blog.xojo.com/2025/01/15/year-of-code-2025-january-project/" target="_blank" rel="noreferrer noopener">January Project: Desktop Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/year-of-code-2025-january-project-sharing/83927" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/02/11/year-of-code-2025-february-project/">February Project: Database Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/2025-year-of-code-february" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/03/05/year-of-code-2025-march-project-web-apps/">March Project: Web Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-march/84474?u=alyssa_foley">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/04/08/year-of-code-2025-april-project-user-interface/">April Project: User Interface</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-april-user-interface/84926">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/05/07/year-of-code-2025-may-project-mobile-apps/">May Project: Mobile Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-may-is-mobile/85272">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/06/10/year-of-code-2025-june-project-cross-platform-code-class/">June Project: Code Sharing</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-june-is-code-sharing/85612">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/07/10/year-of-code-2025-july-project-charting/">July Project: Charting</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-july-is-charting/85896">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/08/07/year-of-code-2025-august-project-console-apps/">August Project: Console Apps</a> | <a href="https://forum.xojo.com/t/august-2025-year-of-code-console-apps/86203">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/09/08/year-of-code-2025-september-project-games/">September Project: Games</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-septgamer">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/10/13/year-of-code-2025-october-project-multi-platform-communication/">October Project: Multi-Platform</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-october-multi-platform-communication/86717">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/11/10/year-of-code-2025-november-project-pdf-postcard-generator/">November Project: PDF</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-november-pdf/86969">Forum Discussion</a></li>
</ul>



<p><strong>How to Play:</strong></p>



<p>Each month we&#8217;ll announce a new theme and share an example project of our own. Share your projects to the Xojo Forum thread for that month via GitHub (all the links you need are posted above ↑ ). Learn how to use <a href="https://blog.xojo.com/2024/04/02/using-xojo-and-github/">Xojo and GitHub</a>.</p>



<p><strong>The Prizes:</strong></p>



<p>Monthly winners get $100 at the Xojo store. Every month you submit a project is another chance to win the grand prize. The grand prize is $250 cash plus a Xojo Pro license and a year of GraffitiSuite and will be announce in December. Learn more about the <a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/#prizes">prizes</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Year of Code 2025: January Project, Desktop Apps</title>
		<link>https://blog.xojo.com/2025/01/15/year-of-code-2025-january-project/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 15 Jan 2025 19:26:16 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Year of Code]]></category>
		<category><![CDATA[#YearofCode]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14380</guid>

					<description><![CDATA[January&#8217;s Year of Code 2025 topic is Desktop apps and my project is XojoText. XojoText is a simple text editor that lets you edit multiple&#8230;]]></description>
										<content:encoded><![CDATA[
<p>January&#8217;s <a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/" target="_blank" rel="noreferrer noopener">Year of Code 2025</a> topic is Desktop apps and my project is XojoText.</p>



<p>XojoText is a simple text editor that lets you edit multiple files in one window with a list of files in the left sidebar. You can create new blank documents, documents from a selection in another document or from the clipboard.</p>



<p>It is based on the XojoText example that is included with Xojo, but enhanced in these ways:</p>



<ul class="wp-block-list">
<li>Word, character, line counts shown at bottom of editing area.</li>



<li>Recent Items menu.</li>



<li>Window menu.</li>



<li>Saves window position.</li>



<li>Prompts to sae changes.</li>



<li>Contextual menu on files in the sidebar.</li>



<li>Click “x” to close files in the sidebar.</li>
</ul>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="783" src="https://blog.xojo.com/wp-content/uploads/2025/01/image-6-1024x783.png" alt="" class="wp-image-14381" srcset="https://blog.xojo.com/wp-content/uploads/2025/01/image-6-1024x783.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/01/image-6-300x230.png 300w, https://blog.xojo.com/wp-content/uploads/2025/01/image-6-768x588.png 768w, https://blog.xojo.com/wp-content/uploads/2025/01/image-6-1536x1175.png 1536w, https://blog.xojo.com/wp-content/uploads/2025/01/image-6.png 1694w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Suggestions for improvements and things to add:</p>



<ul class="wp-block-list">
<li>Find/Replace capability.</li>



<li>Printing.</li>



<li>PDF generation.</li>
</ul>



<p>I&#8217;ve created a <a href="https://forum.xojo.com/t/year-of-code-2025-january-project-sharing/83927" target="_blank" rel="noreferrer noopener">forum topic</a> for you to start sharing your Year of Code projects and I&#8217;ll also be sure to include this one as well.</p>



<p>You can download the XojoText project from GitHub here: <a href="https://github.com/paullefebvre/XojoText" target="_blank" rel="noreferrer noopener">https://github.com/paullefebvre/XojoText</a></p>



<p><em>Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at <a href="https://goto10.substack.com" target="_blank" rel="noreferrer noopener">Goto 10</a> and </em>on Mastodon @lefebvre@hachyderm.io.</p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>



<p><strong>Year of Code Project</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/">Year of Code: Kickoff</a></li>



<li><a href="https://blog.xojo.com/2025/01/15/year-of-code-2025-january-project/" target="_blank" rel="noreferrer noopener">January Project: Desktop Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/year-of-code-2025-january-project-sharing/83927" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/02/11/year-of-code-2025-february-project/">February Project: Database Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/2025-year-of-code-february" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/03/05/year-of-code-2025-march-project-web-apps/">March Project: Web Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-march/84474?u=alyssa_foley">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/04/08/year-of-code-2025-april-project-user-interface/">April Project: User Interface</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-april-user-interface/84926">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/05/07/year-of-code-2025-may-project-mobile-apps/">May Project: Mobile Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-may-is-mobile/85272">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/06/10/year-of-code-2025-june-project-cross-platform-code-class/">June Project: Code Sharing</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-june-is-code-sharing/85612">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/07/10/year-of-code-2025-july-project-charting/">July Project: Charting</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-july-is-charting/85896">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/08/07/year-of-code-2025-august-project-console-apps/">August Project: Console Apps</a> | <a href="https://forum.xojo.com/t/august-2025-year-of-code-console-apps/86203">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/09/08/year-of-code-2025-september-project-games/">September Project: Games</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-septgamer">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/10/13/year-of-code-2025-october-project-multi-platform-communication/">October Project: Multi-Platform</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-october-multi-platform-communication/86717">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/11/10/year-of-code-2025-november-project-pdf-postcard-generator/">November Project: PDF</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-november-pdf/86969">Forum Discussion</a></li>
</ul>



<p><strong>How to Play:</strong></p>



<p>Each month we&#8217;ll announce a new theme and share an example project of our own. Share your projects to the Xojo Forum thread for that month via GitHub (all the links you need are posted above ↑ ). Learn how to use <a href="https://blog.xojo.com/2024/04/02/using-xojo-and-github/">Xojo and GitHub</a>.</p>



<p><strong>The Prizes:</strong></p>



<p>Monthly winners get $100 at the Xojo store. Every month you submit a project is another chance to win the grand prize. The grand prize is $250 cash plus a Xojo Pro license and a year of GraffitiSuite and will be announce in December. Learn more about the <a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/#prizes">prizes</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Year of Code 2025: Kickoff</title>
		<link>https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 09 Jan 2025 16:30:00 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Year of Code]]></category>
		<category><![CDATA[#JustCode]]></category>
		<category><![CDATA[#YearofCode]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Educational]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14122</guid>

					<description><![CDATA[Xojo is kicking off 2025 with something for everyone in the Xojo community, an event that will help new users grow their Xojo coding skills&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Xojo is kicking off 2025 with something for everyone in the Xojo community, an event that will help new users grow their Xojo coding skills and existing users polish theirs. Back in 2018, we did a &#8220;<a href="https://blog.xojo.com/2018/06/18/jump-right-in-just-code-challenge/" target="_blank" rel="noreferrer noopener">Summer of Code</a>&#8221; contest that challenged people to create one project a week through the summer. This was a lot of fun and many interesting apps were made that summer. For 2025, we have expanded that idea out to the entire year! However, instead of one app a week, we will make one app a month from January to November 2025. In December we will give away a grand prize!</p>



<h3 class="wp-block-heading">The Idea </h3>



<p>Early each month we will share a blog post that introduces an app &#8220;theme&#8221; and recaps the prior month. A week or so later, we will create a Forum topic and post an example project created by one of the Xojo team. To participate in the Year of Code, make a Xojo project that that demonstrates the theme in some way, share it on GitHub to make it easily accessible to everyone and then add a post about it (with your GitHub link) to the Forum topic.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>If you have not used GitHub before, here is a <a href="https://blog.xojo.com/2024/04/02/using-xojo-and-github/" target="_blank" rel="noreferrer noopener">blog post on how to share a Xojo project on GitHub</a>.</p>
</blockquote>



<p>Ideally, these will be small, focused apps that can be made in a few days. The idea is to have fun creating something that others might learn from. But I guarantee you&#8217;ll learn something as well. After all, the best way to get better at coding is to always be coding.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1024" height="640" src="https://blog.xojo.com/wp-content/uploads/2025/01/image-1.png" alt="" class="wp-image-14306" srcset="https://blog.xojo.com/wp-content/uploads/2025/01/image-1.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/01/image-1-300x188.png 300w, https://blog.xojo.com/wp-content/uploads/2025/01/image-1-768x480.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading" id="participate">How To Participate</h3>



<p>Each month Xojo will announce a new theme and share an example project. Share your own projects in the Xojo Forum thread for that month via GitHub, preferably. Projects with code shared at other sites can be eligible as long as the code is accessible to everyone. Learn how to use&nbsp;<a href="https://blog.xojo.com/2024/04/02/using-xojo-and-github/">Xojo and GitHub</a>.</p>



<h3 class="wp-block-heading" id="prizes">The Prizes</h3>



<p>And yes, there will be prizes for those that participate. Each month all participants (everyone who shares a project that month) will be entered for a chance to win a monthly prize of $100 at the Xojo Store plus a 25% off coupon for GraffitiSuite.<sup data-fn="475ca43b-7f55-4b9d-8f49-dc8378c3dec1" class="fn"><a href="#475ca43b-7f55-4b9d-8f49-dc8378c3dec1" id="475ca43b-7f55-4b9d-8f49-dc8378c3dec1-link">1</a></sup> The $100 can be applied to any Xojo license purchase or Extras Store item. At the end of 2025, all participants from the year will be entered to win the grand prize of a Xojo Pro license, $250 cash and a free year of GraffitiSuite. The more months in which you participate throughout the year, the more chances you&#8217;ll have to win the grand prize.</p>



<h3 class="wp-block-heading">January&#8217;s Theme</h3>



<p>Now that it is January (Happy New Year, everyone), the 2025 Year of Code kicks off with this theme: <strong>Desktop apps</strong>. People have used Xojo to make wonderful desktop apps since its inception in 1998 so this is an ideal first theme that is broad enough to allow anyone to participate. Look for a post next week announcing this months&#8217; project details. Once it is posted, I will start a forum topic for others to share GitHub links to their projects and apps. In early February we will do a blog post that highlights what people made this month and introduce February&#8217;s theme.</p>



<p>I hope you will join us for the 2025 Year of Code and I look forward to seeing what you make with Xojo!</p>



<p>#2025YearOfCode</p>


<ol class="wp-block-footnotes"><li id="475ca43b-7f55-4b9d-8f49-dc8378c3dec1">Monthly winners are excluded from future <em>monthly</em> prizes but each monthly participant earns an additional entry into the grand prize drawing. <a href="#475ca43b-7f55-4b9d-8f49-dc8378c3dec1-link" aria-label="Jump to footnote reference 1"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/21a9.png" alt="↩" class="wp-smiley" style="height: 1em; max-height: 1em;" />︎</a></li></ol>


<p><strong>Year of Code Project</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/">Year of Code: Kickoff</a></li>



<li><a href="https://blog.xojo.com/2025/01/15/year-of-code-2025-january-project/" target="_blank" rel="noreferrer noopener">January Project: Desktop Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/year-of-code-2025-january-project-sharing/83927" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/02/11/year-of-code-2025-february-project/">February Project: Database Apps</a>&nbsp;|&nbsp;<a href="https://forum.xojo.com/t/2025-year-of-code-february" target="_blank" rel="noreferrer noopener">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/03/05/year-of-code-2025-march-project-web-apps/">March Project: Web Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-march/84474?u=alyssa_foley">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/04/08/year-of-code-2025-april-project-user-interface/">April Project: User Interface</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-april-user-interface/84926">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/05/07/year-of-code-2025-may-project-mobile-apps/">May Project: Mobile Apps</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-may-is-mobile/85272">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/06/10/year-of-code-2025-june-project-cross-platform-code-class/">June Project: Code Sharing</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-june-is-code-sharing/85612">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/07/10/year-of-code-2025-july-project-charting/">July Project: Charting</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-july-is-charting/85896">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/08/07/year-of-code-2025-august-project-console-apps/">August Project: Console Apps</a> | <a href="https://forum.xojo.com/t/august-2025-year-of-code-console-apps/86203">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/09/08/year-of-code-2025-september-project-games/">September Project: Games</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-septgamer">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/10/13/year-of-code-2025-october-project-multi-platform-communication/">October Project: Multi-Platform</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-october-multi-platform-communication/86717">Forum Discussion</a></li>



<li><a href="https://blog.xojo.com/2025/11/10/year-of-code-2025-november-project-pdf-postcard-generator/">November Project: PDF</a> | <a href="https://forum.xojo.com/t/2025-year-of-code-november-pdf/86969">Forum Discussion</a></li>
</ul>



<p><strong>How to Play:</strong></p>



<p>Each month we&#8217;ll announce a new theme and share an example project of our own. Share your projects to the Xojo Forum thread for that month via GitHub (all the links you need are posted above ↑ ). Learn how to use <a href="https://blog.xojo.com/2024/04/02/using-xojo-and-github/">Xojo and GitHub</a>.</p>



<p><strong>The Prizes:</strong></p>



<p>Monthly winners get $100 at the Xojo store. Every month you submit a project is another chance to win the grand prize. The grand prize is $250 cash plus a Xojo Pro license and a year of GraffitiSuite and will be announce in December. Learn more about the <a href="https://blog.xojo.com/2025/01/09/year-of-code-2025-kickoff/#prizes">prizes</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Conditional Statements: Select Case vs. If…Else Explained</title>
		<link>https://blog.xojo.com/2024/12/16/conditional-statements-select-case-vs-ifelse-explained/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Mon, 16 Dec 2024 19:00:00 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Conditional Statements]]></category>
		<category><![CDATA[Decision Making in Code]]></category>
		<category><![CDATA[If Else Statement]]></category>
		<category><![CDATA[Learn to Code]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Select Case Statement]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14206</guid>

					<description><![CDATA[When you&#8217;re writing code, you often need to make decisions based on different situations. These decisions are handled using&#160;conditional statements. Conditional statements let your program&#8230;]]></description>
										<content:encoded><![CDATA[
<p>When you&#8217;re writing code, you often need to make decisions based on different situations. These decisions are handled using&nbsp;conditional statements. Conditional statements let your program choose what code to run based on whether certain conditions are true or false. Two of the main ways to do this are:&nbsp;<strong><a href="https://documentation.xojo.com/api/language/select_case.html" target="_blank" rel="noreferrer noopener">Select Case</a></strong>&nbsp;and&nbsp;<strong><a href="https://documentation.xojo.com/api/language/if...then...else.html" target="_blank" rel="noreferrer noopener">If&#8230;Else</a></strong>&nbsp;statements. They both help your program decide what to do, but they work a bit differently. This article will explain how each statement works, when to use them, and how to choose the best one for your code.</p>



<h2 class="wp-block-heading">The If&#8230;Else Statement</h2>



<p>You&#8217;ve probably seen&nbsp;<code>If...Else</code>&nbsp;statements in other programming languages too. They&#8217;re like the basic building blocks for making decisions in your code. The main strength of&nbsp;<code>If...Else</code>&nbsp;is that it&#8217;s very flexible. It lets you check if something is true or false and then do different things based on the answer.</p>



<p>You can also combine conditions using&nbsp;<code>And</code>&nbsp;and&nbsp;<code>Or</code>.</p>



<ul class="wp-block-list">
<li><code>And</code>: Checks if&nbsp;<em>both</em>&nbsp;conditions are true. For example,&nbsp;<code>If age &gt; 18 And hasLicense = True Then</code>&nbsp;(You need to be over 18&nbsp;<em>and</em>&nbsp;have a license).</li>



<li><code>Or</code>: Checks if&nbsp;<em>at least one</em>&nbsp;of the conditions is true. For example,&nbsp;<code>If score &gt; 90 Or extraCredit = True Then</code>&nbsp;(You can get an A if your score is over 90&nbsp;<em>or</em>&nbsp;if you did extra credit).</li>
</ul>



<p>You can even add more options using&nbsp;<code>ElseIf</code>&nbsp;to create more complex sets of rules. Think of it like a choose-your-own-adventure book where the story changes based on your choices.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<p><strong>Pros of If&#8230;Else:</strong></p>



<ul class="wp-block-list">
<li><strong>Flexibility:</strong>&nbsp;Handles all sorts of situations, even complicated ones where you need to check many things at once.</li>



<li><strong>Suitable for Two-Outcome Scenarios:</strong>&nbsp;Perfect when you just need a simple true/false check.</li>
</ul>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<p><strong>Cons of If&#8230;Else:</strong></p>



<ul class="wp-block-list">
<li><strong>Readability:</strong>&nbsp;When you have lots of&nbsp;<code>ElseIf</code>&nbsp;parts, the code can get really long and confusing, like a maze with too many turns.</li>



<li><strong>Maintainability:</strong>&nbsp;Changing a big&nbsp;<code>If...Else</code>&nbsp;statement can be tricky. It&#8217;s easy to make a mistake and mess up how the code works without realizing it.</li>
</ul>
</div>
</div>



<p><strong>Example:</strong></p>



<pre class="wp-block-code"><code>Var age As Integer = 25
Var message As String

If age &lt; 18 Then
  message = "Minor"
ElseIf age &gt;= 18 And age &lt; 65 Then
  message = "Adult"
Else
  message = "Senior"
End If

System.DebugLog(message)</code></pre>



<h2 class="wp-block-heading">The Select Case Statement</h2>



<p>The&nbsp;<code>Select Case</code>&nbsp;statement is like a neat and organized way to deal with a list of options for one thing. Imagine you have a variable, like a number grade.&nbsp;<code>Select Case</code>&nbsp;lets you check that grade against different cases (like &#8220;A&#8221;, &#8220;B&#8221;, &#8220;C&#8221;) and then do something specific for each grade.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p><strong>Example:</strong></p>



<pre class="wp-block-code"><code>Var grade As String = "B"
Var feedback As String

Select Case grade
Case "A"
  feedback = "Excellent"
Case "B"
  feedback = "Good"
Case "C"
  feedback = "Fair"
Case "D", "F"
  feedback = "Needs Improvement"
Else
  feedback = "Invalid Grade" // This is the default case
End Select

System.DebugLog(feedback)</code></pre>
</div></div>



<p>The<strong>&nbsp;</strong><code>Else</code>&nbsp;Case&nbsp;In a&nbsp;<code>Select Case</code>&nbsp;statement, acts like a default. If none of the other cases match the value you&#8217;re checking, the code inside&nbsp;<code>Else</code>&nbsp;will run.</p>



<p><strong>Using Ranges in&nbsp;</strong><code>Select Case</code></p>



<p>You can also check for ranges of values using&nbsp;<code>To</code>. For example:</p>



<pre class="wp-block-code"><code>Var score As Integer = 85
Var grade As String

Select Case score
Case 90 To 100
  grade = "A"
Case 80 To 89
  grade = "B"
Case 70 To 79
  grade = "C"
Case Else
  grade = "D" 
End Select

System.DebugLog(grade)</code></pre>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<p><strong>Pros of Select Case:</strong></p>



<ul class="wp-block-list">
<li><strong>Readability:</strong>&nbsp;Makes your code super clear when you&#8217;re dealing with multiple options for a single thing.</li>



<li><strong>Maintainability:</strong>&nbsp;It&#8217;s easy to add, remove, or change the different options without messing up the rest of your code.</li>



<li><strong>Efficiency:</strong>&nbsp;Sometimes,&nbsp;<code>Select Case</code>&nbsp;can be faster than a long&nbsp;<code>If...Else</code>&nbsp;chain.</li>
</ul>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<p><strong>Cons of Select Case:</strong></p>



<ul class="wp-block-list">
<li><strong>Only Works with One Thing at a Time:</strong>&nbsp;It&#8217;s mostly for checking one variable or one simple calculation against a list of possibilities.</li>



<li><strong>Less Flexible:</strong>&nbsp;It&#8217;s not great when you need to check lots of different things at once or do complicated comparisons.</li>



<li><strong>Range limitations:</strong>&nbsp;If you are comparing ranges of numbers, you have to be careful about the order of your cases.</li>
</ul>
</div>
</div>



<h2 class="wp-block-heading">When to Use Which</h2>



<ul class="wp-block-list">
<li><strong>Use&nbsp;</strong><code>If...Else</code>&nbsp;when:
<ul class="wp-block-list">
<li>You only need to check if something is true or false.</li>



<li>You need to check many different things at the same time using &#8220;and&#8221; or &#8220;or&#8221;.</li>



<li>You need the most flexibility to handle all sorts of situations.</li>
</ul>
</li>



<li><strong>Use&nbsp;</strong><code>Select Case</code>&nbsp;when:
<ul class="wp-block-list">
<li>You&#8217;re checking one thing against a list of possible values.</li>



<li>You want your code to be super clear and easy to understand.</li>



<li>You want a neat way to organize different options.</li>
</ul>
</li>
</ul>



<p><strong>Best Practices</strong></p>



<ul class="wp-block-list">
<li><strong>Use meaningful names:</strong>&nbsp;Choose names for your variables that clearly describe what they store (e.g.,&nbsp;<code>studentAge</code>&nbsp;instead of just&nbsp;<code>age</code>).</li>



<li><strong>Keep it short:</strong>&nbsp;Try to keep the code blocks within your&nbsp;<code>If...Else</code>&nbsp;or&nbsp;<code>Select Case</code>&nbsp;statements relatively short and focused. If a block gets too long, consider breaking it down into smaller parts.</li>



<li><strong>Comment your code:</strong>&nbsp;Add comments to explain what your code is doing, especially in complex&nbsp;<code>If...Else</code>&nbsp;statements. This will help others (and your future self) understand your code.</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Both&nbsp;<code>Select Case</code>&nbsp;and&nbsp;<code>If...Else</code>&nbsp;are useful tools for making decisions in your code. Choosing the right one depends on what you need your code to do.&nbsp;<code>If...Else</code>&nbsp;is great for handling complicated situations, while&nbsp;<code>Select Case</code> is perfect for keeping things clear when you have a list of options. Knowing when to use each one will help you write better code that is easier to understand and work with. By thinking about what you need to check and how clear you want your code to be, you can use both of these statements to create awesome apps!</p>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-default"/>



<h3 class="wp-block-heading">Update</h3>



<p>Since the time this article was published, our great Xojo community has taken the discussion even further! On the Xojo Forum, developers have shared advanced examples, creative use cases, and expert tips for using If…Else and Select Case statements.</p>



<p>Be sure to check out the thread here: <a href="https://forum.xojo.com/t/re-if-then-vs-select-case/83633" target="_blank" rel="noreferrer noopener">https://forum.xojo.com/t/re-if-then-vs-select-case/83633</a></p>



<p>We’re continually inspired by the passion and knowledge of our community—thank you for making Xojo such a collaborative and supportive space!</p>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Code Editor Selection Matching</title>
		<link>https://blog.xojo.com/2024/12/10/code-editor-selection-matching/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 10 Dec 2024 16:37:25 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[2024r4]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Code Editor]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13949</guid>

					<description><![CDATA[A new feature of the Xojo Code Editor is Selection Matching. When this feature is turned on, selected text is highlighted everywhere it appears in&#8230;]]></description>
										<content:encoded><![CDATA[
<p>A new feature of the Xojo Code Editor is Selection Matching. When this feature is turned on, selected text is highlighted everywhere it appears in the current Code Editor.</p>



<p>Here you can see that &#8220;customerRS&#8221; is selected on line 14 and all the other places where it appears in the method is also highlighted.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="752" src="https://blog.xojo.com/wp-content/uploads/2024/10/image-8-1024x752.png" alt="" class="wp-image-13950" srcset="https://blog.xojo.com/wp-content/uploads/2024/10/image-8-1024x752.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/10/image-8-300x220.png 300w, https://blog.xojo.com/wp-content/uploads/2024/10/image-8-768x564.png 768w, https://blog.xojo.com/wp-content/uploads/2024/10/image-8.png 1522w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>This feature can be very handy to see how things are used in your code and is much easier than using the Find panel.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Note: The matching is done by full word tokens. So if you highlighted just &#8220;customer&#8221; in the above code, then nothing is matched because that does not match the &#8220;customerRS&#8221; tokens.</p>
</blockquote>



<p>To turn this feature on, head over to Settings, Coding and check the box for &#8220;Display selection matches&#8221;.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="914" src="https://blog.xojo.com/wp-content/uploads/2024/10/image-9-1024x914.png" alt="" class="wp-image-13951" srcset="https://blog.xojo.com/wp-content/uploads/2024/10/image-9-1024x914.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/10/image-9-300x268.png 300w, https://blog.xojo.com/wp-content/uploads/2024/10/image-9-768x686.png 768w, https://blog.xojo.com/wp-content/uploads/2024/10/image-9-1536x1371.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/10/image-9.png 1624w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>You can also change the color that is used for the matching by changing the Syntax color &#8220;Selection Match Color&#8221;.</p>



<p><em>Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at <a href="https://goto10.substack.com" target="_blank" rel="noreferrer noopener">Goto 10</a> and </em>on Mastodon @lefebvre@hachyderm.io.</p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Everything You Need to Know About Variants in Xojo</title>
		<link>https://blog.xojo.com/2024/10/10/everything-you-need-to-know-about-variants-in-xojo/</link>
		
		<dc:creator><![CDATA[Martin T.]]></dc:creator>
		<pubDate>Thu, 10 Oct 2024 16:45:00 +0000</pubDate>
				<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Data Type]]></category>
		<category><![CDATA[Variants]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13893</guid>

					<description><![CDATA[One of the most interesting features in Xojo is the Variant data type. We will explore the so-called “Implicit Conversions,” discuss the pros and cons&#8230;]]></description>
										<content:encoded><![CDATA[
<p>One of the most interesting features in Xojo is the Variant data type. We will explore the so-called “Implicit Conversions,” discuss the pros and cons of using Variants, and analyze when it makes sense to use this data type.</p>



<p>For more detailed information, you can refer to the official Xojo documentation on <a href="https://documentation.xojo.com/api/data_types/variant.html" target="_blank" rel="noreferrer noopener">Variants</a>.</p>



<h2 class="wp-block-heading">What are Variants?</h2>



<p>A Variant in Xojo is a data type that can store any type of data. This means that a variable of type Variant can take on different data types without needing to be explicitly converted. This can be very useful when you want to be flexible, but it can also lead to unexpected problems if not handled correctly.</p>



<p>Basic Example</p>



<pre class="wp-block-code"><code>Var dynamicValue As Variant

dynamicValue = 42                              // Integer
dynamicValue = "Hello"                         // String
dynamicValue = 3.14                            // Double
dynamicValue = True                            // Boolean
dynamicValue = Color.RGB(255, 0, 0)            // Color
dynamicValue = New Dictionary("key" : "value") // Dictionary</code></pre>



<p>In the example above, you can see that dynamicValue can take on different data types without the need to explicitly change the type.</p>



<h2 class="wp-block-heading">Implicit Conversions</h2>



<p>Implicit Conversions are automatic type conversions performed by Xojo when using Variants. This means that Xojo tries to interpret the data in a Variant so that it fits the context in which it is used.</p>



<h3 class="wp-block-heading">Example of an Implicit Conversion</h3>



<pre class="wp-block-code"><code>Var dynamicValue As Variant = "123"

Var myInteger As Integer
myInteger = dynamicValue  // Implicit conversion from String to Integer</code></pre>



<p>In this example, the string “123” is automatically converted to an integer when assigned to the integer variable myInteger.</p>



<h3 class="wp-block-heading">Another Example with Data Types</h3>



<pre class="wp-block-code"><code>Var dynamicValue As Variant = "3.14159"

Var myDouble As Double
myDouble = dynamicValue  // Implicit conversion from String to Double</code></pre>



<p>Here, the string “3.14159” is automatically converted to a double. This demonstrates the flexibility of Variants and Xojo’s ability to handle different data types.</p>



<h2 class="wp-block-heading">Conversion of Floating-Point Numbers</h2>



<p>In Xojo, assigning a floating-point number to a Variant will always produce a Double. However, there are other floating-point data types such as Single, Currency, and CGFloat.</p>



<pre class="wp-block-code"><code>Var dynamicValue As Variant = 3.14

Var myDouble As Double
Var mySingle As Single
Var myCurrency As Currency
Var myCGFloat As CGFloat

myDouble = dynamicValue   // Double: 3.14
mySingle = dynamicValue   // Single 3.14 (implicitly converted)
myCurrency = dynamicValue // Currency: 3.14 (implicitly converted)
myCGFloat = dynamicValue  // CGFloat: 3.14 (implicitly converted)</code></pre>



<p>In this example, you can see that assigning dynamicValue (which contains a floating-point number) to different floating-point data types always works, with the implicit conversion performed by Xojo.</p>



<h2 class="wp-block-heading">Advantages of Implicit Conversions</h2>



<p></p>



<h3 class="wp-block-heading">Flexibility</h3>



<p>The biggest advantage of Variants is their flexibility. You can write functions that can work with different data types without requiring explicit type conversion.</p>



<h3 class="wp-block-heading">Example of a Flexible Function</h3>



<pre class="wp-block-code"><code>Function AddValues(value1 As Variant, value2 As Variant) As Variant
  Return value1 + value2
End Function

// Using the function with different data types
Var result As Variant
result = AddValues(10, 20)             // Integer addition
result = AddValues("Hello", " World")  // String concatenation
result = AddValues(3.14, 2.71)         // Double addition</code></pre>



<p>This function can work with integers, strings, and doubles without requiring changes to the code.</p>



<h3 class="wp-block-heading">Rapid Prototyping</h3>



<p>During rapid prototyping, Variants can be useful because they reduce the need to worry about type conversions.</p>



<h3 class="wp-block-heading">Example of a Quick Prototype</h3>



<pre class="wp-block-code"><code>Var quickData As Variant = "42"

If quickData &gt; 10 Then
  MessageBox("Greater than 10")
End If</code></pre>



<p>In this example, the string “42” is automatically converted to an integer to perform the comparison.</p>



<h2 class="wp-block-heading">Disadvantages of Implicit Conversions</h2>



<p></p>



<h3 class="wp-block-heading">Debugging</h3>



<p>It can be difficult to debug errors caused by incorrect type conversions. Since the conversion happens automatically, it is sometimes not obvious why a particular error occurs.</p>



<h3 class="wp-block-heading">Performance Issues</h3>



<p>Implicit conversions can lead to performance issues, especially when large amounts of data need to be converted.</p>



<h3 class="wp-block-heading">Example of Performance Issues</h3>



<pre class="wp-block-code"><code>Var dynamicValue As Variant = "9999999999"
Var myDouble As Double

For i As Integer = 1 To 1000000
  myDouble = dynamicValue  // Performance hit due to repeated conversions
Next</code></pre>



<p>In this example, the conversion is performed during each iteration of the loop, which can impact performance.</p>



<h3 class="wp-block-heading">Loss of Type Safety</h3>



<p>Another risk is the loss of type safety, which can lead to unexpected runtime errors.</p>



<h2 class="wp-block-heading">Type Property</h2>



<p>The Type property is a useful tool to determine the data type of a Variant value. This property returns an integer that corresponds to the type of the value. This can be helpful to ensure that you are handling the correct data type.</p>



<h3 class="wp-block-heading">Example of Using the Type Property</h3>



<pre class="wp-block-code"><code>Var dynamicValue As Variant = "Hello"

Select Case dynamicValue.Type
Case Variant.TypeString
  MessageBox("The variant is a String.")
Case Variant.TypeInt32, _
     Variant.TypeInt64
  MessageBox("The variant is an Integer.")
Case Variant.TypeDouble
  MessageBox("The variant is a Double.")
Case Variant.TypeBoolean
  MessageBox("The variant is a Boolean.")
Else
  MessageBox("The variant is of another type.")
End Select</code></pre>



<p>In this example, dynamicValue.Type is used to determine the type of the Variant value and perform corresponding actions.</p>



<h2 class="wp-block-heading">When Should You Use Variants? </h2>



<p></p>



<h3 class="wp-block-heading">Suitable Use Cases</h3>



<p></p>



<h3 class="wp-block-heading">Generic Functions</h3>



<p>If you are writing functions that need to work with different data types, Variants can be very useful.</p>



<pre class="wp-block-code"><code>Function CompareValues(value1 As Variant, value2 As Variant) As Boolean
  Return value1 = value2
End Function

// Using the function with different data types
Var isEqual As Boolean
isEqual = CompareValues(10, 10)          // True
isEqual = CompareValues("Hello", "Hello")  // True
isEqual = CompareValues(3.14, 2.71)      // False</code></pre>



<h3 class="wp-block-heading">Interoperability with External APIs</h3>



<p>When working with APIs or interfaces that return different data types, Variants can provide an easy way to handle this data.</p>



<pre class="wp-block-code"><code>// Example API response that can return different data types
Function GetApiResponse() As Variant
  // Simulated API response
  Return "42"  // Could also be an Integer or a JSON object
End Function

Var apiResponse As Variant = GetApiResponse

If apiResponse.Type = Variant.TypeString Then
  MessageBox("Response is a string: " + apiResponse)
ElseIf apiResponse.Type = Variant.TypeInt32 Or _
       apiResponse.Type = Variant.TypeInt64 Then
  MessageBox("Response is an integer: " + apiResponse)
End If</code></pre>



<h3 class="wp-block-heading">Data Structures</h3>



<p>In situations where you need data structures that contain different data types (e.g., an array that can contain both strings and numbers), Variants are a good choice.</p>



<pre class="wp-block-code"><code>Var dataList() As Variant
dataList.Add("Xojo")
dataList.Add(2024)
dataList.Add(True)

// Accessing different data types in the array
For Each item As Variant In dataList
  Select Case item.Type
  Case Variant.TypeString
    MessageBox("String: " + item) 
  Case Variant.TypeInt32, _
       Variant.TypeInt64
    MessageBox("Integer: " + item) 
  Case Variant.TypeBoolean
    MessageBox("Boolean: " + item)
  End Select
Next</code></pre>



<h2 class="wp-block-heading">Situations to Avoid Using Variants</h2>



<p></p>



<h3 class="wp-block-heading">Performance-Critical Applications</h3>



<p>When performance is critical, you should avoid Variants because automatic type conversion introduces additional overhead.</p>



<pre class="wp-block-code"><code>Var dynamicValue As Variant = "9999999999"
Var myDouble As Double

For i As Integer = 1 To 1000000
  myDouble = dynamicValue  // Performance hit due to repeated conversions
Next</code></pre>



<h3 class="wp-block-heading">Code Clarity and Maintainability</h3>



<p>When code readability and maintainability are paramount, you should use explicit data types to ensure that the code is understandable to other developers.</p>



<pre class="wp-block-code"><code>Var myString As String = "Hello"
Var myInteger As Integer = 123

Function ConcatenateStrings(s1 As String, s2 As String) As String
  Return s1 + s2
End Function

Var result As String
result = ConcatenateStrings(myString, myInteger.ToString)  // Clear and understandable</code></pre>



<p>The use of Variants in Xojo offers both advantages and disadvantages. While flexibility and rapid prototyping capabilities are compelling arguments, you should be aware of the potential problems that can arise from implicit conversions. Variants are best suited for scenarios where flexibility and generic programming are required. In performance-critical applications or projects that require high maintainability, it is advisable to use explicit data types such as String, Integer, Double, Boolean, Color etc. or, if you decide to use Variant, you can also have the explicit data type of the Variant delivered. To do this, use the Variant &#8230;Value properties (for example StringValue, IntegerValue, BooleanValue etc.).</p>



<p>By taking a conscious and deliberate approach to using Variants, you can leverage their advantages while avoiding potential pitfalls.</p>



<p>For more detailed information, you can refer to the official Xojo documentation on <a href="https://documentation.xojo.com/api/data_types/variant.html">https://documentation.xojo.com/api/data_types/variant.html</a>.</p>



<p><em>Martin T. is a Xojo MVP and has been very involved in testing Android support.</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>5 Xojo IDE Tips to Improve Productivity in Large Projects</title>
		<link>https://blog.xojo.com/2024/09/04/five-xojo-ide-tips-to-improve-productivity-in-large-projects/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Wed, 04 Sep 2024 16:25:49 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Code Editor]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Navigator]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13460</guid>

					<description><![CDATA[When you&#8217;re working on small to medium-sized projects, Xojo&#8217;s default IDE window view is probably all you need: all the elements of the project are&#8230;]]></description>
										<content:encoded><![CDATA[
<p>When you&#8217;re working on small to medium-sized projects, Xojo&#8217;s default IDE window view is probably all you need: all the elements of the project are in plain view and you can easily switch between them. However, things inevitably get more complex when dealing with larger projects. You may need to locate and edit several related items, larger projects likely include multiple methods, events, properties and modules, all of which may be be in their own folders created to organize their functionality or components.</p>



<p>In this article we will highlight several functions provided by the Xojo IDE that allow you to speed up and improve productivity in your large projects.</p>



<span id="more-13460"></span>



<h2 class="wp-block-heading">Filter the Navigator</h2>



<p>The Navigator <a href="https://documentation.xojo.com/getting_started/using_the_ide/navigator.html#getting-started-using-the-ide-navigator-filter" target="_blank" rel="noreferrer noopener">filter</a> field allows you to limit the number of visible items in a section to those matching the typed text. This can filter a list to include only the objects used, such as controls, or even items that match the names of events, methods, properties, constants, etc. -practically any of the items added to the project except the code itself.</p>


<div class="wp-block-image">
<figure class="aligncenter"><img loading="lazy" decoding="async" width="1035" height="794" src="https://blog.xojo.com/wp-content/uploads/2024/08/Filter.png" alt="" class="wp-image-13461" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/Filter.png 1035w, https://blog.xojo.com/wp-content/uploads/2024/08/Filter-300x230.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/Filter-1024x786.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/08/Filter-768x589.png 768w" sizes="auto, (max-width: 1035px) 100vw, 1035px" /></figure>
</div>


<p>If you need to keep all elements of your project visible while browsing through matching results, it is preferable to use the standard search which you can access using Command + F (on macOS) or Control + F (Windows and Linux).</p>



<h2 class="wp-block-heading">Going Directly to a Project Item</h2>



<p>However, there are many times when you know the exact name of the item you want to select/display; whether it&#8217;s the name of a method, event, or even a control itself. In these cases, it is much quicker to use the Project > Go to Location option (Command + Shift + L on macOS; Control + Shift + L on Windows and Linux).</p>



<p>When you select this command, a dialog box will appear where you can type the path of the item you want to select. So, for example, if you want to go to the method &#8220;myMethod&#8221; found in the window &#8220;MyWindow&#8221; you would type: &#8220;MyWindow.myMethod&#8221;. The text field in that dialog offers auto-completion which means that, in most cases, you will only have to start typing the name of the main item and use the Tab key to access the menu displaying all the matches to select any sub-item you wish to select.</p>


<div class="wp-block-image">
<figure class="aligncenter"><img loading="lazy" decoding="async" width="868" height="474" src="https://blog.xojo.com/wp-content/uploads/2024/08/GoToLocation.png" alt="" class="wp-image-13462" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/GoToLocation.png 868w, https://blog.xojo.com/wp-content/uploads/2024/08/GoToLocation-300x164.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/GoToLocation-768x419.png 768w" sizes="auto, (max-width: 868px) 100vw, 868px" /></figure>
</div>


<p>Additionally, and unlike the filter field, the hierarchy of the project elements will remain visible in the Navigator as they are.</p>



<h2 class="wp-block-heading">Powerful Searches</h2>



<p>This is undoubtedly the most powerful option that you can access using the keyboard shortcut Command + F (on macOS) or Ctrl + F (Windows, Linux), or by clicking on the magnifying glass icon in the bottom bar of the IDE.</p>



<p>Once you access the Find panel and start typing in the search field, the list below will start to populate with all the matches (by default); but you will probably find it more useful in larger projects to have the list refresh after you press the Return key. To do this, go to the Preferences window and, in the General section, change the &#8220;Find/Filter results appear&#8221; option to &#8220;After pressing Enter/Return&#8221;.</p>


<div class="wp-block-image">
<figure class="aligncenter"><img loading="lazy" decoding="async" width="1624" height="1040" src="https://blog.xojo.com/wp-content/uploads/2024/08/FindFilterPreference.png" alt="" class="wp-image-13463" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/FindFilterPreference.png 1624w, https://blog.xojo.com/wp-content/uploads/2024/08/FindFilterPreference-300x192.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/FindFilterPreference-1024x656.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/08/FindFilterPreference-768x492.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/FindFilterPreference-1536x984.png 1536w" sizes="auto, (max-width: 1624px) 100vw, 1624px" /></figure>
</div>


<p>While by default the Find window displays matches found throughout the entire project, there are times when you may want to narrow it down to either the selected item, including any subclasses that may be based on that item, or simply the item in question; you can do this by using the following buttons:</p>


<div class="wp-block-image">
<figure class="aligncenter"><img loading="lazy" decoding="async" width="188" height="74" src="https://blog.xojo.com/wp-content/uploads/2024/08/SearchOptions.png" alt="" class="wp-image-13464"/></figure>
</div>


<p>Another added advantage of the search area is that it keeps a history of previously performed searches, thus speeding up the process when you need to revisit a new group of elements. In addition, you can change from simple (textual) searches to the more powerful use of regular expressions (RegEx) when looking for elements in your project.</p>



<p>Of course, this same panel also allows you to replace the searched text with other text on all the matches shown… but be careful before confirming. Make sure that they truly apply to the elements you want and not to others just because they start with the same word entered in the search field!</p>



<h2 class="wp-block-heading">Bookmarks: Sitting There for You</h2>



<p>In many cases, you will use the above systems to edit the code in a given method or event; especially if these are areas of code that you visit frequently. If that is the case, then you will find <a href="https://documentation.xojo.com/getting_started/using_the_ide/code_editor.html#getting-started-using-the-ide-code-editor-breakpoints-and-bookmarks">Bookmarks</a> a really useful feature.</p>



<p>You can add or remove Bookmarks in the code editor by accessing the contextual menu from the currently selected line of code. You can also add as many Bookmarks as you need to a single code block, which is especially useful for large blocks of code on a given method, for example.</p>


<div class="wp-block-image">
<figure class="aligncenter"><img loading="lazy" decoding="async" width="1544" height="1048" src="https://blog.xojo.com/wp-content/uploads/2024/08/AddBookmark.png" alt="" class="wp-image-13465" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/AddBookmark.png 1544w, https://blog.xojo.com/wp-content/uploads/2024/08/AddBookmark-300x204.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/AddBookmark-1024x695.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/08/AddBookmark-768x521.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/AddBookmark-1536x1043.png 1536w" sizes="auto, (max-width: 1544px) 100vw, 1544px" /></figure>
</div>


<p>Once you have all your Bookmarks defined, you will simply need to select the menu option Bookmarks > Show All to have them displayed in the search area where you can select them.</p>



<p><strong>Tip:</strong> Use the Preferences &gt; General &gt; Menu &gt; Edit Menu Shortcuts option to assign a keyboard shortcut to the Bookmarks &gt; Show All command. This will make it quicker to update the bookmarks listed in the Search area when they are not listed.</p>



<h2 class="wp-block-heading">Tabs and Workspaces</h2>



<p>Sometimes it is preferable to have several items in view when working on a large project, so that you can switch between them quickly; or to have the Layout Editor and the Code Editor for the same object. This is where Tabs and <a href="https://documentation.xojo.com/getting_started/using_the_ide/introduction.html#getting-started-using-the-ide-introduction-workspace" data-type="link" data-id="https://documentation.xojo.com/getting_started/using_the_ide/introduction.html#getting-started-using-the-ide-introduction-workspace" target="_blank" rel="noreferrer noopener">Workspaces</a> are extremely useful.</p>



<p>By default, the Xojo IDE window has a single tab that displays all the elements added to the project, but you can open as many tabs as you need, and these tabs will be preserved when you close and reopen the same project, just as Workspaces will.</p>



<p>So, if you need to focus on a particular module or class, you can double-click on the item in the Navigator to open it in a new tab. Want more clarity, especially if your tabs bar is overcrowded? In that case, you can drag the tab in question outside the window boundaries to open it as a new IDE window (a new Workspace). Of course, you can also use keyboard shortcuts to move between open tabs in a single IDE window.</p>



<p>As you can see, Workspaces are new IDE windows for a single project. In fact, you can have as many as you need using the New &gt; Workspace menu option. However, this option is only recommended if your setup has a high-resolution screen or multiple screens connected to your computer.</p>



<h2 class="wp-block-heading">Conclusions</h2>



<p>As we have seen, using filtering, searches, bookmarks, tabs and even the &#8220;Go To Location&#8221; command, among other options mentioned, will greatly speed up navigation when you are working on large projects.</p>



<p>What other IDE techniques do you use? Share them with us on the Xojo <a href="https://forum.xojo.com/">Forum</a> or on social media.</p>



<p>Happy programming with Xojo!</p>



<p><em>Javier Menendez is an engineer at Xojo and has been using Xojo since 1998. He lives in Castellón</em>, <em>Spain and hosts regular Xojo hangouts en español. Ask Javier questions on Twitter at <a href="https://twitter.com/xojoes" target="_blank" rel="noreferrer noopener">@XojoES</a> or on the <a href="https://forum.xojo.com/u/javier_menendez/summary" target="_blank" rel="noreferrer noopener">Xojo Forum</a>.</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Minimizing Overhead in Xojo Applications: Techniques, Tips, and Tricks</title>
		<link>https://blog.xojo.com/2024/07/10/minimizing-overhead-in-xojo-applications-techniques-tips-and-tricks/</link>
		
		<dc:creator><![CDATA[Martin T.]]></dc:creator>
		<pubDate>Wed, 10 Jul 2024 14:00:00 +0000</pubDate>
				<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Code Profiling]]></category>
		<category><![CDATA[Profiler]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13295</guid>

					<description><![CDATA[In the world of software development, efficiency is a central aspect. This is especially true for applications developed in Xojo. Excessive overhead can significantly impair performance and negatively affect the user experience. In this article, we will take a detailed look at what overhead is, how to identify it, and what techniques, tips, and tricks can be used to minimize it. We will particularly focus on using code profiling.]]></description>
										<content:encoded><![CDATA[
<p>In the world of software development, efficiency is a central aspect. This is especially true for applications developed in Xojo. Excessive overhead can significantly impair performance and negatively affect the user experience. In this article, we will take a detailed look at what overhead is, how to identify it, and what techniques, tips, and tricks can be used to minimize it. We will particularly focus on using code profiling.</p>



<h2 class="wp-block-heading">What is Overhead?</h2>



<p>Overhead refers to the additional computational and memory effort that does not directly contribute to the execution of the main tasks of an application. This can arise from various factors, such as inefficient algorithms, unnecessary computations, or redundant memory allocations. High overhead can lead to slow response times and increased resource consumption.</p>



<h2 class="wp-block-heading">Identifying Overhead with Code Profiling</h2>



<p>To effectively minimize overhead, it is first important to identify it. This is where code profiling comes into play. Profiling is a runtime analysis technique that provides insight into how long certain parts of your code take to execute and how often they are called. Xojo offers integrated tools for this purpose, such as the Profiler, which gives you detailed information about your application’s performance. Code profiling is available on all targets except Android.</p>



<h3 class="wp-block-heading">Steps to Profiling in Xojo:</h3>



<ol class="wp-block-list">
<li>Activating the Profiler: Go to the menu item Project &gt; Profile Code to enable or disable the profiler.</li>



<li>Manual Profiling with <a href="https://documentation.xojo.com/api/compiler_directives/startprofiling.html">StartProfiling</a> and <a href="https://documentation.xojo.com/api/compiler_directives/stopprofiling.html">StopProfiling</a>: Use the StartProfiling and StopProfiling methods in your code to analyze specific sections.</li>



<li>Analyzing the Profiler Results: After running, you will receive a report showing which methods and functions take the most time.</li>
</ol>



<figure class="wp-block-image size-large is-style-default"><img loading="lazy" decoding="async" width="1024" height="515" src="https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-3-1024x515.png" alt="" class="wp-image-13298" srcset="https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-3-1024x515.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-3-300x151.png 300w, https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-3-768x387.png 768w, https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-3.png 1196w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large is-style-default"><img loading="lazy" decoding="async" width="1024" height="678" src="https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-2-1024x678.png" alt="" class="wp-image-13296" srcset="https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-2-1024x678.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-2-300x199.png 300w, https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-2-768x508.png 768w, https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-2-1536x1016.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/07/min-overhead-2-2048x1355.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>For more information on the Code Profiler, see the <a href="https://documentation.xojo.com/getting_started/debugging/code_profiler.html">Xojo Documentation</a>.</p>



<h2 class="wp-block-heading">Example of Manual Profiling</h2>



<p>With StartProfiling and StopProfiling, you can target specific parts of your code for profiling. Here’s a simple example:</p>



<pre class="wp-block-code"><code>Var total As Integer = 0

// Start profiling
System.DebugLog("Profiling started")
StartProfiling

For i As Integer = 0 To 1000000
  total = total + i
Next

// Stop profiling
StopProfiling
System.DebugLog("Profiling stopped")</code></pre>



<p>In this example, the profiler is activated only for the loop to analyze its performance precisely.</p>



<h2 class="wp-block-heading">Techniques to Minimize Overhead</h2>



<p>Once you have identified the areas with optimization potential, you can apply various techniques to reduce overhead:</p>



<h4 class="wp-block-heading">1. Algorithmic Optimizations:</h4>



<p>– &nbsp;Use more efficient algorithms. An O(n) solution is better than an O(n^2) solution.</p>



<p>– &nbsp;Avoid recursive algorithms when iterative solutions are available to avoid stack overhead. </p>



<h4 class="wp-block-heading">2. Memory Management:</h4>



<p>– &nbsp;Minimize unnecessary memory allocations and deallocations.</p>



<p>– &nbsp;Use local variables as much as possible and avoid global variables to reduce memory consumption. </p>



<h4 class="wp-block-heading">3. Data Structures:</h4>



<p>– &nbsp;Choose the right data structures for your requirements. For example, arrays are often faster than other structures for sequential data access.</p>



<p>– &nbsp;Use dictionaries for fast lookups as they manage key-value pairs efficiently.</p>



<h4 class="wp-block-heading">4. Asynchrony and Parallelism:</h4>



<p>– Use asynchronous programming and multithreading to perform tasks in parallel and improve the responsiveness of the user interface.</p>



<h4 class="wp-block-heading">5. Code Simplicity:</h4>



<p>– &nbsp;Write clear and simple code. Complex structures and nested loops increase overhead.</p>



<p>– &nbsp;Use Xojo’s pre-built functions and libraries, which are often more optimized than custom implementations. </p>



<h2 class="wp-block-heading">Tips and Tricks for Optimization</h2>



<h4 class="wp-block-heading">1. Lazy Loading:</h4>



<p>Load resources only when they are needed instead of loading everything at the start of the application.</p>



<h4 class="wp-block-heading">2. Caching:</h4>



<p>Implement caching mechanisms to avoid repeated computations and database queries. </p>



<h4 class="wp-block-heading">3. Avoiding Polymorphism:</h4>



<p>Polymorphic calls are often more expensive than direct function calls. Use them only when necessary. Polymorphism is a concept in object-oriented programming that allows objects of different classes to be treated through a common interface. In Xojo, this means you can define methods in a base class and override them in derived classes. However, this can add overhead as the exact method call must be resolved at runtime.</p>



<h4 class="wp-block-heading">4. Using Breakpoints and Inspectors:</h4>



<p>Set breakpoints and use the debugger inspector to check runtime data and identify inefficient parts of the code.</p>



<h2 class="wp-block-heading">Example: Optimizing a Loop</h2>



<p>Here is an example of how to optimize a loop:</p>



<pre class="wp-block-code"><code>// Unoptimized code
Var total As Integer = 0
For i As Integer = 0 To dataArray.LastIndex
  total = total + dataArray(i)
Next

// Optimized code
Var total As Integer = 0
Var lastIndex As Integer = dataArray.LastIndex
For i As Integer = 0 To lastIndex
  total = total + dataArray(i)
Next</code></pre>



<p>In this example, we moved the LastIndex method call out of the loop since repeatedly calling it creates unnecessary overhead.</p>



<p>Minimizing overhead in Xojo applications requires careful analysis and optimization of your code. By using code profiling, you can identify the areas that consume the most runtime and take targeted actions to optimize them. The techniques, tips, and tricks presented here can significantly improve the efficiency of your applications and ensure a better user experience.</p>



<p>Leverage Xojo’s powerful tools to keep your applications lean and fast, and benefit from improved performance.</p>



<p>Happy coding!</p>



<p><em>Martin T. is a Xojo MVP and has been very involved in testing Android support.</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Spotlight On: xDev Magazine</title>
		<link>https://blog.xojo.com/2024/07/08/spotlight-on-xdev-magazine/</link>
		
		<dc:creator><![CDATA[Xojo]]></dc:creator>
		<pubDate>Mon, 08 Jul 2024 18:00:00 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Spotlight On]]></category>
		<category><![CDATA[xDev Magazine]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13316</guid>

					<description><![CDATA[Launched in the summer of 2002, xDev is a bimonthly digital publication. Every issue is packed with over 70 pages of vital information: step-by-step tutorials by Xojo experts, columns for the beginner and expert, "behind-the-scenes" postmortems of popular programs made with Xojo, fascinating interviews, handy tips, product reviews and Xojo news. Subscribers to xDev receive download links to the PDF edition via email. ]]></description>
										<content:encoded><![CDATA[
<p><em>Spotlight On posts focus on Xojo community members. We’ll use this space to tell the stories of people using Xojo, share amazing Xojo-made apps and spread awareness of community resources. If you have an app, a project or a person you want to see featured in Spotlight On,&nbsp;<a href="mailto:hello@xojo.com">tell us about it</a>!</em></p>



<p>xDev is a bimonthly digital publication and a staple of the Xojo community since 2002. Every issue is packed with fresh and vital information: step-by-step tutorials by Xojo experts, columns for the beginner and expert, &#8220;behind-the-scenes&#8221; postmortems of popular programs made with Xojo, fascinating interviews, handy tips, product reviews and Xojo news. <a href="https://xojo.com/store/addons/xdev.php">Subscribe</a> today and start expanding your Xojo world.</p>



<h2 class="wp-block-heading">10 Questions with Marc Zeedar of xDev Magazine</h2>



<h3 class="wp-block-heading">Mac, Windows or Linux?</h3>



<p>Mac.</p>



<h3 class="wp-block-heading">What do you wish more people would ask you about when it comes to xDev?</h3>



<p>I love learning about people’s projects. I find many (most) people are overly modest about their own work and over-idealize the coding of others. Every programmer creates bugs. The truth is that *every* project is interesting, regardless of skill level. That’s one of the things I love about programming: it’s so vast and covers such a broad array of uses. They’re all fascinating.</p>



<p>It’s especially gratifying to hear about xDev articles or tips that readers put into practice. There’s nothing better than learning how the magazine helped someone!</p>



<h3 class="wp-block-heading">How would you explain your most recent project to a 5 year old?</h3>



<p>I got AI to help find writing errors in articles (see xDev 22.4’s “Beginner’s Corner” column).</p>



<h3 class="wp-block-heading">What’s next on your&nbsp;<em>Learn Next</em>&nbsp;list?</h3>



<p>Oh boy. That list is so long! And it doesn’t just include programming. Like I’m working on building a microcamper and I’m wanting to learn more woodworking skills so I can build some custom cabinets. I know just enough to be dangerous now and to realize how much more I need to learn!</p>



<p>In terms of programming, I always feel I’m weak on the algorithms side. There are many project ideas where I have no idea how to even begin. So I’m always open for more learning in problem solving.</p>



<p>In tech, I’d like to learn more about AI from a behind-the-scenes perspective, such as training models. For instance, could I create an AI model trained on xDev content that would make it easier to find coding help from past articles?</p>



<h3 class="wp-block-heading">When do you think of solutions for big bugs?</h3>



<p>Usually several hours after I wished I had! Typically that’s at 3 a.m. when I should have quit and gone to bed at midnight. Then I’m kicking myself for making such an “obvious” error.</p>



<h3 class="wp-block-heading">What programming moments made you think “Wow, I love my job so much.”</h3>



<p>Every time my code actually works! There’s nothing more satisfying than having an idea and then seeing it come to life. Probably 90% of the time when I start a project it’s on a whim and I’m just “playing around” to see if the idea is even feasible. Then when it works I’m totally jazzed and inspired.</p>



<p>I did that recently with my “Sandstorm” simulation (xDev 22.1) [<a href="https://www.xdevmag.com/downloads/xdev-sample-sandstorm.zip" target="_blank" rel="noreferrer noopener">Download this article for free</a>], my “Find the Differences” game (xDev 21.6), and my “Xojo Jigsaw” app (xDev 20.4). They all started out with me just fiddling around and then ended up as surprisingly good apps I could write articles about.</p>



<h3 class="wp-block-heading">What’s something that has surprised you about coding in the last 10 years?</h3>



<p>Probably AI (horribly named since it isn’t intelligent at all), which is problematic, but capable of impressive feats. The idea that it can actually generate useful code is wild to me. It’s still early days and there are serious issues to figure out, but it has incredible potential.</p>



<p>Focusing more on coding itself, I don’t think it’s any one thing, but just the way programming has improved and grown more powerful over the last decade. Each year there are small improvements and after ten years you look back and you’re amazed. The high standards of software these days — what users expect — keeps rising and yet coding is getting more powerful and making achieving those levels possible.</p>



<h3 class="wp-block-heading">What’s a cool piece of software more people should know about?</h3>



<p>Not really software, but a technology: RSS (Really Simple Syndication). It’s old, but so simple (it’s even in the name) and effective. I hear so many people grumbling about bad stuff on the news, social media, screen addiction, etc. and I wonder why they put themselves through that. The beauty of RSS is you can use it to set up your own custom feed of information and ignore all the cruft. I get to ignore politics and nonsense and focus on interesting people and technology.</p>



<h3 class="wp-block-heading">What’s the coolest thing you worked on recently?</h3>



<p>Besides my microcamper?&nbsp;My current project is always the coolest, at least until the next one comes along.</p>



<h3 class="wp-block-heading">Music or no music while coding?</h3>



<p>No music. I wouldn’t hear it anyway. When I go into coding mode (or writing mode or reading mode), I’m not aware of much that’s around me. It’s like I’m underwater.</p>



<p>Thank you to Marc Zeedar for answering our questions. If you want to learn more about xDev visit <a href="https://www.xdevmag.com/">https://www.xdevmag.com/</a>, you can get your subscription via PDF, or print for those of you who still like to hold your media in your hands. xDev also offers a 500-page printed book of each year’s issues.</p>



<p><em>Since its launch in 2002, Marc Zeedar is the publisher and editor of *xDev Magazine*, an independent bimonthly publication focused on instructing users of the Xojo development environment. He&#8217;s been using Xojo (then called REALbasic) since 1998 when he released his acclaimed Z-Write word processor, a unique tool for creative writers. In his spare time he hikes and camps, reads, writes novels, watches soccer and films, and lets his dog and cat tell him what to do. He lives in beautiful Oregon wine country.</em></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Clean Coding in Xojo: Best Practices for Writing Maintainable Code</title>
		<link>https://blog.xojo.com/2024/07/08/clean-coding-in-xojo-best-practices-for-writing-maintainable-code/</link>
		
		<dc:creator><![CDATA[Martin T.]]></dc:creator>
		<pubDate>Mon, 08 Jul 2024 15:00:00 +0000</pubDate>
				<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13301</guid>

					<description><![CDATA[Clean coding is a vital aspect of software development that ensures code readability, maintainability, and scalability. In the context of Xojo, adhering to clean coding principles can significantly enhance the quality and longevity of your projects. In this blog post, we’ll explore key practices for clean coding in Xojo, including the advantages and disadvantages of these approaches, with detailed examples and explanations.]]></description>
										<content:encoded><![CDATA[
<p>Clean coding is a vital aspect of software development that ensures code readability, maintainability, and scalability. In the context of Xojo, adhering to clean coding principles can significantly enhance the quality and longevity of your projects. In this blog post, we’ll explore key practices for clean coding in Xojo, including the advantages and disadvantages of these approaches, with detailed examples and explanations.</p>



<h2 class="wp-block-heading">Why Clean Coding Matters</h2>



<p>Before diving into the specific practices, it’s important to understand why clean coding matters:</p>



<p>1. <strong>Readability</strong>: Clean code is easier to read and understand, which is crucial when multiple developers are involved or when you revisit your code after some time. This reduces the cognitive load on developers, making it easier to grasp the code’s functionality quickly.</p>



<p>2. <strong>Maintainability</strong>: Code that follows clean coding principles is easier to maintain and update, reducing the risk of introducing bugs. Maintainable code allows for efficient troubleshooting and quick implementation of changes or new features.</p>



<p>3. <strong>Scalability</strong>: Clean code can be more easily extended with new features, facilitating the growth of your application. Well-structured code makes it easier to see where and how new functionality can be added without disrupting existing features.</p>



<h2 class="wp-block-heading">Key Practices for Clean Coding in Xojo</h2>



<h3 class="wp-block-heading">1. Use Meaningful Names</h3>



<p>Using meaningful and descriptive names for variables, methods, and classes is one of the simplest yet most powerful practices in clean coding. Avoid abbreviations and opt for clear, self-explanatory names. This practice helps other developers understand your code without needing extensive documentation.</p>



<h4 class="wp-block-heading">Example:</h4>



<pre id="xojo" class="wp-block-code"><code>// Bad
Var n As Integer</code></pre>



<pre id="xojo" class="wp-block-code"><code>// Good
Var userCount As Integer</code></pre>



<p>In the good example, userCount clearly indicates the purpose of the variable, making the code easier to understand at a glance.</p>



<h3 class="wp-block-heading">2. Follow Consistent Coding and Naming Conventions</h3>



<p>Consistent naming conventions make your codebase uniform and easier to navigate. Establish and follow conventions for variables, methods, properties, and classes.</p>



<p>Read more detailed about Coding and Naming Conventions in the <a href="https://documentation.xojo.com/topics/code_management/coding_guidelines.html#topics-code-management-coding-guidelines-naming" target="_blank" rel="noreferrer noopener">Xojo Documentation</a></p>



<h3 class="wp-block-heading">3. Keep Methods Short and Focused</h3>



<p>Each method should perform a single, well-defined task. If a method is too long or performs multiple tasks, consider refactoring it into smaller, more focused methods. This makes the code more modular and easier to test and maintain.</p>



<h4 class="wp-block-heading">Example:</h4>



<pre class="wp-block-code"><code>// Bad
Sub ProcessUserData()
  ' Code to validate user input
  ' Code to save user data to the database
  ' Code to send a confirmation email
End Sub</code></pre>



<pre class="wp-block-code"><code>// Good
Sub ProcessUserData()
  ValidateUserInput
  SaveUserData
  SendConfirmationEmail
End Sub

Sub ValidateUserInput()
  ' Validation logic
End Sub

Sub SaveUserData()
  ' Database saving logic
End Sub

Sub SendConfirmationEmail()
  ' Email sending logic
End Sub</code></pre>



<p>By breaking down ProcessUserData into smaller methods, each method has a single responsibility, which makes the code easier to understand and maintain.</p>



<h3 class="wp-block-heading">4. Comment Wisely</h3>



<p>Comments should explain <em>why </em>something is done, not <em>what </em>is done. The code itself should be self-explanatory whenever possible. Over-commenting can clutter the code, while under-commenting can make it difficult to understand the rationale behind certain decisions.</p>



<h4 class="wp-block-heading">Example:</h4>



<pre class="wp-block-code"><code>// Bad
// Increment the user count by 1
userCount = userCount + 1</code></pre>



<pre class="wp-block-code"><code>// Good
// Increment the user count to keep track of active users
userCount = userCount + 1</code></pre>



<p>In the good example, the comment provides context for why the increment is necessary, which might not be immediately obvious from the code alone.</p>



<h3 class="wp-block-heading">5. Use Constants and Enumerations</h3>



<p>Avoid using magic numbers and strings. Instead, define constants and enumerations for values that have specific meanings. This makes your code more readable and easier to update.</p>



<h4 class="wp-block-heading">Example:</h4>



<pre class="wp-block-code"><code>// Bad
If statusCode = 200 Then
  ' Success logic
End If</code></pre>



<pre class="wp-block-code"><code>// Good
Const kHTTP_SUCCESS As Integer = 200
If statusCode = kHTTP_SUCCESS Then
  ' Success logic
End If</code></pre>



<p>Using kHTTP_SUCCESS instead of 200 makes the code more readable and the purpose of the value clearer.</p>



<h3 class="wp-block-heading">Enumerations</h3>



<p>Enumerations (enums) are a powerful way to represent a set of related constants. They make your code more readable and maintainable by grouping related values under a single type. This can be particularly useful for handling states, options, or categories in your application.</p>



<h4 class="wp-block-heading">Example:</h4>



<pre class="wp-block-code"><code>// Define an enumeration for user roles
Enum UserRole
  Admin
  Editor
  Viewer
End Enum

// Use the enumeration
Var currentUserRole As UserRole = UserRole.Admin

Select Case currentUserRole
Case UserRole.Admin
  ' Admin-specific logic
Case UserRole.Editor
  ' Editor-specific logic
Case UserRole.Viewer
  ' Viewer-specific logic
End Select</code></pre>



<p>In this example, the UserRole enum defines three possible roles: Admin, Editor, and Viewer. Using an enum makes the code more readable and ensures that only valid roles are assigned to currentUserRole.</p>



<h3 class="wp-block-heading">6. Handle Errors Gracefully</h3>



<p>Implement proper error handling to ensure your application can gracefully recover from unexpected conditions. Use Try&#8230;Catch blocks and meaningful error messages. This practice improves the robustness and user experience of your application.</p>



<h4 class="wp-block-heading">Example:</h4>



<pre class="wp-block-code"><code>Try
  ' Code that might throw an exception
Catch e As OutOfBoundsException
  // Log the error and inform the user
  System.DebugLog("Error: " + e.Message)
  MessageBox("An unexpected error occurred.")
End Try</code></pre>



<p>By catching exceptions and providing informative error messages, you help users understand what went wrong and how to proceed, while also aiding in debugging and logging.</p>



<h3 class="wp-block-heading">7. Refactor Regularly</h3>



<p>Refactoring is the process of improving the structure of your code without changing its functionality. Regular refactoring helps keep your code clean and manageable. It involves restructuring your code to improve its internal structure while maintaining its external behavior.</p>



<h4 class="wp-block-heading">Example:</h4>



<p>Before refactoring:</p>



<pre class="wp-block-code"><code>Sub DoEverything()
  ' Lots of code here
End Sub</code></pre>



<p>After refactoring:</p>



<pre class="wp-block-code"><code>Sub DoEverything()
  PerformTaskA
  PerformTaskB
  PerformTaskC
End Sub

Sub PerformTaskA()
  ' Task A code
End Sub

Sub PerformTaskB()
  ' Task B code
End Sub

Sub PerformTaskC()
  ' Task C code
End Sub</code></pre>



<p>By breaking down DoEverything into smaller tasks, the code becomes more modular and easier to maintain.</p>



<h2 class="wp-block-heading">Advantages and Disadvantages of Clean Coding </h2>



<h3 class="wp-block-heading">Advantages</h3>



<ol class="wp-block-list">
<li><strong>Improved Readability:</strong> Clean code is easier for other developers and yourself to read and understand, which is crucial for effective collaboration and maintenance.</li>



<li><strong>Easier Maintenance:</strong> Maintenance tasks are simplified with well- structured and well-documented code, reducing the time and effort required to update and debug the code.</li>



<li><strong>Fewer Bugs:</strong> Following clean coding principles reduces the risk of bugs by promoting clarity and simplicity in the code.</li>



<li><strong>Better Collaboration:</strong> Teams can work more efficiently together when the code is understandable and consistent, reducing misunderstandings and errors.</li>



<li><strong>Scalability:</strong> It’s easier to integrate new features when the code is well- structured, as the modular design allows for more straightforward extensions.</li>
</ol>



<h3 class="wp-block-heading">Disadvantages</h3>



<ol class="wp-block-list">
<li><strong>Time Investment:</strong> Clean coding requires more time and effort, especially in naming, documentation, and refactoring. This can slow down initial development but pays off in the long run.</li>



<li><strong>Initial Learning Curve:</strong> Developers unfamiliar with clean coding principles need time to learn and apply them, which can temporarily decrease productivity.</li>



<li><strong>Over-Perfection:</strong> There’s a risk of spending too much time perfecting the code, which can impact overall productivity and delay project timelines.</li>
</ol>



<p>Clean coding is not just a set of guidelines but a mindset that can significantly improve the quality of your software. By adopting clean coding practices in Xojo, you ensure that your codebase remains readable, maintainable, and scalable. Whether you are working on a small project or a large application, these principles will help you write better code and build more robust software.</p>



<p>Incorporating clean coding practices into your development workflow might require an initial investment of time and effort, but the benefits far outweigh the costs. Clean code leads to fewer bugs, easier maintenance, and a codebase that can grow and evolve with your project’s needs.</p>



<p>Happy coding!</p>



<p><em>Martin T. is a Xojo MVP and has been very involved in testing Android support.</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>From Iteration to Interaction with Type Casting</title>
		<link>https://blog.xojo.com/2024/07/03/from-iteration-to-interaction-with-type-casting/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Wed, 03 Jul 2024 15:00:00 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Iteration]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Type Casting]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13268</guid>

					<description><![CDATA[In software development, efficiency and user experience are paramount. One powerful technique that can help achieve both is the use of type casting combined with iteration. By iterating through controls and casting them to specific types, developers can dynamically manipulate user interface elements, resulting in more responsive and interactive applications. In this article, we will explore the concepts of type casting and iteration within Xojo applications. We will break down a practical example to demonstrate how these techniques can be used to optimize form handling and enhance user interactions.]]></description>
										<content:encoded><![CDATA[
<p>In software development, efficiency and user experience are paramount. One powerful technique that can help achieve both is the use of type casting combined with iteration. By iterating through controls and casting them to specific types, developers can dynamically manipulate user interface elements, resulting in more responsive and interactive applications.</p>



<p>In this article, we will explore the concepts of type casting and iteration within Xojo applications. We will break down a practical example to demonstrate how these techniques can be used to optimize form handling and enhance user interactions.</p>



<h2 class="wp-block-heading">Understanding Type Casting</h2>



<p>Type casting is a concept where a generic control is converted—or &#8220;cast&#8221;—to a specific type to access its unique properties and methods. This technique is particularly useful when you need to manipulate various controls dynamically within a loop.</p>



<p>For instance, imagine you have multiple text fields on a Window and you want to apply specific actions only to some controls. By using type casting you can loop through all controls, identify those that you&#8217;re looking for, and then apply the desired actions.</p>



<p>Type casting is advantageous because it allows you to:</p>



<ul class="wp-block-list">
<li>Access Specific Properties: Gain access to properties and methods specific to the control type</li>



<li>Enhance Code Maintainability: Write cleaner, more readable and reusable code</li>



<li>Improve Performance: Perform operations more efficiently by targeting specific control types directly</li>
</ul>



<p>In essence, type casting allows developers to create more interactive and user-friendly applications by leveraging the full capabilities of each control type (you will see later in our example).</p>



<h2 class="wp-block-heading">Iterating Through UI Controls</h2>



<p>Iteration is a fundamental programming technique used to repeat a block of code multiple times. In Xojo, iterating through controls allows developers to dynamically interact with each instanced control, making it possible to apply specific actions based on the control type.</p>



<p>To iterate through controls in Xojo, you can use a simple For Each loop, which simplifies the process of accessing each control individually. Here’s a basic example:</p>



<pre class="wp-block-code"><code>For Each control As DesktopUIControl In Self.Controls
// Perform actions on each control
Next</code></pre>



<p>Now, let&#8217;s utilize type casting to identify and manipulate all DesktopUIControl type controls. For example, if you want to find all DesktopTextField controls and perform certain actions, like disabling them, you can do so as follows:</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:60%">
<pre class="wp-block-code"><code>// Loop through all controls in the current window or container
For Each control As DesktopUIControl In Self.Controls
  // Check if the current control is a DesktopTextField
  If control IsA DesktopTextField Then
    // Cast the control to a DesktopTextField for specific operations
    Var dtfield As DesktopTextField = DesktopTextField(control)
    // Disable the DesktopTextField type controls
    dtfield.Enabled = False
  End If
Next</code></pre>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<p>Here’s a breakdown of what each part of the code does:</p>



<ol class="wp-block-list">
<li>The For Each loop iterates through all controls in Self.Controls. Self refers to the current window or container.</li>



<li>The If statement checks if the current control is an instance of DesktopTextField.</li>



<li>If it is a DesktopTextField type, the control is cast to a DesktopTextField variable named dtfield and then disable it.</li>
</ol>
</div>
</div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Tip: Make sure to read more about the operator <strong>IsA </strong>at <a href="https://documentation.xojo.com/api/language/isa.html" target="_blank" rel="noreferrer noopener">https://documentation.xojo.com/api/language/isa.html</a></p>
</blockquote>



<h2 class="wp-block-heading">Practical Example</h2>



<p>Let&#8217;s get into a practical example to see type casting and iteration in action.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%">
<ol class="wp-block-list">
<li>Place different type controls on a Window (buttons, text fields, text areas, popup menus, etc.).</li>



<li>Make sure to also place two DesktopTextField controls and name them “PasswordField” and “EmailField”.</li>



<li>In a Button control, add the Pressed event and write the following code:</li>
</ol>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="306" height="452" src="https://blog.xojo.com/wp-content/uploads/2024/06/image-2.png" alt="From Iteration to Interaction: Type Casting in Xojo Applications" class="wp-image-13283" srcset="https://blog.xojo.com/wp-content/uploads/2024/06/image-2.png 306w, https://blog.xojo.com/wp-content/uploads/2024/06/image-2-203x300.png 203w" sizes="auto, (max-width: 306px) 100vw, 306px" /></figure>
</div>
</div>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%">
<pre class="wp-block-code"><code>// Loop through all controls in the current Window or Container
For Each control As DesktopUIControl In Self.Controls
  // Test if the current control is a DesktopTextField
  If control IsA DesktopTextField Then
    // Cast the control to a DesktopTextField for specific operations
    Var dtfield As DesktopTextField = DesktopTextField(control)
    
    // Get the name of the current text field
    Var ctrlName As String = dtfield.Name
    
    // Check if the text field is either the password field or email field
    If (ctrlName = "PasswordField") Or (ctrlName = "EmailField") Then
      // Check if the text field is empty
      If dtfield.Text.IsEmpty = True Then
        // If empty, set focus to this field
        dtfield.SetFocus
        // Exit the loop and the current method/function
        Return
      End If
    End If
  End If
Next</code></pre>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%">
<p>Code breakdown:</p>



<ol class="wp-block-list">
<li>The code starts with a For Each loop that iterates through all controls available in the Window/Container (Self.Controls).</li>



<li>It checks if each control is a DesktopTextField.</li>



<li>If it is, the control is cast to a DesktopTextField variable named dtfield.</li>



<li>The name of the text field is stored in the ctrlName variable.</li>



<li>The code then checks if the text field is either the &#8220;PasswordField&#8221; or &#8220;EmailField&#8221;.</li>



<li>If it is one of these fields, it checks if the field is empty.</li>



<li>If the field is empty, it sets the focus to this field and exits the current method or function using Return.</li>
</ol>
</div>
</div>



<p>The above Xojo code snippet is used to perform a simple form validation. It checks if the password and email fields are filled out, and if either is empty, it sets the focus to the empty field and stops further processing. This is useful for ensuring that users don&#8217;t submit a form with these crucial fields left blank.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Mastering software development type casting and iteration not only makes your code more maintainable but it’s also a good strategy for dynamically managing instanced objects.</p>



<p>We encourage you to experiment with these techniques in your own Xojo projects. By applying the principles discussed in this blog post, you&#8217;ll be well on your way to creating more efficient and interactive applications.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>Make sure to also check the following resources:</strong><br>1. <a href="https://documentation.xojo.com/getting_started/object-oriented_programming/advanced_oop_features.html#casting" target="_blank" rel="noreferrer noopener">https://documentation.xojo.com/getting_started/object-oriented_programming/advanced_oop_features.html#casting</a><br>2. <a href="https://documentation.xojo.com/api/language/isa.html#isa" target="_blank" rel="noreferrer noopener">https://documentation.xojo.com/api/language/isa.html#isa</a><br>3. <a href="https://blog.xojo.com/2017/12/13/make-your-own-classes-iterables/" target="_blank" rel="noreferrer noopener">https://blog.xojo.com/2017/12/13/make-your-own-classes-iterables/</a><br>4. <a href="https://blog.xojo.com/2018/03/21/casting-get-ready-and-keep-the-type/" target="_blank" rel="noreferrer noopener">https://blog.xojo.com/2018/03/21/casting-get-ready-and-keep-the-type/</a></p>
</blockquote>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>New Database Connections</title>
		<link>https://blog.xojo.com/2024/06/26/new-database-connections/</link>
		
		<dc:creator><![CDATA[William Yu]]></dc:creator>
		<pubDate>Wed, 26 Jun 2024 15:00:00 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[2024r2]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[ODBC]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13226</guid>

					<description><![CDATA[While Xojo has always supported adding database connections, the old method was far from ideal. Let's delve into the improved approach using the new DatabaseConnection project items and explore some recent additions to our database API.]]></description>
										<content:encoded><![CDATA[
<p>While Xojo has always supported adding database connections, the old method was far from ideal. Let&#8217;s delve into the improved approach using the new Database Connection project items and explore some recent additions to our database API.</p>



<h2 class="wp-block-heading">Out With The Old</h2>



<p>The old database connections were quite limiting, requiring you to create a new connection and re-enter all the parameters whenever one changed. With our new Database Connection items, you can now easily update specific connection parameters directly in the inspector.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="303" src="https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-1024x303.png" alt="" class="wp-image-13230" srcset="https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-1024x303.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-300x89.png 300w, https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-768x228.png 768w, https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-1536x455.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/06/PostgresqlDBConnectionModification-2048x607.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Additionally, you can now choose whether the item will auto-connect or if you prefer to connect to it later in your code.</p>



<h2 class="wp-block-heading">Connecting to a Specific Database</h2>



<p>There are times when you need to connect to a database for debugging and testing, but for the final builds, you want to connect to your production database/server. Setting this up correctly with the old database connection method required creating two separate connection items—one for debug and one for release. With the new Database Connection items, this process is much simpler and fits more easily into the build process.  You now have several new Database Connection subitems that can be customized based on the stage of your build. These subitems are linked to the Stage Code in your Shared Build Settings, ensuring that when you build a final release, your database connection uses the correct settings automatically.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="329" src="https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-1024x329.png" alt="" class="wp-image-13238" srcset="https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-1024x329.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-300x96.png 300w, https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-768x247.png 768w, https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode-1536x493.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/06/DatabaseConnectionStageCode.png 1968w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Additional Database Features</h2>



<p>In addition to this change, there are two new database APIs that may be useful to you:</p>



<ol class="wp-block-list">
<li>A new method, IsConnected, has been added to the SQLiteDatabase, ODBCDatabase, PostgreSQLDatabase, and MySQLCommunityServer classes. This method returns true if the connection is still active, and false if it is not.</li>



<li>We&#8217;ve enhanced <a href="https://documentation.xojo.com/api/databases/database.html#database-addrow">Database.AddRow</a> with a new signature that returns the unique ID of the newly inserted row. This feature is supported for SQLiteDatabase, ODBCDatabase, PostgreSQLDatabase, and MySQLCommunityServer classes. It is recommended to use this new API instead of the deprecated SQLiteDatabase.LastRowID and MySQLCommunityServer.LastInsertedRowID</li>
</ol>



<p>Let&#8217;s explore how the new Database.AddRow feature can assist you. Previously, only SQLiteDatabase and MySQLCommunityServer had APIs to retrieve the unique ID of the last inserted row. Now, PostgreSQLDatabase and ODBCDatabase also have this capability by using the new <code>Database.AddRow(tableName As String, row As DatabaseRow, idColumnName As String = "") As Integer</code></p>



<p>The new aspect of this signature is the idColumnName parameter and the return value. For databases that support the SQL <strong>RETURNING</strong> clause, the idColumnName specifies the column whose value will be returned.  For databases that do not support the <strong>RETURNING</strong> clause, we will use the suitable method for each specific database to return a unique value.</p>



<p>We recognize the significance of databases in your Xojo apps. So with these updates to database connectivity for your desktop, web and console apps, and the addition of new features, we aim to make your database programming easier and more efficient.</p>



<p><em><em><em>William Yu grew up in Canada learning to program BASIC on a Vic-20. He is Xojo’s resident Windows and Linux engineer, among his many other skills. Some may say he has joined the dark side here in the USA, but he will always be a Canadian at heart.</em></em></em></p>



<ul class="wp-block-social-links has-normal-icon-size is-content-justification-center is-layout-flex wp-container-core-social-links-is-layout-16018d1d wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-facebook  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.facebook.com/goxojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Facebook</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://x.com/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-linkedin  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.linkedin.com/company/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"></path></svg><span class="wp-block-social-link-label screen-reader-text">LinkedIn</span></a></li>

<li class="wp-social-link wp-social-link-github  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://github.com/topics/xojo" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"></path></svg><span class="wp-block-social-link-label screen-reader-text">GitHub</span></a></li>

<li class="wp-social-link wp-social-link-youtube  wp-block-social-link"><a rel="noopener nofollow" target="_blank" href="https://www.youtube.com/c/XojoInc" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"></path></svg><span class="wp-block-social-link-label screen-reader-text">YouTube</span></a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to use Bootstrap Themes to Customize your Xojo Web Apps</title>
		<link>https://blog.xojo.com/2024/06/18/how-to-use-bootstrap-themes-to-customize-your-xojo-web-apps/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Tue, 18 Jun 2024 14:00:00 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WebDesign]]></category>
		<category><![CDATA[webdev]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13177</guid>

					<description><![CDATA[This tutorial will equip you with all the knowledge to select and use Bootstrap themes for your Xojo web apps. By the end of this guide, you’ll have the tools and confidence to create a visually appealing, user-friendly app that turns heads and wins hearts.]]></description>
										<content:encoded><![CDATA[
<p>If you&#8217;re crafting your latest SaaS (web app) using Xojo, you might already know the power this platform holds. But let’s talk about something equally important &#8211; making your app look downright amazing.</p>



<p>Have you ever stumbled upon a website or app and been instantly captivated by its design? That&#8217;s the magic of great visual appeal. And guess what? You can bring that same magic to your Xojo web app with the help of Bootstrap themes.</p>



<p>Imagine your app not just as a tool, but as a full visual-interactive experience for your end-users. Whether you’re a design newbie or a seasoned pro, these themes offer a seamless way to enhance your web app’s look and feel.</p>



<p>This tutorial will equip you with all the knowledge to select and use Bootstrap themes for your Xojo web apps. By the end of this guide, you’ll have the tools and confidence to create a visually appealing, user-friendly app that turns heads and wins hearts.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">What are Bootstrap themes and why use them in Xojo?</h2>



<p><a href="https://getbootstrap.com/" target="_blank" rel="noreferrer noopener nofollow">Bootstrap</a> is a popular front-end framework that helps developers create responsive and visually compelling web applications. Bootstrap themes are pre-designed templates built with this framework, making it easier to achieve a professional look with minimal effort.</p>



<p>Xojo, by default, uses a modified Bootstrap theme for its web apps. This means that right out of the box, your Xojo web app already benefits from Bootstrap&#8217;s design and sleek aesthetics. There are countless pre-designed themes available online, both free and premium, that you can incorporate into your Xojo web app. These themes can dramatically alter the visual appearance of your app, offering various aesthetic options to suit your needs.</p>



<p>Now that you have a basic understanding of Bootstrap and its role in Xojo, let’s move on to how you can actually implement and customize these themes in your web app.</p>



<h3 class="wp-block-heading">Step 1: Choose a Bootstrap theme</h3>



<p>First, you need to choose a Bootstrap theme that fits the look and feel you want for your Xojo web app. There are numerous resources on the web where you can find free or premium Bootstrap themes. For maximum compatibility with Xojo, we recommend using themes from <a href="https://bootswatch.com/" target="_blank" rel="noreferrer noopener nofollow">Bootswatch</a>. Bootswatch provides a variety of free, Xojo-compatible Bootstrap themes.</p>



<h3 class="wp-block-heading">Step 2: Preview and download the theme</h3>



<div class="wp-block-columns are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow">
<p>On the Bootswatch website, click the &#8220;Preview&#8221; button for any theme to see how it will appear.</p>



<p>Once you find a theme you like, click the menu next to the theme&#8217;s &#8220;Download&#8221; button and select the file named bootstrap.min.css. This is the only file you need.</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-large is-resized is-style-rounded"><img loading="lazy" decoding="async" width="956" height="956" src="https://blog.xojo.com/wp-content/uploads/2024/06/image-1-edited.png" alt="Selecting a Bootstrap theme for Xojo web apps from the Bootswatch website." class="wp-image-13183" style="width:428px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2024/06/image-1-edited.png 956w, https://blog.xojo.com/wp-content/uploads/2024/06/image-1-edited-300x300.png 300w, https://blog.xojo.com/wp-content/uploads/2024/06/image-1-edited-150x150.png 150w, https://blog.xojo.com/wp-content/uploads/2024/06/image-1-edited-768x768.png 768w" sizes="auto, (max-width: 956px) 100vw, 956px" /></figure>
</div>
</div>



<h3 class="wp-block-heading">Step 3: Add the theme to your Xojo web app project</h3>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow">
<p>Now for the easiest step. Once you have the desired <strong>bootstrap.min.css</strong> file, simply drag and drop it into the Navigator panel of your Xojo project.</p>



<p>After adding the bootstrap.min.css file to your project, Xojo&#8217;s layout editor will instantly reflect the new theme. Moreover, your web app will utilize this theme when running.</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full is-style-rounded"><img loading="lazy" decoding="async" width="600" height="600" src="https://blog.xojo.com/wp-content/uploads/2024/06/bootstrap_theme_in_xojo_web_apps.gif" alt="" class="wp-image-13186"/></figure>
</div>
</div>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>Congratulations! You&#8217;ve now learned how to incorporate and apply Bootstrap themes to your Xojo web application.</p>



<p>Remember, the right theme can make your web app not just functional, but memorable. And with the countless options available, you’re sure to find a Bootstrap theme that perfectly matches your vision. Don&#8217;t hesitate to experiment with different themes and make adjustments as needed to get the perfect look for your app.</p>



<p>Now it’s your turn to put it into practice and create web apps that not only work well but look fantastic too.</p>



<p>If you have any questions or run into any issues, feel free to refer to the&nbsp;<a href="https://documentation.xojo.com/topics/user_interface/web/changing_the_appearance_of_controls.html#changing-all-controls" target="_blank" rel="noreferrer noopener">official Xojo documentation</a>&nbsp;for more detailed information.</p>



<p><em>Gabriel is a digital marketing enthusiast who loves coding with Xojo to create cool software tools for any platform. He is always eager to learn and share new ideas!</em></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
