<?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>Learning &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/category/learning/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Mon, 06 Apr 2026 17:51:35 +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>Conditional Compilation in Xojo: #If False and #If True</title>
		<link>https://blog.xojo.com/2026/04/03/conditional-compilation-in-xojo-if-false-and-if-true/</link>
		
		<dc:creator><![CDATA[Martin T.]]></dc:creator>
		<pubDate>Fri, 03 Apr 2026 13:42:00 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Software Development]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=16107</guid>

					<description><![CDATA[If you&#8217;ve been working with Xojo for a while, you&#8217;re likely familiar with conditional compilation directives like #If TargetMacOS or #If DebugBuild. But there are&#8230;]]></description>
										<content:encoded><![CDATA[
<p>If you&#8217;ve been working with Xojo for a while, you&#8217;re likely familiar with conditional compilation directives like <code>#If TargetMacOS</code> or <code>#If DebugBuild</code>. But there are two particularly useful variants that are often overlooked in day-to-day development: <code>#If False</code> and <code>#If True</code>. In this article, we&#8217;ll look at what these directives do, when to use them, and why they can be a better choice than regular comments in certain situations.</p>



<h2 class="wp-block-heading">What Is Conditional Compilation?</h2>



<p>Conditional compilation allows you to include or completely exclude sections of code from the final application based on a condition. Unlike an <code>If</code> statement at runtime, this decision is made at compile time. Code excluded through conditional compilation simply does not exist in the compiled application.</p>



<h2 class="wp-block-heading">#If False – Completely Excluding Code</h2>



<pre class="wp-block-code"><code>#If False
  MessageBox("This line will never be compiled")
  Var result As Integer = DoSomething()
#EndIf</code></pre>



<p>When the condition is <code>False</code>, the entire block is ignored by the compiler. It is not compiled, not included in the application, and not even checked for syntax errors. The code is effectively invisible to the compiler.</p>



<h3 class="wp-block-heading">Why Not Just Comment It Out?</h3>



<p>At first glance, <code>#If False</code> seems to do the same thing as a comment. But there are key differences:</p>



<p><strong>1. Nested Comments Are No Problem</strong></p>



<p>If a code block already contains comments, commenting out the entire block quickly becomes messy:</p>



<pre class="wp-block-code"><code>' Var x As Integer = 42 ' Default value
' Var y As Integer = x * 2 ' double it
' ' This is already a comment</code></pre>



<p>With <code>#If False</code>, everything stays clean:</p>



<pre class="wp-block-code"><code>#If False
  Var x As Integer = 42 ' Default value
  Var y As Integer = x * 2 ' double it
  ' This is already a comment
#EndIf</code></pre>



<p><strong>2. Incomplete or Broken Code</strong></p>



<p>Sometimes you want to keep an unfinished code draft without it preventing the build. Since the compiler completely skips the contents of an <code>#If False</code> block, the code inside may even contain syntax errors:</p>



<pre class="wp-block-code"><code>#If False
  ' Experimental approach – not finished yet
  Var data As  = LoadFromServer(
  ProcessResult(data
#EndIf</code></pre>



<p>This code would be useless as a comment because you&#8217;d have to comment out each line individually. With <code>#If False</code>, it&#8217;s safely stored away.</p>



<p><strong>3. Quickly Disabling Large Code Blocks</strong></p>



<p>For larger sections, <code>#If False</code> / <code>#EndIf</code> is far more practical than prefixing every line with <code>'</code>. Plus, the block can be reactivated instantly by simply changing <code>False</code> to <code>True</code>.</p>



<h2 class="wp-block-heading">#If True – Always Including Code</h2>



<pre class="wp-block-code"><code>#If True
  MessageBox("This line will always be compiled")
#EndIf</code></pre>



<p>An <code>#If True</code> block is always compiled — it behaves identically to regular code. This might sound useless at first, but it does have practical applications.</p>



<h3 class="wp-block-heading">When Is <code>#If True</code> Useful?</h3>



<p><strong>1. Quick Toggling During Development</strong></p>



<p>Imagine you&#8217;re working on a feature and want to quickly enable or disable certain code sections:</p>



<pre class="wp-block-code"><code>#If True ' &lt;- Set to False to disable the new feature
  ' New feature
  Var service As New CloudSyncService
  service.SyncNow()
#EndIf</code></pre>



<p>By simply changing <code>True</code> to <code>False</code>, you can disable the feature without deleting or commenting out any code.</p>



<p><strong>2. Placeholder for Future Conditions</strong></p>



<p>Sometimes you already know that a code section will later be tied to a condition — such as a platform or build type. With <code>#If True</code>, you can prepare the structure in advance:</p>



<pre class="wp-block-code"><code>#If True ' TODO: Change to TargetMacOS once Windows alternative is ready
  Var folderPath As String = SpecialFolder.Applications.NativePath
#EndIf</code></pre>



<p><strong>3. Visual Code Grouping</strong></p>



<p>In longer methods, <code>#If True</code> can serve as a visual structural block to highlight related code:</p>



<pre class="wp-block-code"><code>#If True ' --- Initialization ---
  Var db As New SQLiteDatabase
  db.DatabaseFile = dbFile
  db.Connect
#EndIf

#If True ' --- Load data ---
  Var rs As RowSet = db.SelectSQL("SELECT * FROM users")
#EndIf</code></pre>



<h2 class="wp-block-heading">Defining Custom Compiler Constants</h2>



<p>Xojo also allows you to define your own constants for conditional compilation.</p>



<pre class="wp-block-code"><code>#If kEnableLogging
  WriteToLog("Application started")
#EndIf</code></pre>



<p>This lets you control features or debug functionality centrally through a constant without having to modify the code itself.</p>



<h2 class="wp-block-heading">Best Practices</h2>



<ol class="wp-block-list">
<li><strong><code>#If False</code> instead of mass comments</strong>: For larger code blocks that need to be temporarily disabled, <code>#If False</code> is the cleaner solution.</li>



<li><strong>Add a comment</strong>: Always document <em>why</em> a block is disabled:</li>
</ol>



<pre class="wp-block-code"><code>#If False ' Disabled until bug #1234 is fixed
  ProcessCriticalData()
 #EndIf</code></pre>



<ol start="3" class="wp-block-list">
<li><strong>Don&#8217;t use permanently</strong>: <code>#If False</code> blocks should not remain in the code indefinitely. If the code is no longer needed, remove it. If it is needed, activate it.</li>



<li><strong>Prefer platform directives</strong>: When dealing with platform-specific code, use the specific constants (<code>TargetMacOS</code>, <code>TargetWindows</code>, etc.) instead of <code>#If True</code> or <code>#If False</code>.</li>



<li><strong>Avoid deep nesting</strong>: While nested <code>#If</code> blocks are possible, use them sparingly as they quickly reduce readability.</li>
</ol>



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



<p><code>#If False</code> and <code>#If True</code> are simple yet powerful tools for everyday Xojo development. They offer a cleaner alternative to commenting out large code blocks, enable quick feature toggling during development, and lay the groundwork for a structured, cross-platform codebase. Used thoughtfully, they save time and help you stay organized — even in larger projects.</p>



<p>If you want to automatically convert a selection into a #If/#EndIf block, you can do so via the context menu: &#8220;Wrap In > #If / #EndIf&#8221;</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>Build a Simple Find in Files Function</title>
		<link>https://blog.xojo.com/2026/04/02/build-a-simple-find-in-files-function/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Thu, 02 Apr 2026 16:15:00 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Files]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Text Files]]></category>
		<category><![CDATA[Text Processing]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15972</guid>

					<description><![CDATA[Sooner or later most apps need some version of the ability to find text in those files, whether you&#8217;re scanning log files, config files, exported&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Sooner or later most apps need some version of the ability to find text in those files, whether you&#8217;re scanning log files, config files, exported data, or source code.</p>



<p>In this post, we&#8217;ll build a simple Find in Files utility in Xojo that:</p>



<ul class="wp-block-list">
<li>searches the files in a folder</li>



<li>reads each file line by line</li>



<li>performs a plain-text, case-insensitive match</li>



<li>returns the file path, line number, and matching line</li>
</ul>



<p>The goal is simple: build something useful while leaving the door open for the fancier stuff.</p>



<h2 class="wp-block-heading" id="what-this-find-in-files-function-will-do">What this Find in Files function will do</h2>



<p>Let&#8217;s keep the scope clear:</p>



<ul class="wp-block-list">
<li>search one folder</li>



<li>search plain text only</li>



<li>skip subfolders for now</li>



<li>return the matching file path, line number, and line contents</li>
</ul>



<h2 class="wp-block-heading" id="step-1-put-the-result-class-in-the-module">Step 1: A class in a module and some properties</h2>



<p>Before touching the file system, let&#8217;s define what a match looks like.</p>



<p>You could return raw strings, but that gets messy fast. A small class keeps the code readable and gives us an obvious place to extend later. In this version, I like keeping that class inside the same module as the search function. It keeps the entire utility self-contained instead of spraying helper types all over the project.</p>



<p>So, we start by adding a module&nbsp;<code>SearchUtils</code>&nbsp;and inside the module we will add a class&nbsp;<code>SearchHit</code>.</p>



<pre class="wp-block-code"><code>Module SearchUtils

  Class SearchHit

    Public Property FilePath As String
    Public Property LineNumber As Integer
    Public Property LineText As String

    Public Sub Constructor(filePath As String, lineNumber As Integer, lineText As String)
      Self.FilePath = filePath
      Self.LineNumber = lineNumber
      Self.LineText = lineText
    End Sub

  End Class

End Module</code></pre>



<p>Each result stores three things:</p>



<ol class="wp-block-list">
<li>the file path</li>



<li>the line number</li>



<li>the matching line</li>
</ol>



<h2 class="wp-block-heading" id="step-2-walk-through-the-folder">Step 2: Walk through the folder</h2>



<p><code>FolderItem.Children</code> lets us loop through a folder with a <code>For Each</code> loop, which keeps the code clear.</p>



<p>We&#8217;ll also reject bad input early:</p>



<ul class="wp-block-list">
<li>the folder is&nbsp;<code>Nil</code></li>



<li>the folder does not exist</li>



<li>the item passed is not actually a folder</li>



<li>the search term is empty</li>
</ul>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="409" src="https://blog.xojo.com/wp-content/uploads/2026/03/find_in_files_xojo_function_diagram2-1024x409.png" alt="" class="wp-image-16027" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/find_in_files_xojo_function_diagram2-1024x409.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/find_in_files_xojo_function_diagram2-300x120.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/find_in_files_xojo_function_diagram2-768x307.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/find_in_files_xojo_function_diagram2.png 1536w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>This process is simple, fast and effective.</p>



<h2 class="wp-block-heading" id="step-3-read-files-line-by-line">Step 3: Read files line by line</h2>



<p>For text files,&nbsp;<code>TextInputStream.Open</code>&nbsp;is the right tool. From there, we can call&nbsp;<code>ReadLine</code>&nbsp;until&nbsp;<code>EndOfFile</code>&nbsp;becomes&nbsp;<code>True</code>.</p>



<p>I prefer this over&nbsp;<code>ReadAll</code>&nbsp;for a utility like this.&nbsp;<code>ReadAll</code>&nbsp;is fine when the file is small and you know what you&#8217;re doing, but line-by-line reading is a better default here. It keeps memory use in check and gives us line numbers for free.</p>



<p>For the sample code, I&#8217;m explicitly using UTF-8:</p>



<pre class="wp-block-code"><code>input.Encoding = Encodings.UTF8</code></pre>



<p>That keeps the sample predictable. It does&nbsp;<strong>not</strong>&nbsp;mean this code can gracefully decode every text file you throw at it. Files with unknown encodings or binary-ish content are a separate problem, and they deserve their own solution.</p>



<h2 class="wp-block-heading" id="step-4-match-the-text">Step 4: Match the text</h2>



<p>For a plain-text search,&nbsp;<code>String.Contains</code>&nbsp;does exactly what we need:</p>



<pre class="wp-block-code"><code>line.Contains(searchTerm, ComparisonOptions.CaseInsensitive)</code></pre>



<p>It handles the case-insensitivity without the overhead, or the headache, of regex.</p>



<h2 class="wp-block-heading" id="step-5-the-full-module">Step 5: The full module and class and function</h2>



<pre class="wp-block-code"><code>Module SearchUtils

  Public Class SearchHit
    Public Property FilePath As String
    Public Property LineNumber As Integer
    Public Property LineText As String

    Public Sub Constructor(filePath As String, lineNumber As Integer, lineText As String)
      Self.FilePath = filePath
      Self.LineNumber = lineNumber
      Self.LineText = lineText
    End Sub
  End Class

  Public Function FindInFiles(targetFolder As FolderItem, searchTerm As String) As SearchHit()
    Var hits() As SearchHit

    If targetFolder Is Nil Then
      Return hits
    End If

    If Not targetFolder.Exists Or Not targetFolder.IsFolder Then
      Return hits
    End If

    If searchTerm.IsEmpty Then
      Return hits
    End If

    For Each item As FolderItem In targetFolder.Children
      If item Is Nil Then Continue
      If item.IsFolder Then Continue
      If Not item.Exists Then Continue
      If Not item.IsReadable Then Continue

      Try
        Var input As TextInputStream = TextInputStream.Open(item)
        input.Encoding = Encodings.UTF8

        Var lineNumber As Integer = 0

        While Not input.EndOfFile
          Var line As String = input.ReadLine
          lineNumber = lineNumber + 1

          If line.Contains(searchTerm, ComparisonOptions.CaseInsensitive) Then
            hits.Add(New SearchHit(item.NativePath, lineNumber, line))
          End If
        Wend

        input.Close

      Catch error As IOException
        ' Skip files that cannot be read as text.
        Continue
      End Try
    Next

    Return hits
  End Function

End Module</code></pre>



<h2 class="wp-block-heading" id="how-it-works">How it works</h2>



<p>Let&#8217;s break down the important parts.</p>



<h3 class="wp-block-heading" id="input-validation">Input validation</h3>



<p>This block prevents pointless work and avoids avoidable runtime problems:</p>



<pre class="wp-block-code"><code>If targetFolder Is Nil Then
  Return hits
End If

If Not targetFolder.Exists Or Not targetFolder.IsFolder Then
  Return hits
End If

If searchTerm.IsEmpty Then
  Return hits
End If</code></pre>



<p>Rule of thumb: reject bad input early.</p>



<h3 class="wp-block-heading" id="folder-iteration">Folder iteration</h3>



<p>This is the core loop:</p>



<pre class="wp-block-code"><code>For Each item As FolderItem In targetFolder.Children</code></pre>



<p>We&#8217;re only scanning the folder&#8217;s immediate contents. If an item is another folder, we skip it.</p>



<pre class="wp-block-code"><code>If item.IsFolder Then Continue</code></pre>



<h3 class="wp-block-heading" id="safe-text-reading">Safe text reading</h3>



<p>Each file is opened with&nbsp;<code>TextInputStream.Open</code>&nbsp;inside a&nbsp;<code>Try...Catch</code>&nbsp;block:</p>



<pre class="wp-block-code"><code>Try
  Var input As TextInputStream = TextInputStream.Open(item)
  input.Encoding = Encodings.UTF8
  ...
Catch error As IOException
  Continue
End Try</code></pre>



<p>That way, one unreadable file does not take down the whole search. It gets skipped and the rest of the folder still gets processed.</p>



<h3 class="wp-block-heading" id="line-by-line-matching">Line-by-line matching</h3>



<p>This is where the actual work happens:</p>



<pre class="wp-block-code"><code>While Not input.EndOfFile
  Var line As String = input.ReadLine
  lineNumber = lineNumber + 1

  If line.Contains(searchTerm, ComparisonOptions.CaseInsensitive) Then
    hits.Add(New SearchHit(item.NativePath, lineNumber, line))
  End If
Wend</code></pre>



<p>Because we&#8217;re reading one line at a time, attaching the correct line number is trivial.</p>



<h3 class="wp-block-heading" id="why-keep-searchhit-inside-the-module">Why keep&nbsp;<code>SearchHit</code>&nbsp;inside the module?</h3>



<p>Because it belongs to this utility. The search function and its result type are part of the same little unit of behavior, so keeping them together makes the project easier to scan and easier to transform it to a&nbsp;<a href="https://documentation.xojo.com/topics/code_management/sharing_code_among_multiple_projects.html" target="_blank" rel="noreferrer noopener">Library</a>.</p>



<p>It also means code outside the module uses the namespaced type:</p>



<pre class="wp-block-code"><code>Var results() As SearchUtils.SearchHit = SearchUtils.FindInFiles(folder, "xojo")</code></pre>



<h2 class="wp-block-heading" id="using-the-function">Using the function</h2>



<p>Here&#8217;s a simple example that lets the user choose a folder and then writes the results to the debug log:</p>



<pre class="wp-block-code"><code>Var folder As FolderItem = FolderItem.ShowSelectFolderDialog
If folder Is Nil Then Return

Var results() As SearchUtils.SearchHit = SearchUtils.FindInFiles(folder, "error")

For Each hit As SearchUtils.SearchHit In results
  System.DebugLog(hit.FilePath + " | line " + hit.LineNumber.ToString + " | " + hit.LineText)
Next</code></pre>



<p>If you want to display the results in a&nbsp;<code>DesktopListBox</code>, that works nicely too:</p>



<pre class="wp-block-code"><code>Var folder As FolderItem = FolderItem.ShowSelectFolderDialog
If folder Is Nil Then Return

Var results() As SearchUtils.SearchHit = FindInFiles(folder, "error")

ListBox1.RemoveAllRows
ListBox1.ColumnCount = 3

For Each hit As SearchUtils.SearchHit In results
  ListBox1.AddRow(hit.FilePath)
  ListBox1.CellTextAt(ListBox1.LastAddedRowIndex, 1) = hit.LineNumber.ToString
  ListBox1.CellTextAt(ListBox1.LastAddedRowIndex, 2) = hit.LineText
Next</code></pre>



<p>A few sample results might look like this:</p>



<pre class="wp-block-code"><code>C:\Logs\app.log | line 18 | Error connecting to database
C:\Logs\app.log | line 42 | Error writing audit record
C:\Configs\service.txt | line 7 | Last error message: timeout</code></pre>



<h2 class="wp-block-heading" id="practical-limitations-of-this-version">Practical limitations of this version</h2>



<p>This utility is useful, but limited.</p>



<h3 class="wp-block-heading" id="it-assumes-utf-8">It assumes UTF-8</h3>



<p>That is fine for plenty of modern text files, but not all of them. If you&#8217;re dealing with mixed encodings, you&#8217;ll need a smarter approach that detects the file encoding.</p>



<h3 class="wp-block-heading" id="it-doesnt-recurse-into-subfolders">It doesn&#8217;t recurse into subfolders</h3>



<p>That is deliberate. Recursive search is useful, but it adds another layer of behavior and another place to make the code harder to read.</p>



<h2 class="wp-block-heading" id="final-thoughts">Final thoughts</h2>



<p>A basic Find in Files function is one of those utilities that looks small but pays off quickly. This is a base-layer utility. Once you have this working, adding recursion or regex is a much smaller lift.</p>



<p>Let&#8217;s discuss in the&nbsp;<a href="https://forum.xojo.com/">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>Jade Improvements</title>
		<link>https://blog.xojo.com/2026/03/31/jade-improvements/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 31 Mar 2026 15:23:00 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[2026r1]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[AI Code Generation]]></category>
		<category><![CDATA[Jade]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=16041</guid>

					<description><![CDATA[For Xojo 2026 Release 1, we’ve made some improvements to Jade, Xojo’s integrated AI assistant. Jade is easily accessible from the toolbar, making it handy&#8230;]]></description>
										<content:encoded><![CDATA[
<p>For Xojo 2026 Release 1, we’ve made some improvements to Jade, Xojo’s integrated AI assistant. Jade is easily accessible from the toolbar, making it handy for getting coding advice and asking general Xojo questions, especially about the documentation.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="52" src="https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-16.40.54@2x-1024x52.png" alt="" class="wp-image-16061" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-16.40.54@2x-1024x52.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-16.40.54@2x-300x15.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-16.40.54@2x-768x39.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-16.40.54@2x-1536x79.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-16.40.54@2x.png 1994w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>In this release, Jade’s output has been improved to limit scrolling when responses are shown, making it easier to read through the specific information and code samples. In addition, Jade now does a better job of parsing the results it gets, which prevents situations where responses could sometimes get cut off.</p>



<p>Lastly, Jade has had some fixes to improve reliability and has been updated to use Anthropic Claude Sonnet 4.6 for more detailed and accurate responses.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="914" src="https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-13.31.49@2x-1024x914.png" alt="" class="wp-image-16042" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-13.31.49@2x-1024x914.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-13.31.49@2x-300x268.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-13.31.49@2x-768x686.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-13.31.49@2x-1536x1371.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/03/CleanShot-2026-03-24-at-13.31.49@2x-2048x1828.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>These improvements may be small, but they allow Jade to continue to be a helpful Xojo coding assistant.</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>Custom Control Rendering with DrawControlInLayoutEditor</title>
		<link>https://blog.xojo.com/2026/03/31/custom-control-rendering-with-drawcontrolinlayouteditor/</link>
		
		<dc:creator><![CDATA[William Yu]]></dc:creator>
		<pubDate>Tue, 31 Mar 2026 15:22:00 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[2026r1]]></category>
		<category><![CDATA[DrawControlInLayoutEditor]]></category>
		<category><![CDATA[IDE]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=16045</guid>

					<description><![CDATA[One of the notable additions in Xojo 2026 Release 1 is that the&#160;DrawControlInLayoutEditor&#160;event is now available for Desktop and iOS/Android projects, giving you more possibilities&#8230;]]></description>
										<content:encoded><![CDATA[
<p>One of the notable additions in Xojo 2026 Release 1 is that the&nbsp;<code>DrawControlInLayoutEditor</code>&nbsp;event is now available for Desktop and iOS/Android projects, giving you more possibilities over how your controls appear in the layout editor.</p>



<p>With this feature you can provide custom drawing for a control at design time, making it easier to visualize your UI without running the project.</p>



<p>If this sounds familiar, it&#8217;s because it brings Desktop and iOS/Android projects closer to what&#8217;s already possible in Web projects with&nbsp;<code>WebSDKUIControl</code>, where custom layout rendering has been available for some time.</p>



<h4 class="wp-block-heading">Why this matters</h4>



<p>Previously your custom Canvas controls would appear as generic placeholders, making it difficult to understand how they would look at runtime. Now you can:</p>



<ul class="wp-block-list">
<li>Render a preview of your control directly in the layout editor</li>



<li>Display dynamic or state-based visuals</li>



<li>Make custom controls much easier to work with at design time</li>
</ul>



<h4 class="wp-block-heading">How it works</h4>



<p>For Desktop projects, you can subclass&nbsp;<code>DesktopUIControl</code>&nbsp;and implement the&nbsp;<code>DrawControlInLayoutEditor</code>&nbsp;event. Your drawing code is executed by the IDE as it renders the control in the layout. For iOS and Android projects, this event is available on&nbsp;<code>MobileUIControl</code>.</p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You can also use this event directly with&nbsp;<code>DesktopCanvas</code>&nbsp;and&nbsp;<code>MobileCanvas</code>&nbsp;controls, so you can start drawing in&nbsp;<code>DrawControlInLayoutEditor</code>&nbsp;without needing to subclass anything.</p>



<p>This event gives you the flexibility to draw whatever you need—shapes, text, or even simplified representations of runtime content. For example, a custom media player control could display a play button and timeline, or a chart control could render a sample graph.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="661" src="https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-3.03.15-PM-1024x661.png" alt="" class="wp-image-16049" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-3.03.15-PM-1024x661.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-3.03.15-PM-300x194.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-3.03.15-PM-768x496.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-3.03.15-PM-1536x991.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-3.03.15-PM-2048x1322.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h4 class="wp-block-heading">A note about XojoScript limitations</h4>



<p>One important detail to keep in mind is that&nbsp;<code>DrawControlInLayoutEditor</code>&nbsp;runs using XojoScript. This allows the IDE to safely execute your drawing code at design time, but it also means not everything you&#8217;d typically expect to use in Xojo is available, especially when it comes to the graphics APIs.</p>



<p>In practice, most common drawing operations—such as shapes, lines, and text—work as expected. However, in some cases these graphics calls use a slightly different API, as is the case with <code>LinearGradientBrush</code>.</p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Also, because this runs as XojoScript, you cannot call other methods from within your <code>DrawControlInLayoutEditor</code>code. To access your control&#8217;s properties, you&#8217;ll need to use the built-in  <code>ColorProperty</code>, <code>BooleanProperty</code>, <code>IntegerProperty</code>, <code>DoubleProperty</code>, and <code>StringProperty</code> methods.</p>



<h4 class="wp-block-heading">Support for more Graphics</h4>



<p>In 2026r1, we&#8217;ve expanded the graphics capabilities available to&nbsp;<code>DrawControlInLayoutEditor</code>, building on what was previously supported for&nbsp;<code>WebSDKUIControl</code>. New additions include support for:</p>



<ul class="wp-block-list">
<li>LinearGradientBrush, PictureBrush, and ShadowBrush</li>



<li>LineDash, LineDashOffset, LineCap, LineJoin, and MiterLimit</li>



<li>Outline</li>



<li>Scale, Rotate, and Translate</li>



<li>SaveState, RestoreState</li>



<li>Color constants (Red, Green, Blue, Yellow etc.)</li>
</ul>



<p>Since XojoScript does not support the&nbsp;<code>Pair</code>&nbsp;type, the&nbsp;<code>LinearGradientBrush</code>&nbsp;API was adapted slightly:</p>



<pre class="wp-block-code"><code>Class LinearGradientBrush

  Sub Constructor()

  Sub AddStop(stop As Double, c As Color)

  Property StartPoint As Point
  Property EndPoint As Point

End Class</code></pre>



<p>The main difference is how the brush is constructed and how stops are added, without needing&nbsp;<code>Pair</code>. With this new API, you can turn a basic graph into something much more visually appealing.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="661" src="https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-25-at-3.00.07-PM-1024x661.png" alt="" class="wp-image-16075" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-25-at-3.00.07-PM-1024x661.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-25-at-3.00.07-PM-300x194.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-25-at-3.00.07-PM-768x496.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-25-at-3.00.07-PM-1536x991.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-25-at-3.00.07-PM-2048x1322.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h4 class="wp-block-heading">Turning off this feature</h4>



<p>While many may prefer custom rendering for custom controls, it can become a bottleneck when a large number of controls are rendering content. If you prefer a less resource-intensive experience, you can disable this behavior in Settings → Layout by enabling the Static Rendering option.</p>



<h4 class="wp-block-heading">Finally</h4>



<p>With&nbsp;<code>DrawControlInLayoutEditor</code>&nbsp;now available for Desktop and Mobile projects, you can take advantage of the same benefits Web projects have enjoyed for years. Be sure to check out the new DrawControlInLayoutEditor example project, adapted from the WebSDK → CustomButton example. We hope you enjoy designing and previewing your custom controls with this new event—and yes, it also works in Libraries!</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>Watchpoints in Xojo: A Smarter Way to Track Your Data</title>
		<link>https://blog.xojo.com/2026/03/31/watchpoints-in-xojo-a-smarter-way-to-track-your-data/</link>
		
		<dc:creator><![CDATA[William Yu]]></dc:creator>
		<pubDate>Tue, 31 Mar 2026 13:22:00 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[2026r1]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Watchpoints]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15987</guid>

					<description><![CDATA[Debugging isn’t just about stepping through code anymore, it&#8217;s about understanding how your data behaves over time. With the new watchpoints feature in Xojo, you can&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Debugging isn’t just about stepping through code anymore, it&#8217;s about understanding how your data behaves over time. With the new watchpoints feature in Xojo, you can now monitor variables and object properties more intelligently, without constantly stepping line by line or adding logging just to see when values change.</p>



<h3 class="wp-block-heading">What Are Watchpoints?</h3>



<p>Watchpoints let you pause execution when the value of a variable or property changes. Instead of asking <em>“how did I get here?”</em>, watchpoints help you answer <em>“when did this change?”</em></p>



<p>This is especially useful when:</p>



<ul class="wp-block-list">
<li>A value is being modified unexpectedly</li>



<li>Multiple parts of your code interact with the same object</li>



<li>You’re tracking down subtle state-related bugs</li>
</ul>



<h3 class="wp-block-heading">How Watchpoints Work</h3>



<p>Setting up a watchpoint requires pausing execution where you would like to start monitoring the variable or property of an object.</p>



<figure class="wp-block-image size-large is-style-default"><img loading="lazy" decoding="async" width="1024" height="677" src="https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointSetupClipped-1024x677.jpg" alt="" class="wp-image-16018" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointSetupClipped-1024x677.jpg 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointSetupClipped-300x198.jpg 300w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointSetupClipped-768x508.jpg 768w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointSetupClipped.jpg 1446w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>In this example, we want to monitor the <code>count</code> variable, so you can right-click it in the variables debugger list and select <strong>Watch</strong> from the context menu.  Once a watchpoint is set on a variable or property, the debugger keeps track of its value during execution. When the value changes, execution pauses and shows the line that triggered the change. Notice that the watchpoint break line is highlighted differently from the current execution line, and a Watchpoints list is now displayed.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="667" src="https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointBreak-1024x667.png" alt="" class="wp-image-16014" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointBreak-1024x667.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointBreak-300x195.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointBreak-768x500.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointBreak-1536x1000.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointBreak-2048x1333.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>This gives you immediate visibility into:</p>



<ul class="wp-block-list">
<li>What code caused the modification</li>



<li>What the previous and new values are</li>



<li>What the surrounding state looks like</li>
</ul>



<h3 class="wp-block-heading">Why This Matters</h3>



<p>Traditionally, tracking down a value change required manually stepping through code or adding temporary logging. Both approaches are time-consuming and error-prone.</p>



<p>Watchpoints eliminate that friction by:</p>



<ul class="wp-block-list">
<li>Reducing the need for repetitive stepping</li>



<li>Highlighting only meaningful changes</li>



<li>Letting you focus on the root cause faster</li>
</ul>



<h3 class="wp-block-heading">Conditional Watchpoints</h3>



<p>Watchpoints in Xojo aren&#8217;t limited to triggering on every change—you can make them conditional. For example, you can break only when a value is equal to, greater than, or less than a specific threshold, or even when it falls within a defined range. For string, both case-sensitive and case-insensitive comparisons are supported. This makes it much easier to focus on the changes that actually matter, especially when a variable updates frequently but only becomes problematic under certain conditions.</p>



<p>To add a condition to a watchpoint, right-click the watched variable or property and choose&nbsp;<strong>Edit Watchpoint Expression</strong> from the context menu.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="695" src="https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointExpression-1024x695.png" alt="" class="wp-image-16020" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointExpression-1024x695.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointExpression-300x204.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointExpression-768x522.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/WatchpointExpression.png 1496w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>The expression editor adapts based on the type of variable or property you&#8217;re watching, providing hints about what values and conditions you can enter.</p>



<h3 class="wp-block-heading">Handling Object Lifetimes</h3>



<p>One important detail when working with watchpoints is object lifetime.</p>



<p>If a watchpoint is attached to a property of an object that goes out of scope or is destroyed, the debugger can no longer track it. In these cases, Xojo provides feedback through the Messages pane so you know the watchpoint is no longer valid, along with the last known value.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="890" height="180" src="https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-9.33.52-AM.png" alt="" class="wp-image-16021" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-9.33.52-AM.png 890w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-9.33.52-AM-300x61.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-9.33.52-AM-768x155.png 768w" sizes="auto, (max-width: 890px) 100vw, 890px" /></figure>



<h3 class="wp-block-heading">What works and what doesn&#8217;t</h3>



<p>You can set watchpoints on most variables and properties, even variants; however, Arrays, Structures, and computed properties are not supported. Code within <code>#pragma DisableBackgroundTasks</code> or <code>#pragma Debug False</code> blocks will not trigger watchpoint breaks. Watchpoints are also not currently available for Android projects.</p>



<h3 class="wp-block-heading">Final Thoughts</h3>



<p>Watchpoints bring a new level of precision to debugging in Xojo. Instead of chasing bugs through code, you can now let the debugger do the work of tracking down exactly where things go wrong.</p>



<p>Give them a try in your next debugging session—you might find yourself solving problems faster than ever!</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>Code Signing on macOS: What Developers Need to Know, Part 3</title>
		<link>https://blog.xojo.com/2026/03/24/code-signing-on-macos-what-developers-need-to-know-part-3/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Tue, 24 Mar 2026 16:00:00 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apple Developer Account]]></category>
		<category><![CDATA[Code Signing]]></category>
		<category><![CDATA[Distribution]]></category>
		<category><![CDATA[macOS]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15944</guid>

					<description><![CDATA[If you followed the previous two articles in this series, you should be set up properly now, right? Your Mac developer certificates are stored in&#8230;]]></description>
										<content:encoded><![CDATA[
<p>If you followed the previous two articles in this series, you should be set up properly now, right? Your Mac developer certificates are stored in Keychain Access, so you only need to fill in the Developer ID field under Build Settings &gt; macOS &gt; Sign with the appropriate certificate value, click Build (or Publish), and distribute your new amazing app worldwide. Well, not quite. There are still other pieces to consider when signing and distributing your macOS app.</p>



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



<p>For the past 20 years, Apple has increasingly tightened security measures when it comes to running apps distributed by third parties. Let&#8217;s take a look at this summarized timeline of code-signing and security measures added by Apple over years:</p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="https://blog.xojo.com/wp-content/uploads/2026/03/macOS-signing-Timeline-scaled.png"><img loading="lazy" decoding="async" width="2560" height="1056" src="https://blog.xojo.com/wp-content/uploads/2026/03/macOS-signing-Timeline-scaled.png" alt="" class="wp-image-15945" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/macOS-signing-Timeline-scaled.png 2560w, https://blog.xojo.com/wp-content/uploads/2026/03/macOS-signing-Timeline-300x124.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/macOS-signing-Timeline-1024x422.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/macOS-signing-Timeline-768x317.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/macOS-signing-Timeline-1536x634.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/03/macOS-signing-Timeline-2048x845.png 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></a></figure>
</div>


<p>The most notable developments happened in 2011, 2012 and 2018, when terms like Sandbox and, especially, Containers, Gatekeeper, Hardened Runtime and Notarization were introduced and began to impact other pieces of the puzzle to consider when signing macOS apps. In fact, we could say that technologies such as code-signing, Sandboxing, Entitlements or Provisioning Profiles were among the first iOS technologies to make their way to macOS.</p>



<p>So here is an broad overview what these technologies mean:</p>



<ul class="wp-block-list">
<li><strong>Sandboxing</strong>&#8211; When used, Sandboxing confines applications to a restricted, designated area of the system (its own &#8220;container&#8221;), preventing them from accessing user data, hardware or other apps without explicit permission. The system requires apps to ask for permission to use hardware resources or access user files. Sandboxing is mandatory for apps distributed through the Mac App Store.</li>



<li><strong>Gatekeeper-</strong> This technology is the primary security layer that checks whether a downloaded app comes from a verified/known developer, especially when the application has been Notarized by Apple.</li>



<li><strong>Hardened Runtime</strong>&#8211; Acts as a proactive, system-enforced shield that protects applications while they run, preventing malicious code from exploiting legitimate software. Enabling Hardened Runtime is required for Notarization.</li>



<li><strong>Notarization</strong>&#8211; Notarization is an automated security screening process run by Apple that scans software distributed outside the Mac App Store for malicious components and known security issues. Today, notarization is required for software distributed outside the Mac App Store that has been signed with the Developer ID application certificate. As a result of the process, notarization generates and staples a ticket, signed by an Apple certificate, to the app so Gatekeeper can trust it when executed.</li>
</ul>



<p>So, basically, while Sandboxing is still optional for apps distributed outside the Mac App Store (i.e., signed with your Developer ID certificate), Notarization and Hardened Runtime are the recommended defaults. Enabling Sandboxing for your app is something you should consider based on the needs (features) and the privacy balance you want to offer your users.</p>



<p>If you plan to distribute the app through the Mac App Store as well, it will need to be Sandboxed and signed with your Apple Distribution certificate, while enabling Hardened Runtime is optional.</p>



<h2 class="wp-block-heading">Entitlements and Provisioning Profiles</h2>



<p>Entitlements and Provisioning Profiles are also required for many of these security measures, depending on the features and services your app uses, and they come into play during building and signing.</p>



<p>If you decide to go the Sandboxing route, then using Entitlements is mandatory. The good news is that Sandboxing entitlements are free to use (they don’t require creating or adding a Provisioning Profile to the project). However, if your app needs special access to the Keychain or uses iCloud, Apple Pay, or other services, you’ll need to create a Provisioning Profile in the Apple Developer portal.</p>



<p>Wait—what are Entitlements and Provisioning Profiles, and how do they relate to macOS app code signing?</p>



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



<p>Entitlements are XML-based .plist files (not unlike the app’s Info.plist) containing a set of key-value pairs. They are embedded directly into the app’s binary as part of the code signing process, typically using your Developer ID Application or Apple Distribution certificates.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="931" height="651" src="https://blog.xojo.com/wp-content/uploads/2026/03/Entitlements.png" alt="" class="wp-image-15946" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/Entitlements.png 931w, https://blog.xojo.com/wp-content/uploads/2026/03/Entitlements-300x210.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/Entitlements-768x537.png 768w" sizes="auto, (max-width: 931px) 100vw, 931px" /></figure>



<h3 class="wp-block-heading">Provisioning Profiles</h3>



<p>While Entitlements are just a file, Provisioning Profiles are a different beast:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="911" height="514" src="https://blog.xojo.com/wp-content/uploads/2026/03/Provisioning-Profiles.png" alt="" class="wp-image-15947" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/Provisioning-Profiles.png 911w, https://blog.xojo.com/wp-content/uploads/2026/03/Provisioning-Profiles-300x169.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/Provisioning-Profiles-768x433.png 768w" sizes="auto, (max-width: 911px) 100vw, 911px" /></figure>



<p>Provisioning Profiles must be created in the Apple Developer Portal. When you create one, you specify the App ID (the combination of your Team ID and the app bundle identifier which are case sensitive so pay attention). Even if you don’t plan to distribute your macOS app via the Mac App Store, you still need a Provisioning Profile, which requires creating an App ID first in the Developer Portal.</p>



<p>There are two kinds of Provisioning Profiles: Development and Distribution. As part of the provisioning profile creation, you must choose which type you will use.</p>



<ul class="wp-block-list">
<li><strong>Development Provisioning Profiles</strong> are used while you’re developing your app; the app is signed with an Apple Development certificate and is intended to run on a set of Mac computers you’ve registered. During creation, you can add as many Apple Development certificates as you have under your Team ID.</li>



<li><strong>Distribution Provisioning Profiles</strong> are used when distributing your app. For direct distribution, sign with the same Developer ID certificate you’ll use for signing the app; for Mac App Store distribution, sign with the Apple Distribution certificate.</li>



<li><strong>Development and Distribution Provisioning Profiles do expire</strong>. This is something to keep in mind, especially when deploying new or updated versions of your app, because you may need to create new profiles.</li>



<li><strong>Development and Distribution Profiles are editable</strong>. If you make a mistake, note that both types can be edited in the Apple Developer portal, but only for certain fields: the App ID, the profile name, the selected certificate, and (for Development profiles) the included testing devices.</li>
</ul>



<h2 class="wp-block-heading">When Certificates and/or Provisioning Profiles expire…</h2>



<p>We’ve already noted in previous articles that Apple Developer certificates expire one year after they’re created. We’ve also learned that if your app relies on a Distribution Provisioning Profile, that profile can expire as well. So, what does this mean for your already deployed apps?</p>



<p>No worries. Let’s focus first on directly distributed macOS apps (those signed with the Developer ID certificate) and pull one screenshot from the previous article:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1740" height="882" src="https://blog.xojo.com/wp-content/uploads/2026/03/Timestamp.png" alt="" class="wp-image-15948" srcset="https://blog.xojo.com/wp-content/uploads/2026/03/Timestamp.png 1740w, https://blog.xojo.com/wp-content/uploads/2026/03/Timestamp-300x152.png 300w, https://blog.xojo.com/wp-content/uploads/2026/03/Timestamp-1024x519.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/03/Timestamp-768x389.png 768w, https://blog.xojo.com/wp-content/uploads/2026/03/Timestamp-1536x779.png 1536w" sizes="auto, (max-width: 1740px) 100vw, 1740px" /></figure>



<p>Observe the highlighted Timestamp line. When the app is signed, the date is added automatically (retrieved from Apple’s servers). So, when a user runs an app whose embedded Developer ID Certificate has expired since its release, Gatekeeper will rely on that timestamp, compare it to the embedded certificate’s expiration date, and if everything matches—meaning it was signed before the certificate expired—the app will continue to work, provided the embedded certificate has not been revoked by the developer. In addition, if the app was Notarized, that helps a lot, because the stapled ticket includes its own timestamp and was signed with a longer-lasting Apple Certificate.</p>



<p>If the app is distributed through the Mac App Store, there’s good news. After you submit the app for distribution via App Store Connect and it passes Apple’s review, the app’s signing with your Apple Distribution certificate is replaced by Apple’s own signing. This means that users who install the app from the Mac App Store can continue to run it even if your original Apple Distribution certificate expired long ago.</p>



<p>Distribution Provisioning Profiles behave differently from others: once they expire, the app containing such a Distribution Profile will fail to execute.</p>



<p>The good news is that a Distribution Profile lasts for a very long time (around 18 years) so you’ll likely have ample time to create new distribution provisioning profiles and deploy updates that use renewed profiles well before users are affected.</p>



<p>Of course, as soon as any of your Apple Developer certificates expire, you already know how to request and install new ones in your Mac keychain.</p>



<h2 class="wp-block-heading">Nearly Concluded</h2>



<p>In the next, and last article, we will see how Xojo helps with everything related to signing and distributing your macOS apps. I&#8217;ll also show you how to deal with some of the most common issues related with certificates.</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>



<p><strong>Code Signing on macOS: What Developers Need to Know</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2026/03/04/code-signing-on-macos-what-developers-need-to-know-part-1/" target="_blank" rel="noreferrer noopener">Part 1, Get Started</a></li>



<li><a href="https://blog.xojo.com/2026/03/18/code-signing-on-macos-what-developers-need-to-know-part-2/" target="_blank" rel="noreferrer noopener">Part 2, Code Signing With Developer Certificates</a></li>



<li><a href="https://blog.xojo.com/2026/03/24/code-signing-on-macos-what-developers-need-to-know-part-3/">Part 3, Entitlements and Provisioning Profiles</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Code Signing on macOS: What Developers Need to Know, Part 2</title>
		<link>https://blog.xojo.com/2026/03/18/code-signing-on-macos-what-developers-need-to-know-part-2/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Wed, 18 Mar 2026 14:00:00 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apple Developer Account]]></category>
		<category><![CDATA[Code Signing]]></category>
		<category><![CDATA[Distribution]]></category>
		<category><![CDATA[macOS]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15864</guid>

					<description><![CDATA[On the Apple side of code signing with developer certificates, we already know that the required root certificate, acting as the base anchor of the&#8230;]]></description>
										<content:encoded><![CDATA[
<p>On the Apple side of code signing with developer certificates, we already know that the required root certificate, acting as the base anchor of the trust chain, is installed already on our Macs under the System Roots keychain.</p>



<p>But before we can reach our leaf developer certificates,&nbsp;we also need to have the Apple Development Intermediate certificates installed in our keychain. These are typically found in the Login keychain, though they can also be found in the System Roots or System keychains.</p>



<h2 class="wp-block-heading">Installing Apple Developer Intermediate Certificates</h2>



<p>Since Xcode 11.4.1 and later, these can be automatically downloaded and installed in the keychain, but if not, they can also can be downloaded from the <a href="https://www.apple.com/certificateauthority/" target="_blank" rel="noreferrer noopener">Apple PKI</a> webpage. The ones we are interested in are:</p>



<ul class="wp-block-list">
<li>Developer ID &#8211; G2</li>



<li>Worldwide Developer Relations &#8211; G2</li>



<li>Worldwide Developer Relations &#8211; G3</li>



<li>Worldwide Developer Relations &#8211; G4</li>



<li>Worldwide Developer Relations &#8211; G5</li>



<li>Worldwide Developer Relations &#8211; G6</li>
</ul>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Note: The Developer ID &#8211; G2 certificate corresponds to the Developer ID Certification Authority. The WWDR certificates (G2–G6) correspond to the Apple Worldwide Developer Relations Certification Authority.</p>
</blockquote>



<p>As you can see from the list, there are several versions (or generations) for the WWDR Intermediate certificate; so, which one should you download? The short answer: it depends.</p>



<p>On February, 7, 2023 the previous WWDR intermediate certificate expired; so Apple decided to rollout a new renewed version that will expire on February 20, 2030. As part of that update Apple issued additional Intermediate certificates to better segment the purpose of different certificates:</p>



<ul class="wp-block-list">
<li>G2: ECDSA signing for Apple Pay.</li>



<li>G3: Software signing and Services.</li>



<li>G4: Features supported by Apple Push Notification Service.</li>



<li>G5: App Store Signing and Services.</li>



<li>G6: ECDSA signing of Software and Services.</li>
</ul>



<p>In practice, G3, G4, and G5 are sufficient for most scenarios.</p>



<h2 class="wp-block-heading">Developer Certificates: The final goal!</h2>



<p>To focus on the subject, what kind of leaf developer certificates are created from these two types of Intermediate certificates? This scheme will help:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1644" height="912" src="https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Development-Certificates-Chain-Of-Trust.png" alt="" class="wp-image-15865" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Development-Certificates-Chain-Of-Trust.png 1644w, https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Development-Certificates-Chain-Of-Trust-300x166.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Development-Certificates-Chain-Of-Trust-1024x568.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Development-Certificates-Chain-Of-Trust-768x426.png 768w, https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Development-Certificates-Chain-Of-Trust-1536x852.png 1536w" sizes="auto, (max-width: 1644px) 100vw, 1644px" /></figure>



<p>As you can see from the above diagram, there are four main leaf certificates we will use to sign our macOS apps, based on their prefix:</p>



<ul class="wp-block-list">
<li><strong>Developer ID Application</strong>. Use this one to code sign a macOS app distributed outside the Mac App Store.</li>



<li><strong>Developer ID Installer</strong>. Use this one to code sign the Installer, DMG or .pgk file of a macOS app distributed outside the Mac App Store.</li>



<li><strong>Apple Distribution</strong>. This certificate is required to code sign a macOS app sent to the AppStore Connect for its distribution through the Mac App Store.</li>



<li><strong>3rd Party Mac Developer Installer</strong>. This Certificate is required to code sign the package of the app sent to the AppStore Connect. For example, when using the Publish feature from the Xojo IDE.</li>
</ul>



<h2 class="wp-block-heading">Creating and Installing the Developer Certificates</h2>



<p>As stated in the <a href="https://blog.xojo.com/2026/03/04/code-signing-on-macos-what-developers-need-to-know-part-1/" target="_blank" rel="noreferrer noopener">first article</a> of this series, you need a paid Apple Developer Program membership. Once that’s in place, the easiest way to install these required certificates in your macOS Keychain is through Xcode.</p>



<p>So, if it is the first time you need to install them on a Mac computer:</p>



<ol class="wp-block-list">
<li>Go to Xcode &gt; Preferences.</li>



<li>Select Apple Accounts.</li>



<li>Use your developer credentials to login into your developer account, or select it from the list if you are already logged.</li>



<li>Select the Team from the list.</li>



<li>Click the &#8220;Manage Certificates…&#8221; button.</li>



<li>Click the &#8220;+&#8221; popup menu in the lower-left corner of the resulting window, and select the developer certificate you want to install (all of these if it is the first time you install them).</li>
</ol>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="468" height="398" src="https://blog.xojo.com/wp-content/uploads/2026/02/Captura-de-pantalla-2026-02-25-a-las-15.53.00.png" alt="" class="wp-image-15866" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Captura-de-pantalla-2026-02-25-a-las-15.53.00.png 468w, https://blog.xojo.com/wp-content/uploads/2026/02/Captura-de-pantalla-2026-02-25-a-las-15.53.00-300x255.png 300w" sizes="auto, (max-width: 468px) 100vw, 468px" /></figure>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>Note:</strong> Under the hood, Xcode follows the same process described for installing the developer certificates manually.</p>
</blockquote>



<p>If you prefer to go through the manual process instead:</p>



<ol class="wp-block-list">
<li>Access the <a href="https://developer.apple.com" target="_blank" rel="noreferrer noopener">Apple Developer website</a>.</li>



<li>In <a href="https://developer.apple.com/account/resources" target="_blank" rel="noreferrer noopener">Certificates, Identifiers &amp; Profiles, click Certificates in the sidebar.</a></li>



<li>On the top left, click the add button (+).</li>



<li>Under Software, select Developer ID, then click Continue.
<ul class="wp-block-list">
<li><strong>Developer ID Application</strong>: This certificate is used to code sign your app for distribution outside of the Mac App Store Connect.</li>



<li><strong>Developer ID Installer</strong>: This certificate is used to sign your app’s installer Package for distribution outside of the Mac App Store Connect.</li>



<li><strong>Apple Development</strong>: Used to run and debug apps on macOS during development.</li>



<li><strong>Apple Distribution</strong>: Used to sign apps for submission to App Store Connect.</li>



<li><strong>Mac App Distribution</strong>: Used to sign macOS apps intended to be distributed through the Mac App Store.</li>



<li><strong>Mac Installer Distribution</strong>: Used to send the macOS app to the App Store Connect for TestFlight or distribution through the Mac App Store.</li>
</ul>
</li>



<li>Follow the instructions to <a href="https://developer.apple.com/help/account/certificates/create-a-certificate-signing-request" target="_blank" rel="noreferrer noopener">create a certificate signing request</a>.</li>



<li>Click Choose File.</li>



<li>In the dialog that appears, select the certificate request file (a file with a .certSigningRequest file extension), then click Choose.</li>



<li>Click Continue.</li>



<li>Click Download.</li>



<li>The certificate file (a file with a .cer file extension) appears in your Downloads folder.</li>



<li>To install the certificate in your keychain, double-click the downloaded certificate file. The certificate appears in the My Certificates category in Keychain Access.</li>
</ol>



<h2 class="wp-block-heading">It&#8217;s All About Identities</h2>



<p>While Intermediate and Root certificates only have the Public Key on them, so they can verify other (leaf) certificates, the leaf certificates installed on your macOS Login keychain behave a bit different. Let&#8217;s see how.</p>



<p>Both if you use Xcode or create the CSR request manually to generate the developer certificates, using the Keychain Access app for that, in both of these scenarios <strong>a Private Key will be created and stored locally on your keychain</strong> as part of the process. <strong>Only the public key section of that private key is sent to the Apple servers</strong> so it can be included in the generated developer certificate. Once any of the possible developer certificates is downloaded and installed in the keychain, such certificate will have its private key associated with it:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="872" height="88" src="https://blog.xojo.com/wp-content/uploads/2026/02/Screenshot-2026-02-25-at-4.20.45-PM.png" alt="" class="wp-image-15867" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Screenshot-2026-02-25-at-4.20.45-PM.png 872w, https://blog.xojo.com/wp-content/uploads/2026/02/Screenshot-2026-02-25-at-4.20.45-PM-300x30.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Screenshot-2026-02-25-at-4.20.45-PM-768x78.png 768w" sizes="auto, (max-width: 872px) 100vw, 872px" /></figure>



<p>The pair of the developer certificate and the associated private key is what is called an Identity.</p>



<h2 class="wp-block-heading">Code signing With Developer Certificates</h2>



<p>In fact, while we often say or hear “code signing with certificates,” the real signing of the app is done with the private key associated with that certificate. The certificate itself (and thus the public key portion of that key pair) is included in the signing process. This allows macOS to verify the signature each time the user runs the app</p>



<p>Do you remember the diagram showing how the &#8220;Ad-Hoc&#8221; code signing process works? Let&#8217;s compare it when the same process is done using a &#8220;Developer ID Application&#8221; Certificate… and, most important, the associated private key:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1724" height="812" src="https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Certificate-Signing.png" alt="" class="wp-image-15869" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Certificate-Signing.png 1724w, https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Certificate-Signing-300x141.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Certificate-Signing-1024x482.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Certificate-Signing-768x362.png 768w, https://blog.xojo.com/wp-content/uploads/2026/02/Apple-Certificate-Signing-1536x723.png 1536w" sizes="auto, (max-width: 1724px) 100vw, 1724px" /></figure>



<p>As you can see, in this case the data is cyphered using the private key from the developer certificate and, then, the certificate itself is stored as part of the app itself. So, if for example we build this time an empty Desktop app for macOS using the Developer ID Application, and open the resulting CodeResources file in a text editor we will see something different compared with the Ad-Hoc signed version:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1298" height="974" src="https://blog.xojo.com/wp-content/uploads/2026/02/CodeResources_Signed.png" alt="" class="wp-image-15870" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/CodeResources_Signed.png 1298w, https://blog.xojo.com/wp-content/uploads/2026/02/CodeResources_Signed-300x225.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/CodeResources_Signed-1024x768.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/CodeResources_Signed-768x576.png 768w" sizes="auto, (max-width: 1298px) 100vw, 1298px" /></figure>



<p>In this case the field <strong>requirement&nbsp;</strong>associated with each file and hash value is significantly more strict. In fact, it makes reference to the Chain of Trust Gatekeeper is required to follow and validate. In plain English, the highlighted lines come to say something like:</p>



<ol class="wp-block-list">
<li>Hey! make sure there is a <strong>Developer ID Application</strong> certificate (Apple Extension attribute —OID— <em>1.2.840.113635.100.6.1.13&nbsp;</em>for the X.509 certificate), for the developer with a <strong>TeamID</strong> BW7PU32485.</li>



<li>Next, verify such certificate is issued by the &#8220;<strong>Apple Developer ID Certificate Authority</strong>&#8221; (other of the Apple-specific X.509 extension, attribute or OID. In this case: 1.2.840.113635.100.6.2.6).</li>



<li>And finally, go down through the Chain of Trust and verify the previous one with the <strong>Anchor</strong> certificate (Apple Root CA, do you remember?)</li>
</ol>



<p>So far so good. But how we can know if the app meets these requirements; and what about the certificates themselves? Well, it&#8217;s easy to check both using the codesign tool.</p>



<p>Open a Terminal window and type the following command:</p>



<pre class="wp-block-preformatted">codesign --verify -vvv "MyApp.app"</pre>



<p>The output will be something similar to this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="2198" height="336" src="https://blog.xojo.com/wp-content/uploads/2026/02/codesign-SatisfiedRequirement.png" alt="" class="wp-image-15871" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/codesign-SatisfiedRequirement.png 2198w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-SatisfiedRequirement-300x46.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-SatisfiedRequirement-1024x157.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-SatisfiedRequirement-768x117.png 768w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-SatisfiedRequirement-1536x235.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-SatisfiedRequirement-2048x313.png 2048w" sizes="auto, (max-width: 2198px) 100vw, 2198px" /></figure>



<p>As you can see in the highlighted lines, yes, it satisfies the <strong>Designated Requirements</strong> we saw in our CodeResources file! Also, the previous line states that it is valid on disk. That means:</p>



<ul class="wp-block-list">
<li>All of the expected files are present.</li>



<li>There are no extra files.</li>



<li>None of the files have been modified.</li>



<li>A basic trust evaluation of the leaf certificate was successful.</li>



<li>And it satisfies its own Designated Requirements (DR).</li>
</ul>



<p>It is even possible to see the Chain of Trust for the code signature issuing:</p>



<pre class="wp-block-preformatted">codesign --display -vv "MyApp.app"&nbsp;</pre>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1222" height="340" src="https://blog.xojo.com/wp-content/uploads/2026/02/Codesign-ChainOfTrust.png" alt="" class="wp-image-15872" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Codesign-ChainOfTrust.png 1222w, https://blog.xojo.com/wp-content/uploads/2026/02/Codesign-ChainOfTrust-300x83.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Codesign-ChainOfTrust-1024x285.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Codesign-ChainOfTrust-768x214.png 768w" sizes="auto, (max-width: 1222px) 100vw, 1222px" /></figure>



<p>And if you are curious enough, it is even possible to extract the embedded certificates stored in the <a href="https://www.ietf.org/rfc/rfc3852.txt" target="_blank" rel="noreferrer noopener">CMS structure within the code signature</a>:</p>



<pre class="wp-block-preformatted">codesign --display --extract-certificates "MyApp.app"</pre>



<p>As result it will, usually, create three files. Take a closer look at the &#8220;Issuer&#8221; and &#8220;Subject&#8221; lines; specially on the Subject line for the OU value (Organizative Unit or, using Apple wording, the TeamID) for the codesign0 file. Do you remember the &#8220;leaf[subject.OU=BW7PU32485]&#8221; data from the CodeResources file?&nbsp;:</p>



<p><strong>codesign0.</strong> This is the file for the Leaf certificate; in our example &#8220;Developer ID Application&#8221;.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1820" height="368" src="https://blog.xojo.com/wp-content/uploads/2026/02/codesign-DeveloperIDCertificate.png" alt="" class="wp-image-15873" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/codesign-DeveloperIDCertificate.png 1820w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-DeveloperIDCertificate-300x61.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-DeveloperIDCertificate-1024x207.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-DeveloperIDCertificate-768x155.png 768w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-DeveloperIDCertificate-1536x311.png 1536w" sizes="auto, (max-width: 1820px) 100vw, 1820px" /></figure>



<p><strong>codesign1.</strong> This one is for the Intermediate Certificate; in our example &#8220;Apple Developer ID Certificate Authority&#8221;.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1562" height="366" src="https://blog.xojo.com/wp-content/uploads/2026/02/codesign-IntermediateCertificate.png" alt="" class="wp-image-15874" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/codesign-IntermediateCertificate.png 1562w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-IntermediateCertificate-300x70.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-IntermediateCertificate-1024x240.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-IntermediateCertificate-768x180.png 768w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-IntermediateCertificate-1536x360.png 1536w" sizes="auto, (max-width: 1562px) 100vw, 1562px" /></figure>



<p><strong>codesign2.</strong> This one is for the Anchor Certificate; in our example &#8220;Apple Root CA&#8221;</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1274" height="344" src="https://blog.xojo.com/wp-content/uploads/2026/02/codesign-RootCertificate.png" alt="" class="wp-image-15875" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/codesign-RootCertificate.png 1274w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-RootCertificate-300x81.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-RootCertificate-1024x276.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/codesign-RootCertificate-768x207.png 768w" sizes="auto, (max-width: 1274px) 100vw, 1274px" /></figure>



<p><br>As shown by the <strong>Issuer</strong> line in the codesign0 file for our “Developer ID Application,” it points to the previous certificate in the trust chain—the Developer ID Certification Authority. The codesign1 file for the extracted Developer ID Certification Authority points to the Apple Certification Authority in its Issuer field. Finally, the codesign1 certificate points to itself because, as the Root Certificate, it serves as the <strong>anchor</strong> for the trust chain.</p>



<h2 class="wp-block-heading">Wrapping up</h2>



<p>In this second article, we delved deeper into how Apple Developer certificates work, how a macOS app is signed (Ad-Hoc or with a specific developer certificate), and how the OS’s security features validate the signing when a user tries to run the app.</p>



<p>In the next article, we will cover more details about signing apps for the two main distribution types: Direct distribution and Mac App Store. We will also discuss what happens when certificates expire and how to troubleshoot the most common issues related to development certificates.</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>



<p><strong>Code Signing on macOS: What Developers Need to Know</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2026/03/04/code-signing-on-macos-what-developers-need-to-know-part-1/" target="_blank" rel="noreferrer noopener">Part 1, Get Started</a></li>



<li><a href="https://blog.xojo.com/2026/03/18/code-signing-on-macos-what-developers-need-to-know-part-2/" target="_blank" rel="noreferrer noopener">Part 2, Code Signing With Developer Certificates</a></li>



<li><a href="https://blog.xojo.com/2026/03/24/code-signing-on-macos-what-developers-need-to-know-part-3/">Part 3, Entitlements and Provisioning Profiles</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Code Signing on macOS: What Developers Need to Know, Part 1</title>
		<link>https://blog.xojo.com/2026/03/04/code-signing-on-macos-what-developers-need-to-know-part-1/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Wed, 04 Mar 2026 16:00:00 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apple Developer Account]]></category>
		<category><![CDATA[Code Signing]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Distribution]]></category>
		<category><![CDATA[macOS]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15856</guid>

					<description><![CDATA[Your macOS app is finished and ready to go. But unless you plan to run it only on your own machine, there’s one essential step&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Your macOS app is finished and ready to go. But unless you plan to run it only on your own machine, there’s one essential step before sharing it with others: code signing with certificates.</p>



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



<p>This blog series provides a clear, practical overview of how certificates work, with a focus on signing and distributing macOS applications. Some concepts apply to digital certificates in general, while others are specific to the macOS code signing process. By the end of the series, you’ll understand what certificates are, why they matter, and the role they play when building and distributing a macOS app.</p>



<p>The Developer ID field in the Build Settings &gt; macOS &gt; Sign Inspector Panel is our starting point:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1000" height="574" src="https://blog.xojo.com/wp-content/uploads/2026/02/Captura-de-pantalla-2026-02-26-a-las-10.51.17.png" alt="" class="wp-image-15857" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Captura-de-pantalla-2026-02-26-a-las-10.51.17.png 1000w, https://blog.xojo.com/wp-content/uploads/2026/02/Captura-de-pantalla-2026-02-26-a-las-10.51.17-300x172.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Captura-de-pantalla-2026-02-26-a-las-10.51.17-768x441.png 768w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></figure>



<p>By default, this field is empty. When you click Build, the app bundle (and its contents) is signed using a more relaxed security configuration. This does not require an explicit developer certificate and does not verify that the app comes from a known, trusted developer.</p>



<p>This type of signing is called Ad-Hoc signing. It is perfectly fine when debugging from the IDE or when building apps you intend to run locally.</p>



<p>In earlier versions of macOS, it was even possible to distribute and run Ad-Hoc–signed apps on other Macs, as long as the user explicitly chose to trust them. While this is still technically possible on recent versions of macOS, Apple has continued to tighten security, making it increasingly difficult for users to launch Ad-Hoc–signed applications.</p>



<p>In most cases, <a href="https://support.apple.com/en-au/guide/security/sec5599b66df/web" target="_blank" rel="noreferrer noopener">Gatekeeper</a> will intervene and prevent the app from launching. Since the system cannot verify the identity of a trusted developer, it treats the app as unverified. With Ad-Hoc signing, macOS can only confirm that the app has not been modified since it was signed, it cannot validate who created it.</p>



<h2 class="wp-block-heading">Under the hood: How &#8220;Ad-Hoc&#8221; signing works</h2>



<p>Every time an app is signed (including all the contents inside its bundle) macOS uses Apple’s codesign tool. When Ad-Hoc signing is applied, the simplified process works roughly like this:<br></p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1390" height="812" src="https://blog.xojo.com/wp-content/uploads/2026/02/Ad-Hoc-How-it-works.png" alt="" class="wp-image-15858" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Ad-Hoc-How-it-works.png 1390w, https://blog.xojo.com/wp-content/uploads/2026/02/Ad-Hoc-How-it-works-300x175.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Ad-Hoc-How-it-works-1024x598.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Ad-Hoc-How-it-works-768x449.png 768w" sizes="auto, (max-width: 1390px) 100vw, 1390px" /></figure>



<ul class="wp-block-list">
<li>A hash value (a unique digital fingerprint) is calculated for every file in the app bundle, whether it is executable or not, as well as for the bundle itself.</li>



<li>These hash values are stored inside the app bundle, in the <code>_CodeSignature</code> folder.</li>



<li>If the app contains multiple architectures (for example, x86 and ARM), the process is repeated for each supported architecture.</li>
</ul>



<p>When a user double-clicks the app to launch it, macOS performs a similar verification process:</p>



<ul class="wp-block-list">
<li>It recalculates the hash value for every file in the bundle.</li>



<li>It compares the newly calculated values with those stored in the <code>_CodeSignature</code> folder and if any hash differs from the stored value, macOS determines that the bundle has been modified since it was signed and it will refuse to launch the app.</li>
</ul>



<p>Want to see this in action? Create a new Desktop project in the Xojo IDE, save it to your Documents folder, and build it for macOS.</p>



<p>Next, locate the built app in Finder. Control-click it and choose “Show Package Contents.” Then open the Contents &gt; _CodeSignature folder and inspect the CodeResources file using your favorite text editor. You’ll see a list of hash values and digests corresponding to every file in the app bundle.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1248" height="1344" src="https://blog.xojo.com/wp-content/uploads/2026/02/SignatureFile.png" alt="" class="wp-image-15859" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/SignatureFile.png 1248w, https://blog.xojo.com/wp-content/uploads/2026/02/SignatureFile-279x300.png 279w, https://blog.xojo.com/wp-content/uploads/2026/02/SignatureFile-951x1024.png 951w, https://blog.xojo.com/wp-content/uploads/2026/02/SignatureFile-768x827.png 768w" sizes="auto, (max-width: 1248px) 100vw, 1248px" /></figure>



<h2 class="wp-block-heading">Apple Developer Certificates: Establishing Trust on macOS</h2>



<p>What must you do so your apps are recognized as first-class citizens on macOS and can be distributed without Gatekeeper intervening? The answer is likely familiar: enroll in the Apple Developer Program (currently US $99 per year).</p>



<p>Among its many benefits, membership in the Apple Developer Program allows you to create your own Developer ID certificates. When you use these certificates to sign your apps, macOS can validate the signature and identify you as the verified developer distributing the software.</p>



<p>But how is this trust established and verified? To answer that, we need to start at the very root, literally!</p>



<p>Every computer, smartphone, tablet, and many other devices come with preinstalled Root Certificates. These certificates are issued by trusted organizations known as Root Certificate Authorities (CAs), including Apple. They serve as the foundation of a chain of trust, allowing other certificates issued by those authorities to be verified.</p>



<p>Technically speaking, a Root Certificate Authority (CA) is the top-level trusted entity in a public key infrastructure (<a href="https://en.wikipedia.org/wiki/Public_key_infrastructure">PKI</a>). It issues self-signed root certificates that act as the trust anchor for verifying other digital certificates. In other words, it is the foundation upon which the entire certificate trust model is built.</p>



<p>It is easy to take a look to these installed on your Mac:</p>



<ol class="wp-block-list">
<li>Open Keychain Access.</li>



<li>Select Certificates at the top of the window.</li>



<li>In the sidebar, choose System Roots.</li>



<li>You will then see the complete list of root certificates trusted by macOS.</li>
</ol>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="2186" height="1264" src="https://blog.xojo.com/wp-content/uploads/2026/02/Root-Certificates.png" alt="" class="wp-image-15860" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Root-Certificates.png 2186w, https://blog.xojo.com/wp-content/uploads/2026/02/Root-Certificates-300x173.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Root-Certificates-1024x592.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Root-Certificates-768x444.png 768w, https://blog.xojo.com/wp-content/uploads/2026/02/Root-Certificates-1536x888.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/02/Root-Certificates-2048x1184.png 2048w" sizes="auto, (max-width: 2186px) 100vw, 2186px" /></figure>



<p>You’ll notice that there are three different Apple Root CA certificates. Why?</p>



<p>Each <a href="https://en.wikipedia.org/wiki/X.509" target="_blank" rel="noreferrer noopener">X.509</a> certificate contains detailed metadata defining its cryptographic properties and permitted usage. This includes the key type (such as <a href="https://en.wikipedia.org/wiki/RSA_cryptosystem" target="_blank" rel="noreferrer noopener">RSA</a> or <a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm" target="_blank" rel="noreferrer noopener">ECDSA</a>), the public key length, and the signature algorithm used.</p>



<ul class="wp-block-list">
<li><strong>Apple Root CA</strong>: Is a RSA type, with a public key length of 2048 bits that uses the SHA-1 algorithm.</li>



<li><strong>Apple Root CA-G2</strong>: Is a RSA type, with a public key length of 4096 bits that uses the SHA-384 algorithm.</li>



<li><strong>Apple Root CA-G3</strong>: Is a ECDSA type, with a public key length of 384 bits that uses the SHA-384 algorithm.</li>
</ul>



<h2 class="wp-block-heading">Intermediate Certificates and the Chain of Trust</h2>



<p>Root certificates are highly valuable and sensitive, so they are rarely used directly to sign end-user certificates (also called “Leaf” certificates). In the case of macOS app development, the developer’s certificate is the Leaf. This is where Intermediate Certificates come into play.</p>



<p>In simple terms, Intermediate Certificates are signed by Root Certificates and, in turn, are used to sign Leaf certificates. This protects the Root certificate from direct exposure. Together, the Root, Intermediate, and Leaf certificates form what is called the “Chain of Trust.”</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1254" height="932" src="https://blog.xojo.com/wp-content/uploads/2026/02/Root-Intermediate-Lead-Span.png" alt="" class="wp-image-15861" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Root-Intermediate-Lead-Span.png 1254w, https://blog.xojo.com/wp-content/uploads/2026/02/Root-Intermediate-Lead-Span-300x223.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Root-Intermediate-Lead-Span-1024x761.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Root-Intermediate-Lead-Span-768x571.png 768w" sizes="auto, (max-width: 1254px) 100vw, 1254px" /></figure>



<p>The Chain of Trust verification starts with the Leaf certificate and works upward through the Intermediate to the Root. This same process occurs whenever you visit a secure website, make an online payment, or transmit sensitive data securely.</p>



<p>For example, the Leaf certificate is validated against its Intermediate certificate. If the Intermediate certificate is missing or expired, the Leaf certificate is considered invalid. Similarly, the Intermediate certificate itself must be validated against the Root certificate. If the Root certificate is missing or expired, the Intermediate is invalid, and all Leaf certificates signed by it are also invalid.</p>



<p>The same process happens when you sign your macOS apps: macOS validates the entire certificate chain before allowing the app to run.</p>



<p>Finally, certificates closer to the Root generally have longer validity periods. Leaf certificates must be renewed more frequently, while Root certificates are valid for many years.</p>



<h2 class="wp-block-heading">Wrapping up</h2>



<p>In this first article, we covered the fundamentals of digital certificates and their role in macOS app security. In the next article, we will focus specifically on Apple Developer certificates and how they enable trusted app distribution.</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>



<p><strong>Code Signing on macOS: What Developers Need to Know</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2026/03/04/code-signing-on-macos-what-developers-need-to-know-part-1/" target="_blank" rel="noreferrer noopener">Part 1, Get Started</a></li>



<li><a href="https://blog.xojo.com/2026/03/18/code-signing-on-macos-what-developers-need-to-know-part-2/" target="_blank" rel="noreferrer noopener">Part 2, Code Signing With Developer Certificates</a></li>



<li><a href="https://blog.xojo.com/2026/03/24/code-signing-on-macos-what-developers-need-to-know-part-3/">Part 3, Entitlements and Provisioning Profiles</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Optimizing Xojo Code, Part 5: Threads and UserInterfaceUpdate</title>
		<link>https://blog.xojo.com/2026/03/02/optimizing-xojo-code-part-5-threads-and-userinterfaceupdate/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Mon, 02 Mar 2026 23:43:13 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Multithreaded Applications]]></category>
		<category><![CDATA[Threading]]></category>
		<category><![CDATA[Threads]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15847</guid>

					<description><![CDATA[In&#160;Part 1, we learned why tight loops with&#160;DoEvents&#160;freeze your UI.&#160;Part 2&#160;showed us Timer controls.&#160;Part 3&#160;moved timers into code.&#160;Part 4&#160;simplified scheduling with&#160;CallLater. But timers have a&#8230;]]></description>
										<content:encoded><![CDATA[
<p>In&nbsp;<a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/">Part 1</a>, we learned why tight loops with&nbsp;<code>DoEvents</code>&nbsp;freeze your UI.&nbsp;<a href="https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/">Part 2</a>&nbsp;showed us Timer controls.&nbsp;<a href="https://blog.xojo.com/2026/01/14/optimizing-xojo-code-part-3-programmatic-timers-and-addhandler/">Part 3</a>&nbsp;moved timers into code.&nbsp;<a href="https://blog.xojo.com/2026/02/02/optimizing-xojo-code-part-4-timer-calllater/">Part 4</a>&nbsp;simplified scheduling with&nbsp;<code>CallLater</code>.</p>



<p>But timers have a limit: they still run on the UI thread. If your background work is genuinely heavy (database queries, file I/O, complex calculations), a timer won&#8217;t save you. You need actual background processing and that&#8217;s where threads come in.</p>



<h2 class="wp-block-heading" id="the-core-idea-threads">The Core Idea: Threads</h2>



<p>A thread is a separate execution path that runs outside the UI thread. While your thread does the heavy lifting, the UI stays responsive to clicks, typing, scrolling. When your thread finishes a chunk of work, it notifies the UI thread via&nbsp;<code>UserInterfaceUpdate</code>, and only that callback runs on the main thread.</p>



<p>The rule is simple: threads cannot touch UI controls directly. If you try, you get a crash.&nbsp;<code>UserInterfaceUpdate</code>&nbsp;is your bridge.</p>



<p>For a deeper dive into how Xojo&#8217;s threading model works under the hood, including cooperative vs. preemptive threading, see&nbsp;<a href="https://blog.xojo.com/2024/10/01/cooperative-to-preemptive-weaving-new-threads-into-your-apps/" target="_blank" rel="noreferrer noopener">Cooperative to Preemptive: Weaving New Threads Into Your Apps</a>.</p>



<h2 class="wp-block-heading" id="looking-at-the-code">Let&#8217;s Code</h2>



<p><strong>Prerequisites:</strong>&nbsp;Add a&nbsp;<code>StatusLabel</code>&nbsp;(DesktopLabel), a&nbsp;<code>DesktopButton</code>, and a&nbsp;<code>Thread</code>&nbsp;control. Also define:</p>



<pre class="wp-block-code"><code>kCountTo As Integer = 100</code></pre>



<h3 class="wp-block-heading" id="the-thread-control">The Thread Control</h3>



<p>Drag a&nbsp;<code>Thread</code>&nbsp;from the library into your window and name it&nbsp;<code>BackgroundWorker</code>.</p>



<h3 class="wp-block-heading" id="the-button-start-the-thread">The Button (Start the Thread)</h3>



<p>Place this in the&nbsp;<code>Pressed</code>&nbsp;event of a button:</p>



<pre class="wp-block-code"><code>Sub Pressed()
  If BackgroundWorker.ThreadState = Thread.ThreadStates.NotRunning Then
    BackgroundWorker.Start
  End If
End Sub</code></pre>



<p>This checks if the thread is already running. If not, start it. This prevents multiple threads from piling up if someone clicks fast.</p>



<h3 class="wp-block-heading" id="the-run-method-background-work">The Thread.Run Method (Background Work)</h3>



<p>Implement the&nbsp;<code>Run</code>&nbsp;method on your Thread:</p>



<pre class="wp-block-code"><code>Sub Run()
  For i As Integer = 0 To kCountTo
    
    ' Do background work here. No UI access allowed.
    ' It can be: database query, file read, API call, pretty much anything that might block "freeze" the UI of the app
    
    ' Prepare a Dictionary payload for the UI
    Var info As New Dictionary
    info.Value("progress") = i
    info.Value("message") = "working"
    Me.AddUserInterfaceUpdate(info)
    
    ' Sleep (optional)
    Thread.SleepCurrent(10)   // Sleep 10 ms
  Next
End Sub</code></pre>



<p>The key line is&nbsp;<code>Me.AddUserInterfaceUpdate(info)</code>. This queues data for the UI thread to process. Each call adds one item to a queue, and the UI thread drains it in&nbsp;<code>UserInterfaceUpdate</code>.</p>



<h3 class="wp-block-heading" id="the-userinterfaceupdate-method-ui-sync">The Thread.UserInterfaceUpdate Method (UI Sync)</h3>



<p>Implement this event to handle updates from the thread:</p>



<pre class="wp-block-code"><code>Sub UserInterfaceUpdate(data() As Dictionary)
  ' Runs on the main UI thread. Safe to update controls here.
  
  ' Guard against empty or malformed data
  If data = Nil Or data.Count &lt; 0 Then Return
  
  Var d As Dictionary = data(0)
  
  ' Extract the progress value safely
  Var progress As Integer = 0
  If d.HasKey("progress") Then
    progress = d.Value("progress").IntegerValue
  End If
  
  ' Update the UI
  StatusLabel.Text = progress.ToString
  
  ' Mark completion when we hit the target
  If progress &gt;= kCountTo Then
    StatusLabel.Text = "done"
  End If
End Sub</code></pre>



<p><strong>Important notes:</strong></p>



<ul class="wp-block-list">
<li><code>data()</code>&nbsp;is an array of Dictionaries.</li>



<li>Always check&nbsp;<code>HasKey</code>&nbsp;before accessing a value to avoid runtime errors.</li>



<li>Use&nbsp;<code>.IntegerValue</code>&nbsp;(or&nbsp;<code>.StringValue</code>, etc.) to safely extract values.</li>



<li>This runs on the UI thread, so it is safe to update&nbsp;<code>StatusLabel</code>&nbsp;and any other visual controls.</li>
</ul>



<h2 class="wp-block-heading" id="how-it-works">How It Works</h2>



<ol class="wp-block-list">
<li><strong>Button press:</strong>&nbsp;Click the button and the thread starts.</li>



<li><strong>Background loop:</strong>&nbsp;The thread iterates from 0 to&nbsp;<code>kCountTo</code>, sleeping 10 ms each step. After each step, it queues an update.</li>



<li><strong>Responsiveness:</strong>&nbsp;While the thread works, you can still interact with the rest of your application. No freezing.</li>
</ol>



<h2 class="wp-block-heading" id="a-note-on-thread-safety">A Note on Thread Safety</h2>



<p>Threads are powerful but risky if misused. Here is the boundary:</p>



<ul class="wp-block-list">
<li><strong>Safe in Run():</strong>&nbsp;Anything that doesn&#8217;t touch UI controls. File I/O, database queries, calculations, network calls.</li>



<li><strong>Unsafe in Run():</strong>&nbsp;Reading or writing UI control properties directly.&nbsp;<code>StatusLabel.Text = ...</code>&nbsp;is a no no!</li>



<li><strong>Safe in UserInterfaceUpdate():</strong>&nbsp;All UI control access. This runs on the main thread.</li>
</ul>



<p>If you forget this rule and try to update a label from inside&nbsp;<code>Run()</code>, your app will crash with a <a href="https://documentation.xojo.com/api/language/runtime.html#runtime">ThreadAccessingUIException</a>. Instead pass data through&nbsp;<code>AddUserInterfaceUpdate</code>.</p>



<h2 class="wp-block-heading" id="when-to-use-threads-vs-timers">When to Use Threads vs. Timers</h2>



<p>Use timers for:</p>



<ul class="wp-block-list">
<li>Short, frequent tasks (10-50 ms ticks).</li>



<li>Simple progress updates.</li>



<li>Cases where you are just deferring work a bit.</li>
</ul>



<p>Use threads for:</p>



<ul class="wp-block-list">
<li>Long-running operations (seconds, minutes, hours).</li>



<li>Genuinely blocking work (I/O, network, heavy calculations).</li>



<li>Multiple independent background tasks.</li>
</ul>



<p>In this series, we moved from blocking the UI to using timers on the UI thread, then to actual background threads. Each approach solves a different problem.</p>



<h2 class="wp-block-heading" id="wrapping-up">Wrapping Up</h2>



<p>Threads are the heavy artillery of responsive design. They run independent of the UI and communicate safely via&nbsp;<code>UserInterfaceUpdate</code>. Once you grasp the boundary between thread code and UI code, you can build applications that never freeze, no matter how much work is happening behind the scenes.</p>



<p>See the&nbsp;<a href="https://documentation.xojo.com/api/language/threading/thread.html">Thread documentation</a>&nbsp;for more details on priority, stack size, and advanced patterns.</p>



<p>Until then, happy threading!</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>Optimizing Code Series:</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 1: Getting Started</a></li>



<li><a href="https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 2: Using a Timer to Keep the UI Responsive</a></li>



<li><a href="https://blog.xojo.com/2026/01/14/optimizing-xojo-code-part-3-programmatic-timers-and-addhandler/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 3: Programmatic Timers and AddHandler</a></li>



<li><a href="https://blog.xojo.com/2026/02/02/optimizing-xojo-code-part-4-timer-calllater/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 4: Timer.CallLater</a></li>



<li><a href="https://blog.xojo.com/2026/03/02/optimizing-xojo-code-part-5-threads-and-userinterfaceupdate/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 5: Threads and UserInterfaceUpdate</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Scatter Chart: Connecting the Points</title>
		<link>https://blog.xojo.com/2026/02/09/scatter-chart-connecting-the-points/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Mon, 09 Feb 2026 16:26:56 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Charts]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15826</guid>

					<description><![CDATA[A user recently asked whether it’s possible to connect the (x, y) points in a Scatter chart using DesktopChart, and if so, how to do&#8230;]]></description>
										<content:encoded><![CDATA[
<p>A user recently asked whether it’s possible to connect the (x, y) points in a Scatter chart using DesktopChart, and if so, how to do it. The short answer is yes, it is possible. Read on and I’ll show you just how easy it is.</p>



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



<p>For this example, we’ll use the x and y coordinate values of the sine and cosine functions as the data for our scatter DataSets. Go ahead and create a new Desktop project in the Xojo IDE.</p>



<p>Next, select the default Window1 and drag a DesktopChart control from the Library panel into the Layout Editor for Window1. Adjust the right margin to the recommended right layout guide, then lock the Top, Left, and Right layout locks for the Chart1 instance using the Inspector. At this point, your design should look similar to this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="2560" height="1800" src="https://blog.xojo.com/wp-content/uploads/2026/02/Chart1-scaled.png" alt="" class="wp-image-15827" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Chart1-scaled.png 2560w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart1-300x211.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart1-1024x720.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart1-768x540.png 768w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart1-1536x1080.png 1536w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart1-2048x1440.png 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>While you’re there, select Chart1 and, in the Inspector, set the option Behavior &gt; Mode to Scatter.</p>



<p>Next, with Window1 selected, add two properties using the following values:</p>



<p><strong>Property 1:</strong></p>



<ul class="wp-block-list">
<li><strong>Name:</strong> CosStyle</li>



<li><strong>Type:</strong> ChartLinearStyle</li>



<li><strong>Scope:</strong> Private</li>
</ul>



<p><strong>Property 2</strong></p>



<ul class="wp-block-list">
<li><strong>Name:</strong> SineStyle</li>



<li><strong>Type:</strong> ChartLinearStyle</li>



<li><strong>Scope:</strong> Private</li>
</ul>



<p>These properties will be used to store references to the Style objects associated with the cosine and sine function DataSets.</p>



<p>Finally, with Window1 still selected, add the Opening event and enter the following lines of code into the associated code editor:</p>



<pre class="wp-block-preformatted">CosStyle = New ChartLinearStyle<br>CosStyle.Line = ChartLinearStyle.LineTypes.Dashed<br><br>SineStyle = New ChartLinearStyle<br>SineStyle.Line = ChartLinearStyle.LineTypes.Solid<br><br>DrawScatterChart</pre>



<p>In brief, this code creates new ChartLinearStyle instances for the properties added earlier. It assigns a solid line style to connect the cosine function data points and a dashed line style to connect the sine function data points. After that, it calls the DrawScatterChart method, which is responsible for rendering the sine and cosine functions on the Chart1 instance.</p>



<p>Now, let’s create that method on Window1 using the following values in the Inspector:</p>



<ul class="wp-block-list">
<li><strong>Name:</strong> DrawScatterChart</li>



<li><strong>Scope:</strong> Private</li>
</ul>



<p>Type the following snippet of code in the associated Code Editor for the method:</p>



<pre class="wp-block-code"><code>// These are the Array variables in charge of storing the Scatter data points
// for the Sine and Cosine functions
Var sinePoints() As ChartScatterDatapoint
Var cosinePoints() As ChartScatterDatapoint

// …and these variables will handle the DataSet instances
// for the previous arrays of data points on both functions
Var sineDataSet As ChartScatterDataset
var cosDataSet As ChartScatterDataset

Const pi = 3.14159265359
Var y As Double
Var maxXValue As Double = 2.0 * pi

// Using a simple loop to feed the x and y
// values for the Sine and Cosine
For x As Double = 0.0 To maxXValue Step 0.5
  
  y = Sin(x)
  sinePoints.Add(New ChartScatterDatapoint(x, y, 1))
  
  y = Cos(x)
  cosinePoints.Add(new ChartScatterDatapoint(x, y, 1))
  
Next

// Next, we create the new instances for the Scatter DataSets
sineDataSet = New ChartScatterDataset(Color.Blue, sinePoints)
cosDataSet = New ChartScatterDataset(color.Red, cosinePoints)

// …and we set the Style to be used on each of them
sineDataSet.Style = SineStyle
cosDataSet.Style = CosStyle

// … and of course the labels to be shown on the Legend section
// of the chart itself
sineDataSet.Label = "Sine Function"
cosDataSet.Label = "Cos Function"

// As the last step, we add both DataSets to the chart
// so these can be rendered
Chart1.AddDatasets(sineDataSet, cosDataSet)</code></pre>



<p>Run the app, and it should look similar to this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1424" height="1088" src="https://blog.xojo.com/wp-content/uploads/2026/02/Chart2.png" alt="" class="wp-image-15828" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Chart2.png 1424w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart2-300x229.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart2-1024x782.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart2-768x587.png 768w" sizes="auto, (max-width: 1424px) 100vw, 1424px" /></figure>



<h2 class="wp-block-heading">A change of Style… on the fly!</h2>



<p>As with many aspects of DesktopChart, any changes made at runtime are reflected immediately, without the need to redraw the chart, re-feed the data sets, or perform any other complex operations. Let’s take advantage of this by changing the sine and cosine styles at runtime, allowing users of our example app to toggle whether the points are connected.</p>



<p>Add two DesktopCheckBox controls below the bottom margin of the Chart1 instance on Window1. Set the Caption of the first checkbox to “Connect Sine Points” and the second to “Connect Cos Points.” For both checkboxes, use the Inspector to set Initial State &gt; Visual State to Checked.</p>



<p>The final layout should look similar to this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1292" height="954" src="https://blog.xojo.com/wp-content/uploads/2026/02/Chart3.png" alt="" class="wp-image-15829" srcset="https://blog.xojo.com/wp-content/uploads/2026/02/Chart3.png 1292w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart3-300x222.png 300w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart3-1024x756.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/02/Chart3-768x567.png 768w" sizes="auto, (max-width: 1292px) 100vw, 1292px" /></figure>



<p>Lastly, add the ValueChanged event to both CheckBox instances. Then, for the checkbox with the caption “Connect Sine Points,” add the following lines of code to its event handler:</p>



<pre class="wp-block-code"><code>If Me.Value Then
  SineStyle.Line = ChartLinearStyle.LineTypes.Dashed
Else
  SineStyle.Line = ChartLinearStyle.LineTypes.None
End If</code></pre>



<p>Add the following lines of code to the ValueChanged event handler for the checkbox with the caption “Connect Cos Points”:</p>



<pre class="wp-block-code"><code>If Me.Value Then
  CosStyle.Line = ChartLinearStyle.LineTypes.Solid
Else
  CosStyle.Line = ChartLinearStyle.LineTypes.None
End If</code></pre>



<p>Run the app again and, this time, click each checkbox to see how the points are no longer connected when a checkbox is unchecked, and are connected when it is selected.</p>



<figure class="wp-block-video"><video controls src="https://blog.xojo.com/wp-content/uploads/2026/02/Grabacion-de-pantalla-2026-02-02-a-las-13.53.35.mp4"></video></figure>



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



<p>As you can see, styles can be used not only to connect points in a Scatter chart, but also to customize the point endpoints beyond the default appearance. For example, you can set the endpoint to “None” or choose from many other available options. Even better, any changes made to a style at runtime are applied immediately.</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>
					
		
		<enclosure url="https://blog.xojo.com/wp-content/uploads/2026/02/Grabacion-de-pantalla-2026-02-02-a-las-13.53.35.mp4" length="171622" type="video/mp4" />

			</item>
		<item>
		<title>Optimizing Xojo Code, Part 4: Timer.CallLater</title>
		<link>https://blog.xojo.com/2026/02/02/optimizing-xojo-code-part-4-timer-calllater/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Mon, 02 Feb 2026 21:25:28 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CallLater]]></category>
		<category><![CDATA[CancelCallLater]]></category>
		<category><![CDATA[Developer Challenge]]></category>
		<category><![CDATA[Timers]]></category>
		<category><![CDATA[UI Responsiveness]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15786</guid>

					<description><![CDATA[In&#160;Part 1&#160;of this series, we looked at a common but discouraged approach using a tight loop with&#160;DoEvents&#160;to keep the UI from freezing. In&#160;Part 2, we&#8230;]]></description>
										<content:encoded><![CDATA[
<p>In&nbsp;<a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/">Part 1</a>&nbsp;of this series, we looked at a common but discouraged approach using a tight loop with&nbsp;<code>DoEvents</code>&nbsp;to keep the UI from freezing. In&nbsp;<a href="https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/">Part 2</a>, we explored a better alternative by replacing that loop with a Timer control dragged onto a Window. In&nbsp;<a href="https://blog.xojo.com/2026/01/14/optimizing-xojo-code-part-3-programmatic-timers-and-addhandler/">Part 3</a>, we advanced to creating Timers programmatically with&nbsp;<code>AddHandler</code>&nbsp;for use in classes and modules.</p>



<p>Now, for even simpler one-off or chained delayed tasks, Xojo offers&nbsp;<code>Timer.CallLater</code>: no Timer instance required.</p>



<h2 class="wp-block-heading" id="the-strategy-timercalllater">The Strategy: Timer.CallLater</h2>



<p><code>Timer.CallLater(milliseconds, AddressOf MethodName, arg As Variant)</code>&nbsp;schedules your method to run after the specified delay on the main UI thread. Pass data via the Variant parameter. To chain calls (like our countdown), re-call it from within the method. Use&nbsp;<code>Timer.CancelCallLater(AddressOf MethodName)</code>&nbsp;to abort pending calls.</p>



<p>For full details, see the&nbsp;<a href="https://documentation.xojo.com/api/language/timer.html" target="_blank" rel="noreferrer noopener">Timer documentation</a>.</p>



<h2 class="wp-block-heading" id="looking-at-the-code">Looking at the Code</h2>



<p>Prerequisites: Add a <code>StatusLabel</code> (DesktopLabel control) and a constant <code>kCountTo As Integer = 20000</code>.</p>



<p>Let&#8217;s look at how we implement this.</p>



<h3 class="wp-block-heading" id="the-setup-button-pressed">The Setup (Button Pressed)</h3>



<p>Place the following code in the&nbsp;<code>Pressed</code>&nbsp;event handler of a button control:</p>



<pre class="wp-block-code"><code>Sub Pressed()
  Timer.CancelCallLater(AddressOf UpdateProgress)
  
  StatusLabel.Text = "0"
  
  Timer.CallLater(100, AddressOf UpdateProgress, 100)
End Sub</code></pre>



<h3 class="wp-block-heading" id="the-handler-recursive-chain">The Handler (Recursive Chain)</h3>



<p>Create the following method that handles the recursive chain of delayed updates:</p>



<pre class="wp-block-code"><code>Sub UpdateProgress(elapsedMs As Variant)
  Var elapsed As Integer = elapsedMs.IntegerValue
  
  If elapsed &gt;= kCountTo Then

    StatusLabel.Text = "done"

  Else

    StatusLabel.Text = elapsed.ToString
    Timer.CallLater(100, AddressOf UpdateProgress, elapsed + 100)

  End If
End Sub</code></pre>



<p><strong>Crucial Note:</strong>&nbsp;The handler method must accept a&nbsp;<code>Variant</code>&nbsp;parameter to receive the argument passed to&nbsp;<code>CallLater</code>. Always use type-safe extraction like&nbsp;<code>.IntegerValue</code>.</p>



<h2 class="wp-block-heading" id="how-it-works">How It Works</h2>



<ol class="wp-block-list">
<li>Initial Schedule: The button cancels any pending calls and schedules the first <code>UpdateProgress</code> after 100ms, passing <code>100</code> as the elapsed time (just in case we like pressing a button multiple times quickly).</li>



<li>Recursion: Each call updates the UI and, if not finished, schedules the next one 100ms in the future with incremented elapsed time.</li>



<li>Automatic Management: No Timer properties or handlers to manage; Xojo handles scheduling and cleanup.</li>



<li>Cancellation: Ensures only one chain runs at a time.</li>
</ol>



<h2 class="wp-block-heading" id="wrapping-up">Wrapping Up</h2>



<p><code>Timer.CallLater</code>&nbsp;shines for delayed UI updates or chained tasks without the overhead of Timer objects. It&#8217;s concise, safe, and powerful for responsive apps.</p>



<p>In Part 5, we&#8217;ll tackle true background processing with&nbsp;<code>Threads</code>&nbsp;and&nbsp;<code>UserInterfaceUpdate</code>.</p>



<p>Until then, happy coding!</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>Optimizing Code Series:</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 1: Getting Started</a></li>



<li><a href="https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 2: Using a Timer to Keep the UI Responsive</a></li>



<li><a href="https://blog.xojo.com/2026/01/14/optimizing-xojo-code-part-3-programmatic-timers-and-addhandler/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 3: Programmatic Timers and AddHandler</a></li>



<li><a href="https://blog.xojo.com/2026/02/02/optimizing-xojo-code-part-4-timer-calllater/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 4: Timer.CallLater</a></li>



<li><a href="https://blog.xojo.com/2026/03/02/optimizing-xojo-code-part-5-threads-and-userinterfaceupdate/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 5: Threads and UserInterfaceUpdate</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Xojo + XAML + Goto = &#x1f525;</title>
		<link>https://blog.xojo.com/2026/01/22/xojo-xaml-goto/</link>
		
		<dc:creator><![CDATA[William Yu]]></dc:creator>
		<pubDate>Thu, 22 Jan 2026 20:50:59 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[DesktopXAMLContainer]]></category>
		<category><![CDATA[XAML]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15790</guid>

					<description><![CDATA[For decades, Goto has been treated as a programming faux pas—something to avoid at all costs. Like most rules though, there are exceptions. The Goto&#8230;]]></description>
										<content:encoded><![CDATA[
<p>For decades, Goto has been treated as a programming faux pas—something to avoid at all costs. Like most rules though, there are exceptions. The Goto I’m talking about here is one of them… and it can quite literally light your app on fire—programmatically speaking.</p>



<p>One of the hidden gems in <a href="https://xojo.com/download/" target="_blank" rel="noreferrer noopener">Xojo 2025r3</a> is support for XAML transitions, which makes it possible to add lightweight animations to your UI without writing any custom animation code in Xojo. Instead, you define visual states in XAML and let the XAML engine handle the animation for you.</p>



<p>At a high level, the workflow looks like this:</p>



<ol class="wp-block-list">
<li>Define one or more&nbsp;<strong>VisualStates</strong>&nbsp;in XAML.</li>



<li>Attach transitions to those states (for example, moving or fading an element).</li>



<li>From Xojo code, switch between states using&nbsp;<code>Invoke("GotoState", ...)</code>.</li>
</ol>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" />&nbsp;<strong>Pro Tip</strong><br><code>DesktopXAMLContainer</code>&nbsp;subscribes to&nbsp;<code>Operator_Lookup</code>, so you don’t have to call&nbsp;<code>Invoke</code>&nbsp;directly. Instead of writing<code> XAMLContainer1.Invoke("GotoState", "WhichState")</code>, you can simply call <code>XAMLContainer1.GotoState("WhichState")</code>.</p>



<h3 class="wp-block-heading">Visual States in XAML</h3>



<p>A&nbsp;<em>VisualState</em>&nbsp;represents a named configuration of UI properties. When you transition from one state to another, XAML can automatically animate the change.</p>



<p>Below is a simple example that animates a fire emoji <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> moving upward, similar to a candle flame flickering or burning upward.</p>



<h3 class="wp-block-heading">Example XAML</h3>



<p>This example uses a&nbsp;<code>TextBlock</code>&nbsp;to display the fire emoji and animates its vertical position with a&nbsp;<code>TranslateTransform</code>. Note that visual states must be defined on a control, so we attach them to a&nbsp;<code>UserControl</code>, allowing it to participate in&nbsp;<code>GotoState</code>&nbsp;transitions.</p>



<pre class="wp-block-preformatted">&lt;UserControl&gt;<br>  &lt;Grid&gt;<br>    &lt;VisualStateManager.VisualStateGroups&gt;<br>      &lt;VisualStateGroup Name="FlameStates"&gt;<br><br>        &lt;VisualState Name="Bottom"&gt;<br>          &lt;Storyboard&gt;<br>            &lt;DoubleAnimation<br>              Storyboard.TargetName="FlameTransform"<br>              Storyboard.TargetProperty="Y"<br>              To="40"<br>              Duration="0:0:1" /&gt;<br>          &lt;/Storyboard&gt;<br>        &lt;/VisualState&gt;<br><br>        &lt;VisualState Name="Top"&gt;<br>          &lt;Storyboard&gt;<br>            &lt;DoubleAnimation<br>              Storyboard.TargetName="FlameTransform"<br>              Storyboard.TargetProperty="Y"<br>              To="-100"<br>              Duration="0:0:1" /&gt;<br>          &lt;/Storyboard&gt;<br>        &lt;/VisualState&gt;<br><br>      &lt;/VisualStateGroup&gt;<br>    &lt;/VisualStateManager.VisualStateGroups&gt;<br><br>    &lt;TextBlock<br>      Text="<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" />"<br>      FontSize="32"<br>      HorizontalAlignment="Center"<br>      VerticalAlignment="Bottom"&gt;<br><br>      &lt;TextBlock.RenderTransform&gt;<br>        &lt;TranslateTransform Name="FlameTransform" /&gt;<br>      &lt;/TextBlock.RenderTransform&gt;<br><br>    &lt;/TextBlock&gt;<br>  &lt;/Grid&gt;<br>&lt;/UserControl&gt;</pre>



<p>In this XAML:</p>



<ul class="wp-block-list">
<li>The&nbsp;<code>VisualStateGroup</code>&nbsp;named&nbsp;<strong>FlameStates</strong>&nbsp;contains two states:
<ul class="wp-block-list">
<li><strong>Bottom</strong>&nbsp;– moves the emoji downward.</li>



<li><strong>Top</strong>&nbsp;– moves the emoji upward.</li>
</ul>
</li>



<li>The&nbsp;<code>DoubleAnimation</code>&nbsp;targets the&nbsp;<code>Y</code>&nbsp;property of a&nbsp;<code>TranslateTransform</code>.</li>



<li>The transition duration is handled entirely by XAML.</li>
</ul>



<h3 class="wp-block-heading">Triggering the Transition from Xojo</h3>



<p>Once the visual states are defined, switching between them from Xojo is straightforward. Assuming this XAML is hosted in a&nbsp;<code>XAMLContainer</code>&nbsp;named&nbsp;<code>XAMLContainer1</code>, you can trigger the animation like this:</p>



<pre class="wp-block-code"><code>XAMLContainer1.GotoState("Top")</code></pre>



<p>And to move it back down:</p>



<pre class="wp-block-code"><code>XAMLContainer1.GotoState("Bottom")</code></pre>



<h3 class="wp-block-heading">Why This Is Powerful</h3>



<p>What makes this feature especially useful is that:</p>



<ul class="wp-block-list">
<li>The animation logic stays in XAML, where it naturally belongs.</li>



<li>Xojo code remains clean and declarative—just tell the UI&nbsp;<em>which state</em>&nbsp;to go to.</li>



<li>More complex effects (opacity, scaling, rotation, easing functions) can be added without changing any Xojo code.</li>
</ul>



<p>Here&#8217;s a more interesting variation, where the flames drift upward rather than moving in a straight line:</p>



<pre class="wp-block-code"><code>&lt;UserControl&gt;
  &lt;Grid Width="160" Height="240"&gt;

    &lt;!-- Fire emoji 1 --&gt;
    &lt;TextBlock Name="Fire1"
           Text="&#x1f525;"
           FontSize="32"
           VerticalAlignment="Bottom"
           HorizontalAlignment="Center"&gt;
      &lt;TextBlock.RenderTransform&gt;
        &lt;TranslateTransform Name="Move1"/&gt;
      &lt;/TextBlock.RenderTransform&gt;
    &lt;/TextBlock&gt;

    &lt;!-- Fire emoji 2 --&gt;
    &lt;TextBlock Name="Fire2"
           Text="&#x1f525;"
           FontSize="26"
           VerticalAlignment="Bottom"
           HorizontalAlignment="Center"
           Margin="20,0,0,0"
           Opacity="0.8"&gt;
      &lt;TextBlock.RenderTransform&gt;
        &lt;TranslateTransform Name="Move2"/&gt;
      &lt;/TextBlock.RenderTransform&gt;
    &lt;/TextBlock&gt;

    &lt;!-- Fire emoji 3 --&gt;
    &lt;TextBlock Name="Fire3"
           Text="&#x1f525;"
           FontSize="22"
           VerticalAlignment="Bottom"
           HorizontalAlignment="Center"
           Margin="-20,0,0,0"
           Opacity="0.7"&gt;
      &lt;TextBlock.RenderTransform&gt;
        &lt;TranslateTransform Name="Move3"/&gt;
      &lt;/TextBlock.RenderTransform&gt;
    &lt;/TextBlock&gt;

    &lt;VisualStateManager.VisualStateGroups&gt;
      &lt;VisualStateGroup Name="FireStates"&gt;

        &lt;VisualState Name="Off"/&gt;

        &lt;VisualState Name="On"&gt;
          &lt;Storyboard RepeatBehavior="Forever"&gt;

            &lt;!-- Fire 1 --&gt;
            &lt;DoubleAnimation Storyboard.TargetName="Move1"
                     Storyboard.TargetProperty="Y"
                     From="0"
                     To="-180"
                     Duration="0:0:1.2"/&gt;

            &lt;DoubleAnimation Storyboard.TargetName="Move1"
                     Storyboard.TargetProperty="X"
                     From="0"
                     To="10"
                     Duration="0:0:0.6"
                     AutoReverse="True"/&gt;

            &lt;!-- Fire 2 --&gt;
            &lt;DoubleAnimation Storyboard.TargetName="Move2"
                     Storyboard.TargetProperty="Y"
                     From="0"
                     To="-160"
                     Duration="0:0:1.0"
                     BeginTime="0:0:0.3"/&gt;

            &lt;DoubleAnimation Storyboard.TargetName="Move2"
                     Storyboard.TargetProperty="X"
                     From="0"
                     To="-12"
                     Duration="0:0:0.5"
                     AutoReverse="True"/&gt;

            &lt;!-- Fire 3 --&gt;
            &lt;DoubleAnimation Storyboard.TargetName="Move3"
                     Storyboard.TargetProperty="Y"
                     From="0"
                     To="-140"
                     Duration="0:0:1.4"
                     BeginTime="0:0:0.15"/&gt;

            &lt;DoubleAnimation Storyboard.TargetName="Move3"
                     Storyboard.TargetProperty="X"
                     From="0"
                     To="8"
                     Duration="0:0:0.7"
                     AutoReverse="True"/&gt;

          &lt;/Storyboard&gt;
        &lt;/VisualState&gt;

      &lt;/VisualStateGroup&gt;
    &lt;/VisualStateManager.VisualStateGroups&gt;

  &lt;/Grid&gt;
&lt;/UserControl&gt;</code></pre>



<p>To light up the flames we&#8217;ll simply invoke the &#8220;On&#8221; state:</p>



<pre class="wp-block-code"><code>XAMLContainer1.GotoState("On")</code></pre>



<figure class="wp-block-video"><video height="720" style="aspect-ratio: 1280 / 720;" width="1280" controls loop src="https://blog.xojo.com/wp-content/uploads/2026/01/XAMLFire.mp4" playsinline></video></figure>



<p>For subtle UI polish—like animated indicators, highlights, or playful effects such as this candle flame—XAML transitions provide a surprisingly powerful new tool in Xojo.</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>
					
		
		<enclosure url="https://blog.xojo.com/wp-content/uploads/2026/01/XAMLFire.mp4" length="177770" type="video/mp4" />

			</item>
		<item>
		<title>Detecting UI Compatibility Mode in macOS Apps with Xojo</title>
		<link>https://blog.xojo.com/2026/01/14/detecting-ui-compatibility-mode-in-macos-apps-with-xojo/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Wed, 14 Jan 2026 22:49:34 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Declares]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15762</guid>

					<description><![CDATA[As you may already know, starting with Xojo 2025r3, macOS apps can be developed and compiled with UI Compatibility Mode either enabled or disabled. Now&#8230;]]></description>
										<content:encoded><![CDATA[
<p>As you may already know, starting with Xojo 2025r3, macOS apps can be developed and compiled with UI Compatibility Mode either enabled or disabled. Now imagine you are creating a Library intended for use in other projects and, as part of its UI-related functionality, the Library needs to determine whether the host application is running with UI Compatibility Mode enabled. How can you do that? Read on to find out.</p>



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



<p>To determine whether a macOS app is running with UI Compatibility Mode enabled, we’ll use a small set of <a href="https://documentation.xojo.com/topics/declares/calling_native_macos_apis.html">Declares</a> inside a method contained in a Module, purely for the purposes of this example. Begin by creating a new Desktop project and adding a new Module to it (for example, a simple “Module1”). Next, add a new method to the Module with the following signature:</p>



<p><code>IsCompatibilityModeEnabled As Boolean</code></p>



<p>Then add the following code to the method:</p>



<pre class="wp-block-code"><code>#If TargetMacOS Then
  
  If System.Version.MajorVersion >= 26 Then
    
    Declare Function NSClassFromString Lib "Foundation" (clsName As CFStringRef) As Ptr
    Declare Function NSMainBundle Lib "AppKit" Selector "mainBundle" (obj As Ptr) As Ptr
    Declare Function NSInfoDictionary Lib "AppKit" Selector "infoDictionary" (obj As Ptr) As Ptr
    Declare Function NSDictValueForKey Lib "AppKit" Selector "valueForKey:" (obj As Ptr, key As CFStringRef) As Ptr
    Declare Function NSGetBoolValue Lib "AppKit" Selector "boolValue" (obj As Ptr) As Boolean
    
    Var Bundle As Ptr = NSClassFromString("NSBundle")
    
    If Bundle &lt;> Nil Then
      Var MainBundle As Ptr = NSMainBundle(Bundle)
      
      If MainBundle &lt;> Nil then
        Var infoDictionaryPlist As Ptr = NSInfoDictionary(MainBundle)
        
        If infoDictionaryPlist &lt;> Nil Then
          Var valueObj As Ptr = NSDictValueForKey(infoDictionaryPlist, "UIDesignRequiresCompatibility")
          
          If valueObj &lt;> Nil Then 
            Return NSGetBoolValue(valueObj)
          End If
          
        End If
        
      End If
      
    End If
  End If
  
  Return False
  
#EndIf</code></pre>



<p>In short, the previous code retrieves the app’s Info.plist from the macOS bundle and loads it into an NSDictionary object (similar to Xojo’s Dictionary). It then attempts to access the value associated with the key <code>UIDesignRequiresCompatibility</code>. If the returned object is Nil, it means the Info.plist does not contain that key and the app is therefore running in native macOS Tahoe mode. If the key is present, the method returns the Boolean value associated with it; a value of True indicates that the app is running with UI Compatibility Mode enabled under macOS Tahoe. That’s all there is to it!</p>



<h2 class="wp-block-heading">Testing the Method</h2>



<p>Now add a DesktopButton to the project’s default window and implement its Pressed event. Next, insert the following line of code into the associated Code Editor:</p>



<pre class="wp-block-code"><code>MessageBox("Compatibility Mode Enabled: " +  IsCompatibilityModeEnabled.ToString)</code></pre>



<p>For testing purposes, select Build Settings &gt; macOS in the Project Browser and enable UI Compatibility Mode, which can be found under the Build section of the Inspector. Run the app and, if your Mac is running macOS 26 or later, you will see the following message:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1204" height="860" src="https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.26.54.png" alt="" class="wp-image-15763" srcset="https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.26.54.png 1204w, https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.26.54-300x214.png 300w, https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.26.54-1024x731.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.26.54-768x549.png 768w" sizes="auto, (max-width: 1204px) 100vw, 1204px" /></figure>



<p>Quit the app and return to Build Settings &gt; macOS to disable UI Compatibility Mode. Run the app again and this time you will see the following message:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1204" height="866" src="https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.28.22.png" alt="" class="wp-image-15764" srcset="https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.28.22.png 1204w, https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.28.22-300x216.png 300w, https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.28.22-1024x737.png 1024w, https://blog.xojo.com/wp-content/uploads/2026/01/Captura-de-pantalla-2026-01-08-a-las-14.28.22-768x552.png 768w" sizes="auto, (max-width: 1204px) 100vw, 1204px" /></figure>



<h2 class="wp-block-heading">In Summary</h2>



<p>As you can see, Declares are a powerful feature in Xojo’s extensive toolbox, allowing developers to directly access and use APIs provided by the operating system. In this case, they enable you to retrieve the app’s Info.plist from the main bundle, load it into a dictionary, and read the value associated with a specific key.</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>Optimizing Xojo Code, Part 3: Programmatic Timers and AddHandler</title>
		<link>https://blog.xojo.com/2026/01/14/optimizing-xojo-code-part-3-programmatic-timers-and-addhandler/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Wed, 14 Jan 2026 16:27:11 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AddHandler]]></category>
		<category><![CDATA[Code Optimization]]></category>
		<category><![CDATA[Developer Challenge]]></category>
		<category><![CDATA[Timers]]></category>
		<category><![CDATA[UI Responsiveness]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15768</guid>

					<description><![CDATA[In&#160;Part 1&#160;of this Optimizing Xojo Code series, we looked at a working but discouraged approach using a tight loop with&#160;DoEvents&#160;to keep the UI from freezing.&#8230;]]></description>
										<content:encoded><![CDATA[
<p>In&nbsp;<a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/">Part 1</a>&nbsp;of this Optimizing Xojo Code series, we looked at a working but discouraged approach using a tight loop with&nbsp;<code>DoEvents</code>&nbsp;to keep the UI from freezing. In&nbsp;<a href="https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/">Part 2</a>, we explored a better alternative by replacing that loop with a Timer control dragged onto a DesktopWindow. This is a simple and effective solution that takes advantage of Xojo’s object-oriented nature.</p>



<p>But what if you need a timer inside a Class or a Module where you can&#8217;t drop a visual control?</p>



<h2 class="wp-block-heading" id="the-strategy-addhandler">The Strategy: AddHandler</h2>



<p>When you use a Timer control from the library, you double-click it to add an&nbsp;<code>Action</code>&nbsp;event. When we create a Timer in code, we don&#8217;t have a &#8220;code editor&#8221; for it in the same way. Instead, we use the&nbsp;<code>AddHandler</code>&nbsp;command to tell Xojo: &#8220;When this timer fires its Action event, run this specific method instead.&#8221;</p>



<h2 class="wp-block-heading" id="looking-at-the-code">Looking at the Code</h2>



<p>Let&#8217;s look at how we implement this. In our example project, we have a button that initializes our timer and a separate method to handle the &#8220;ticks.&#8221;</p>



<h3 class="wp-block-heading" id="the-setup-opening-the-gate">The Setup</h3>



<p>First, we define a property on our window (or class) to hold our timer:&nbsp;<code>mWaitTimer As Timer</code></p>



<p>Then, in the&nbsp;<strong>Pressed</strong>&nbsp;event of our button, we instantiate it:</p>



<pre class="wp-block-code"><code>Sub Pressed() Handles Pressed
  ' 1. Cleanup
  If mWaitTimer &lt;&gt; Nil Then
    mWaitTimer.RunMode = Timer.RunModes.Off
    mWaitTimer = Nil
  End If
  
  ' 2. Initialization
  mElapsedMs = 0
  StatusLabel.Text = "0"
  
  ' 3. Create the dynamic timer
  mWaitTimer = New Timer
  mWaitTimer.Period = 100 ' 100 ms tick
  mWaitTimer.RunMode = Timer.RunModes.Multiple
  
  ' 4. The Magic: Link the Action event to our WaitTick method
  AddHandler mWaitTimer.Action, AddressOf WaitTick
End Sub</code></pre>



<h3 class="wp-block-heading" id="the-handler-doing-the-work">The Handler (Doing the Work)</h3>



<p>Now, let&#8217;s create the method named&nbsp;<code>WaitTick</code>.&nbsp;<strong>Crucial Note:</strong>&nbsp;When using&nbsp;<code>AddHandler</code>&nbsp;for a Timer, the first parameter of your receiving method must be of the type&nbsp;<code>Timer</code>&nbsp;so it knows which object triggered it.</p>



<pre class="wp-block-code"><code>Sub WaitTick(t As Timer)
  mElapsedMs = mElapsedMs + t.Period
  
  If mElapsedMs &gt;= kCountTo Then
    ' Achievement unlocked! Stop the timer and clean up
    t.RunMode = Timer.RunModes.Off
    StatusLabel.Text = "done"
    
    ' It's good practice to remove the handler when done
    RemoveHandler t.Action, AddressOf WaitTick
  Else
    StatusLabel.Text = mElapsedMs.ToString
  End If
End Sub</code></pre>



<h2 class="wp-block-heading" id="how-it-works">How It Works</h2>



<ol class="wp-block-list">
<li><strong>New Timer:</strong>&nbsp;We create a new instance of the Timer class in memory.</li>



<li><strong>AddHandler:</strong>&nbsp;This command connects the&nbsp;<code>Action</code>&nbsp;event of our new timer to the&nbsp;<code>WaitTick</code>&nbsp;method. The&nbsp;<code>AddressOf</code>&nbsp;operator tells Xojo the memory location of the code we want to run.</li>



<li><strong>Passing the Object:</strong>&nbsp;Because&nbsp;<code>WaitTick</code>&nbsp;receives&nbsp;<code>t As Timer</code>&nbsp;as a parameter, you can actually use the same handler for multiple different timers and knows exactly which one is calling for attention.</li>
</ol>



<h2 class="wp-block-heading" id="wrapping-up">Wrapping Up</h2>



<p>By moving your Timers into code, you take a significant step toward writing more modular Xojo applications. You’ve moved the logic from &#8220;Global UI state&#8221; into &#8220;Managed Code execution.&#8221;</p>



<p>In the upcoming Part 4, we’ll look at a shortcut that makes one-off background tasks a breeze:&nbsp;<code>Timer.CallLater</code>.</p>



<p>Until then, happy coding and don&#8217;t forget to add your own solution in the <a href="https://forum.xojo.com/" data-type="link" data-id="https://forum.xojo.com/" target="_blank" rel="noreferrer noopener">Xojo Forum</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>



<p><strong>Optimizing Code Series:</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 1: Getting Started</a></li>



<li><a href="https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 2: Using a Timer to Keep the UI Responsive</a></li>



<li><a href="https://blog.xojo.com/2026/01/14/optimizing-xojo-code-part-3-programmatic-timers-and-addhandler/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 3: Programmatic Timers and AddHandler</a></li>



<li><a href="https://blog.xojo.com/2026/02/02/optimizing-xojo-code-part-4-timer-calllater/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 4: Timer.CallLater</a></li>



<li><a href="https://blog.xojo.com/2026/03/02/optimizing-xojo-code-part-5-threads-and-userinterfaceupdate/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 5: Threads and UserInterfaceUpdate</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Community Contributions to the Xojo Blog: Spotlight On &#038; Guest Posts in 2025</title>
		<link>https://blog.xojo.com/2025/12/18/community-contributions-to-the-xojo-blog-spotlight-on-guest-posts-in-2025/</link>
		
		<dc:creator><![CDATA[Alyssa Foley]]></dc:creator>
		<pubDate>Thu, 18 Dec 2025 20:25:07 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15448</guid>

					<description><![CDATA[Besides being a great resource for everything from Xojo code tips and snippets to videos that show you cool things, plus news and announcements, the&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Besides being a great resource for everything from Xojo code tips and snippets to videos that show you cool things, plus news and announcements, the Xojo Blog also strives to build community among the wide range of people who use Xojo around the world. We welcome guest bloggers from the Xojo community and highlight the many different ways people use Xojo through our Spotlight On series.</p>



<p>In 2025, guest authors shared their expertise and real-world experience on the Xojo Blog. These posts bring fresh perspectives, practical solutions and deep technical insight that help other developers learn faster, solve problems more effectively and feel more connected to the Xojo community.</p>



<p>Guest posts in 2025 included:</p>



<ul class="wp-block-list">
<li>Martin T., Xojo MVP: <a href="https://blog.xojo.com/2025/09/25/hide-the-tabs-in-an-android-mobiletabpanel-using-declares/" target="_blank" rel="noreferrer noopener">Hide the Tabs in an Android MobileTabPanel Using Declares</a></li>



<li>Martin T., Xojo MVP: <a href="https://blog.xojo.com/2025/09/16/xojo-for-android-a-two-year-retrospective/" target="_blank" rel="noreferrer noopener">Xojo for Android: A Two-Year Retrospective</a></li>



<li>Martin T., Xojo MVP: <a href="https://blog.xojo.com/2025/07/08/its-here-android-design-extensions-4-0/" target="_blank" rel="noreferrer noopener">It’s here – Android Design Extensions 4.0</a></li>



<li>Anthony Cyphers, GraffitiSuite and Xojo MVP: <a href="https://blog.xojo.com/2025/03/15/handling-feature-requests/" target="_blank" rel="noreferrer noopener">Handling Feature Requests</a></li>



<li>Kem Tekinay, Xojo MVP: <a href="https://blog.xojo.com/2025/02/26/memoryblocks-for-speed-a-case-study/" target="_blank" rel="noreferrer noopener">MemoryBlocks For Speed: A Case Study</a></li>



<li>Kem Tekinay, Xojo MVP: <a href="https://blog.xojo.com/2025/12/16/the-beauty-of-binary-searches/">The Beauty of Binary Searches</a></li>



<li>Jürg Otter: <a href="https://blog.xojo.com/2025/02/25/build-a-xojo-plugin-with-github-actions/" target="_blank" rel="noreferrer noopener">Build a Xojo Plugin with GitHub Actions</a></li>



<li>Ezekiel Burke, <em><a href="https://ironelephantsolutions.com/" target="_blank" rel="noreferrer noopener">Iron Elephant Solutions</a></em>: <a href="https://blog.xojo.com/2025/02/19/introduction-to-pocketbase-a-backend-alternative-for-xojo-developers/" target="_blank" rel="noreferrer noopener">Introduction to PocketBase: A Backend Alternative for Xojo Developers</a></li>
</ul>



<p>We are always looking for users in the Xojo community who want to share a problem they’ve solved, a creative solution or an interesting project. If you’re interested in contributing a guest post or have an idea you’d like to explore, send it to me at <a>alyssa@xojo.com</a>.</p>



<p>In 2024, we introduced the Spotlight On series to highlight the work Xojo users do and their experiences using Xojo. Since many Xojo users don’t fit the mold of a traditional developer role, Spotlight On offers a fun and approachable way to learn how someone got started with Xojo and how they use it today. Spotlights can focus on an individual developer, a business or a specific Xojo-based project.</p>



<p>Spotlight On features in 2025:</p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2024/06/13/spotlight-on-graffitisuite/" target="_blank" rel="noreferrer noopener">Spotlight On: GraffitiSuite</a></li>



<li><a href="https://blog.xojo.com/2024/07/08/spotlight-on-xdev-magazine/" target="_blank" rel="noreferrer noopener">Spotlight On: xDev Magazine</a></li>



<li><a href="https://blog.xojo.com/2024/08/14/spotlight-on-lx-aer/" target="_blank" rel="noreferrer noopener">Spotlight On: LX Aer</a></li>



<li><a href="https://blog.xojo.com/2024/10/16/spotlight-on-eklectic-accounting/" target="_blank" rel="noreferrer noopener">Spotlight On: EKlectic Accounting</a></li>



<li><a href="https://blog.xojo.com/2024/11/12/spotlight-on-raximus-studios/" target="_blank" rel="noreferrer noopener">Spotlight On: Raximus Studios</a></li>



<li><a href="https://blog.xojo.com/2024/12/19/spotlight-on-richard-klingler/" target="_blank" rel="noreferrer noopener">Spotlight On: Richard Klingler</a></li>



<li><a href="https://blog.xojo.com/2025/01/21/spotlight-on-enrique-contreras/" target="_blank" rel="noreferrer noopener">Spotlight On: Enrique Contreras</a></li>



<li><a href="https://blog.xojo.com/2025/02/11/spotlight-on-offroad-portal/" target="_blank" rel="noreferrer noopener">Spotlight On: Offroad Portal</a></li>



<li><a href="https://blog.xojo.com/2025/03/10/spotlight-on-tim-dietrich/" target="_blank" rel="noreferrer noopener">Spotlight On: Tim Dietrich</a></li>



<li><a href="https://blog.xojo.com/2025/06/11/spotlight-on-sounds-in-sync/" target="_blank" rel="noreferrer noopener">Spotlight On: Sounds In Sync</a></li>



<li><a href="https://blog.xojo.com/2025/09/22/spotlight-on-android-design-extensions/" target="_blank" rel="noreferrer noopener">Spotlight On: Android Design Extensions</a></li>



<li><a href="https://blog.xojo.com/2025/10/09/spotlight-on-aaron-andrew-hunt/" target="_blank" rel="noreferrer noopener">Spotlight On: Aaron Andrew Hunt</a></li>
</ul>



<p>If you’d like to be featured in a future Spotlight On or know someone in the Xojo community whose story would be great to share, we’d love to hear from you. Reach out with suggestions to me at <a>alyssa@xojo.com</a>.</p>



<p>The Xojo Blog is at its best when it reflects the voices, experiences and creativity of the community itself. Whether through guest posts, Spotlight On posts or shared ideas, we look forward to continuing to learn from and celebrate the people who make Xojo what it is.</p>



<p><em>Alyssa has been with Xojo for over 18 years. She loves solving problems and building community. You can reach her at alyssa@xojo.com or through any of Xojo&#8217;s social media channels. If you can&#8217;t reach her she&#8217;s probably out hiking the beautiful trails through her city of Portland, Oregon, or maybe enjoying a drink with friends by the river. </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>Tip: Customize Toolbars on macOS apps</title>
		<link>https://blog.xojo.com/2025/12/17/tip-customize-toolbars-on-macos-apps/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Wed, 17 Dec 2025 17:04:00 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[2025r3]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[macOS 26]]></category>
		<category><![CDATA[Toolbar]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15727</guid>

					<description><![CDATA[Starting with Xojo 2025r3, macOS apps are built using macOS SDK 26. One benefit of this is that your apps automatically gain access to newer&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Starting with Xojo 2025r3, macOS apps are built using macOS SDK 26. One benefit of this is that your apps automatically gain access to newer native macOS features with little or no extra work. In some cases, these features are available immediately; in others, they can be enabled with a simple Declare. One such example is allowing users to customize an app’s toolbar.</p>



<p>To demonstrate this, we’ll use the Desktop Toolbar example project that ships with Xojo. You can find it in the Examples section of the New Project window. Open this project using the Xojo 2025r3 IDE.</p>



<p>Once the project is open, locate the MainWindow in the Project Browser. Under MainWindow, select the WindowToolbar item and then choose its Opening event. At the top of the Code Editor for this event, add the following lines of code:</p>



<pre class="wp-block-code"><code>Var hdl As Ptr = Me.Handle
If hdl.Integer &lt;> 0 Then
  Declare Sub AllowCustomization Lib "AppKit" Selector "setAllowsUserCustomization:" (hdl As Ptr, value As Boolean)
  AllowCustomization(hdl, True)
End If</code></pre>



<p>It&#8217;s that simple!</p>



<figure class="wp-block-video"><video controls src="https://blog.xojo.com/wp-content/uploads/2025/12/Grabacion-de-pantalla-2025-12-09-a-las-14.13.05.mp4"></video></figure>



<p>Run the app and open the contextual menu by right-clicking (or Control-clicking) on the window’s toolbar. You’ll see a new Customize Toolbar menu item. Select it to open the standard macOS toolbar customization panel, where you can rearrange or remove items as you like. When you click OK, your changes are immediately applied to the current toolbar.</p>



<p>One important caveat: these customizations are not preserved between app launches. This happens because each toolbar must have a unique identifier that macOS uses to save and restore its configuration. Since the example toolbar does not provide one, the OS has nothing to store or retrieve. But… who knows what the future holds?</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>
					
		
		<enclosure url="https://blog.xojo.com/wp-content/uploads/2025/12/Grabacion-de-pantalla-2025-12-09-a-las-14.13.05.mp4" length="512280" type="video/mp4" />

			</item>
		<item>
		<title>macOS and iOS: UI Compatibility Mode</title>
		<link>https://blog.xojo.com/2025/12/09/macos-and-ios-ui-compatibility-mode/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Tue, 09 Dec 2025 16:31:52 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[2025r3]]></category>
		<category><![CDATA[Liquid Glass]]></category>
		<category><![CDATA[macOS 26]]></category>
		<category><![CDATA[macOS Tahoe]]></category>
		<category><![CDATA[UI]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15600</guid>

					<description><![CDATA[macOS 26 and iOS 26 bring many changes, most notably a major UI overhaul. This means that some elements in your existing layouts, both small&#8230;]]></description>
										<content:encoded><![CDATA[
<p>macOS 26 and iOS 26 bring many changes, most notably a major UI overhaul. This means that some elements in your existing layouts, both small and significant, may look different. To help developers with this transition, Apple has introduced UI Compatibility Mode in both operating systems for this release.</p>



<p>So, what is UI Compatibility Mode? It’s Apple’s way of ensuring that your app’s UI appears in macOS 26 and iOS 26 just as it did on previous OS versions. No Liquid Glass effects, no unexpected changes in control sizes or behavior, everything stays as you designed it. This means your pixel-perfect layouts from older OS versions, like Sequoia or iOS 18, will continue to look exactly as intended.</p>



<p>More technically, when UI Compatibility Mode is enabled, your app behaves as if it were compiled with an earlier SDK.</p>



<p>The caveat: Apple only guarantees this behavior while macOS 26 and iOS 26 are current. With the next major OS releases, this mode may no longer be available, so it’s a temporary solution.</p>



<p>The upside: At the time of writing, Apple is still refining these OS versions with point releases. If you need your app to run on macOS 26 or iOS 26 with full compatibility, you can enable UI Compatibility Mode in the Inspector Panel under Build Settings &gt; macOS and Build Settings &gt; iOS.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="441" src="https://blog.xojo.com/wp-content/uploads/2025/12/CompatibilityModeSwitch-1024x441.png" alt="" class="wp-image-15606" srcset="https://blog.xojo.com/wp-content/uploads/2025/12/CompatibilityModeSwitch-1024x441.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/12/CompatibilityModeSwitch-300x129.png 300w, https://blog.xojo.com/wp-content/uploads/2025/12/CompatibilityModeSwitch-768x331.png 768w, https://blog.xojo.com/wp-content/uploads/2025/12/CompatibilityModeSwitch.png 1234w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>When enabled, both your debugged apps and the built versions (including those submitted to Apple via Publish) will look and behave on macOS 26 and iOS 26 as if they were compiled with the previous SDK. In fact, the behavior is even more consistent than if they had been compiled using the prior Xojo release.</p>



<p>Below, you can see how the same app appears when running on macOS 26 and iOS 26 with UI Compatibility Mode turned off (showing Liquid Glass and all the new UI effects), compared to how it looks when the switch is turned on:</p>



<figure class="wp-block-image size-full"><img decoding="async" src="https://blog.xojo.com/wp-content/uploads/2025/12/UICompatibilityModeMacOS.png" alt="" class="wp-image-15601"/></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="970" height="1024" src="https://blog.xojo.com/wp-content/uploads/2025/12/UICompatibilityModeiOS-970x1024.png" alt="" class="wp-image-15603" srcset="https://blog.xojo.com/wp-content/uploads/2025/12/UICompatibilityModeiOS-970x1024.png 970w, https://blog.xojo.com/wp-content/uploads/2025/12/UICompatibilityModeiOS-284x300.png 284w, https://blog.xojo.com/wp-content/uploads/2025/12/UICompatibilityModeiOS-768x811.png 768w, https://blog.xojo.com/wp-content/uploads/2025/12/UICompatibilityModeiOS.png 1697w" sizes="auto, (max-width: 970px) 100vw, 970px" /></figure>



<h2 class="wp-block-heading">The Last Word</h2>



<p>All in all, macOS 26 and iOS 26 introduce a major UI overhaul, which can change the appearance of existing layouts. To help developers, Apple has added UI Compatibility Mode, which lets your apps appear on these new OS versions just as they did on previous releases—no Liquid Glass effects or layout changes. Technically, enabling this mode makes your app behave as if it were compiled with an earlier SDK. While Apple only guarantees this behavior for macOS 26 and iOS 26, it ensures consistency for both debugged and built apps, including those submitted via Publish.</p>



<p>UI Compatibility Mode gives you a choice: enable it to preserve your exact layouts across all OS versions, or leave it off to adopt the new macOS 26 and iOS 26 look and feel, which may require adjusting your UI for some quirks.</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>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 loading="lazy" 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="auto, (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 loading="lazy" 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="auto, (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 loading="lazy" 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="auto, (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>Creating Libraries that Support Multiple Project Types</title>
		<link>https://blog.xojo.com/2025/12/09/creating-libraries-that-support-multiple-project-types/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Tue, 09 Dec 2025 16:31:12 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[2025r3]]></category>
		<category><![CDATA[LibMerge]]></category>
		<category><![CDATA[Libraries]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15588</guid>

					<description><![CDATA[Libraries, introduced in Xojo 2025r3, make it easy to reuse your classes and interface items such as windows, webpages, and mobile screens across projects. As&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Libraries, introduced in Xojo 2025r3, make it easy to reuse your classes and interface items such as windows, webpages, and mobile screens across projects. As compiled code, Libraries ensure your projects always use a specific version of your functionality while allowing you to share features with other Xojo users without exposing your intellectual property. Think of them like plugins written in Xojo instead of C++, with the flexibility to use them in a single project folder or in the Plugins folder for access across all projects. The Xojo documentation provides guidance on <a href="https://documentation.xojo.com/topics/code_management/sharing_code_among_multiple_projects.html" target="_blank" rel="noreferrer noopener">creating your own Libraries</a>.</p>



<p>When you create a Library in Xojo, it’s tailored to the project type you’re working in, whether that is Desktop, Web, Mobile or Console, so everything stays organized and easy to manage. The Library format was designed to support all project types simultaneously; unfortunately, the Xojo IDE was not. The good news is that there are still ways to take advantage of the flexible underlying format. Since Libraries are simply .zip files, you can change the extension to .zip and decompress them to explore their contents. Inside, you’ll find a folder named for the project type you originally created it from, making it easy to understand the structure. Here are two ways to create Libraries that support multiple project types.</p>



<h2 class="wp-block-heading"><strong>Merging Libraries Manually</strong></h2>



<p>To manually create a multi-project-type Library, start by building a separate Library for each project type your functionality supports, then change each one’s extension to .zip and decompress it. Choose one decompressed Library to serve as the final version, and copy the project-type folders (Desktop, Web, iOS, Android or Console) from the others into it. When everything is combined, recompress the folder back into a .zip file and change the extension to .xojo_library. You now have a single Library that works across all the project types you included.</p>



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



<p>LibMerge is a utility we created to make it easier to merge Libraries.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="561" src="https://blog.xojo.com/wp-content/uploads/2025/11/LibMerge-1-1024x561.jpg" alt="" class="wp-image-15597" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/LibMerge-1-1024x561.jpg 1024w, https://blog.xojo.com/wp-content/uploads/2025/11/LibMerge-1-300x165.jpg 300w, https://blog.xojo.com/wp-content/uploads/2025/11/LibMerge-1-768x421.jpg 768w, https://blog.xojo.com/wp-content/uploads/2025/11/LibMerge-1.jpg 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<ol class="wp-block-list">
<li>Download LibMerge for <a href="https://blog.xojo.com/wp-content/uploads/2025/12/LibMergeLinux.zip" data-type="attachment" data-id="15691" target="_blank" rel="noreferrer noopener">Linux</a>, <a href="https://blog.xojo.com/wp-content/uploads/2025/12/LibMergeMac.zip" data-type="attachment" data-id="15693" target="_blank" rel="noreferrer noopener">macOS</a> or <a href="https://blog.xojo.com/wp-content/uploads/2025/12/LibMergeWindows.zip" data-type="attachment" data-id="15692" target="_blank" rel="noreferrer noopener">Windows</a>. It will be included in the Extras folder in the next major release.</li>



<li>Launch LibMerge and then click the Add button to select the Libraries you wish to merge or drag them into the Libraries list in the LibMerge window.</li>



<li>On the Info tab, make sure the Version, Copyright and Description values are as you want them for the merged Library. These initial values are loaded from the first Library you add to the list.</li>



<li>Click the Save As button to choose a name and location for your merged Library. That&#8217;s it!</li>
</ol>



<p>If you choose two libraries that both already support the same project type, LibMerge will tell you and not load the second Library. Included with LibMerge is the LibMerge Library which you can use to build the merging of Libraries into your own build tools. Check out the included LibMerge API Guide for details. Here is an example:</p>



<pre class="wp-block-code"><code>Try
   Var merge As New LibMerger
   merge.AddLibrary(SpecialFolder.Desktop.Child("MyDesktopLibrary.xojo_library"))
   merge.AddLibrary(SpecialFolder.Desktop.Child("MyWebLibrary.xojo_library"))
   merge.SaveMergedLibrary(SpecialFolder.Desktop.Child("MergedLibrary.xojo_library"))
Catch error as UnsupportedFormatException
   System.Beep
   MessageBox(error.Message)
End Try</code></pre>



<p>Whether you prefer to roll up your sleeves and merge Libraries manually or let LibMerge handle the heavy lifting, Xojo gives you the flexibility to build reusable components that work across all your project types. With a little exploration and the right tools you can streamline your workflow, reduce duplication and keep your projects cleaner and more maintainable. LibMerge makes this process fast and reliable whether you’re merging two Libraries or twenty. Read more about <a href="https://documentation.xojo.com/topics/code_management/sharing_code_among_multiple_projects.html" target="_blank" rel="noreferrer noopener">Libraries</a> in the Xojo Documentation.</p>



<p><em>Geoff Perlman is the Founder and CEO of Xojo. When he’s not leading the Xojo team he can be found playing drums in Austin, Texas and spending time with his family.</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 WebUserAuthentication Control: Look, Mom, No Passwords!</title>
		<link>https://blog.xojo.com/2025/12/09/new-webuserauthentication-control-look-mom-no-passwords/</link>
		
		<dc:creator><![CDATA[Ricardo Cruz]]></dc:creator>
		<pubDate>Tue, 09 Dec 2025 16:30:29 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[2025r3]]></category>
		<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Passkey]]></category>
		<category><![CDATA[Passwords]]></category>
		<category><![CDATA[webdev]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15321</guid>

					<description><![CDATA[The web framework has a new control available in the Library, WebUserAuthentication. Now that Passkeys have arrived, let&#8217;s explore this feature! Passkeys Demo In this&#8230;]]></description>
										<content:encoded><![CDATA[
<p>The web framework has a new control available in the Library, <code>WebUserAuthentication</code>. Now that Passkeys have arrived, let&#8217;s explore this feature!</p>



<h2 class="wp-block-heading">Passkeys Demo</h2>



<p>In this demo, we will be creating a new account using just our email. Using a platform authenticator, like Apple Passkeys or Windows Hello will make this pretty easy. They are integrated in the operating system and synced across devices. I will be using macOS with the integrated Passwords app, but this is supported in Windows through Windows Hello, or you could store, sync and use Passkeys using a Google Chrome Profile.</p>



<figure class="wp-block-video"><video height="1240" style="aspect-ratio: 1472 / 1240;" width="1472" controls src="https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-passwordless-signup.mp4"></video></figure>



<p>As you can see, there is no intermediate step. No need to use a separate app to store your passwords securely. A Passkey will be generated and stored in the authenticator in one simple step. This Passkey will be automatically synced across devices and available on my iPhone.</p>



<p>Opening the Password application, I already can confirm my new Passkey has been stored for &#8220;localhost&#8221;. Notice the user name is also there, meaning you won&#8217;t need to fill it during the login process.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="710" src="https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-in-password-app-1024x710.png" alt="" class="wp-image-15323" srcset="https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-in-password-app-1024x710.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-in-password-app-300x208.png 300w, https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-in-password-app-768x533.png 768w, https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-in-password-app-1536x1065.png 1536w, https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-in-password-app.png 1716w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>The username isn&#8217;t important or even required, it&#8217;s just to display a friendly name for this user. A Passkey will include the user ID, which can be any arbitrary String you want. In my example, I&#8217;ve used the new <a href="https://documentation.xojo.com/api/math/random.html#random-uuid" target="_blank" rel="noreferrer noopener">Random.UUID method</a>, but this is completely up to you. And this is transparent for the end user.</p>



<p>Now, let&#8217;s try to login:</p>



<figure class="wp-block-video"><video height="1240" style="aspect-ratio: 1472 / 1240;" width="1472" controls src="https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-passwordless-signin.mp4"></video></figure>



<p>That&#8217;s it!</p>



<p>Another thing to notice is, while I have several Passkeys for different websites, only the relevant Passkey can be used. This makes Phishing attacks useless. End users won&#8217;t be able to use a Passkey anywhere else, just on the website where it has been created. And also, users won&#8217;t be able to send their password by mistake to an attacker because … they can&#8217;t!</p>



<p>For web application developers, another interesting thing to note is that you won&#8217;t be able to store a Passkey insecurely. Even if your database gets compromised, a hacker won&#8217;t be able to use the stored public keys to authenticate those users with another service. To make it easier to understand, you will be storing a lock, not the key used to open it.</p>



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



<p>My demo is just the classic email / password sign up / sign in workflow, but without using a password. Passkeys is based on WebAuthn (part of FIDO2) and there are several ways you can use this technology in your web application. For example, you could use a shared computer and still be able to securely log in using your mobile. The platform will display a QR code you can read with your phone camera, and grant the access from your personal device.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="889" src="https://blog.xojo.com/wp-content/uploads/2025/08/Sign-In-1024x889.png" alt="" class="wp-image-15325" srcset="https://blog.xojo.com/wp-content/uploads/2025/08/Sign-In-1024x889.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/08/Sign-In-300x260.png 300w, https://blog.xojo.com/wp-content/uploads/2025/08/Sign-In-768x666.png 768w, https://blog.xojo.com/wp-content/uploads/2025/08/Sign-In-1536x1333.png 1536w, https://blog.xojo.com/wp-content/uploads/2025/08/Sign-In.png 1604w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>In my example application, the user can sign up using different emails. If the Passwords app encounters more than one for my domain it will allow the user to specify the Passkey to use:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="889" src="https://blog.xojo.com/wp-content/uploads/2025/08/o2-baieeamele.com_-1024x889.png" alt="" class="wp-image-15326" srcset="https://blog.xojo.com/wp-content/uploads/2025/08/o2-baieeamele.com_-1024x889.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/08/o2-baieeamele.com_-300x260.png 300w, https://blog.xojo.com/wp-content/uploads/2025/08/o2-baieeamele.com_-768x666.png 768w, https://blog.xojo.com/wp-content/uploads/2025/08/o2-baieeamele.com_-1536x1333.png 1536w, https://blog.xojo.com/wp-content/uploads/2025/08/o2-baieeamele.com_.png 1604w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Xojo will take care of preparing the <code>WebAuthn</code> steps, verifying signatures and doing the common busy work for you. You will have to decide which workflow makes sense for your application and perform any further verifications, like sending a verification email on register, to ensure this user owns that account.</p>



<h2 class="wp-block-heading">Multi-Factor Authentication</h2>



<p>If you already require your users to authenticate with a username (or email) and a password, you could use <code>WebUserAuthentication</code> as a second factor. That means the user will need to provide something this person knows (a username and password combination) in addition to something the user has (the authenticator device)</p>



<p>Other common multi-factor authentication schemes are email magic links and time-based one-time passwords, <em>&#8220;TOTP&#8221;</em>.</p>



<p>More factors equal better security, of course. But as usual when it comes to security, you&#8217;ll have to find the sweet spot between secure and comfortable.</p>



<h2 class="wp-block-heading">Usernameless + Passwordless Authentication … Wait, What?!?</h2>



<p><em>&#8220;How can I authenticate without providing my username or email?&#8221;</em>. This is where real new possibilities arise. When you use a username with a password that only Chuck Norris and you know, this becomes a &#8220;proof of identity&#8221; (at least in theory, in practice a hacker could compromise an account using a weak password)</p>



<p>When using an authenticator without a username or password, it becomes a &#8220;proof of possession&#8221; of the authenticator device.</p>



<p>Again, think about it as a locker&#8217;s lock and a key. Everyone can see the lock, but only people with the correct key can open it. The public key would be the door&#8217;s lock, while the authenticator device would be the key. You can share the key with another person you trust to grant this person access to the contents behind that door. The difference with a real-life lock is that we will be using a really secure one, with a security key.</p>



<p>As long as you can proof you have a valid &#8220;key&#8221; to authenticate, you are granted to continue.</p>



<p>Consider the following scenario. The company could have a web application that uses a traditional username + password authentication but, for really special activities, the user needs to authenticate with a physical USB key authenticator device that is shared by everyone in the office.</p>



<p>Other use cases are obviously when privacy is involved. A private journal, or a private blogging service, voting. The inconvenience in this case is the user won&#8217;t be able to recover the account if they lose access to the authenticator. In this case, you might want to offer a different recovery solution, like printing a very long recovery code. If they also lose the recovery code, they will permanently lose the account.</p>



<h2 class="wp-block-heading">How To Use The New Control</h2>



<p>As you do with any other non-visual control, like a <code>WebTimer</code>, you can just drop the new <code>WebUserAuthentication</code> control into your WebPage.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="491" src="https://blog.xojo.com/wp-content/uploads/2025/08/webauthentication-dropping-into-webpage-1024x491.png" alt="" class="wp-image-15327" srcset="https://blog.xojo.com/wp-content/uploads/2025/08/webauthentication-dropping-into-webpage-1024x491.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/08/webauthentication-dropping-into-webpage-300x144.png 300w, https://blog.xojo.com/wp-content/uploads/2025/08/webauthentication-dropping-into-webpage-768x368.png 768w, https://blog.xojo.com/wp-content/uploads/2025/08/webauthentication-dropping-into-webpage-1536x736.png 1536w, https://blog.xojo.com/wp-content/uploads/2025/08/webauthentication-dropping-into-webpage-2048x982.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Then configure its properties. The most important one is the Domain field. It must match the domain name where your application will be deployed. If you want to test it locally without using HTTPS, it must be &#8220;localhost&#8221; (&#8220;127.0.0.1&#8221; won&#8217;t work)</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="666" height="269" src="https://blog.xojo.com/wp-content/uploads/2025/08/Appearance-copia.png" alt="" class="wp-image-15328" srcset="https://blog.xojo.com/wp-content/uploads/2025/08/Appearance-copia.png 666w, https://blog.xojo.com/wp-content/uploads/2025/08/Appearance-copia-300x121.png 300w" sizes="auto, (max-width: 666px) 100vw, 666px" /></figure>



<p>There are four events available:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="656" height="250" src="https://blog.xojo.com/wp-content/uploads/2025/11/Captura-de-pantalla-2025-11-20-a-las-10.50.33.png" alt="" class="wp-image-15544" srcset="https://blog.xojo.com/wp-content/uploads/2025/11/Captura-de-pantalla-2025-11-20-a-las-10.50.33.png 656w, https://blog.xojo.com/wp-content/uploads/2025/11/Captura-de-pantalla-2025-11-20-a-las-10.50.33-300x114.png 300w" sizes="auto, (max-width: 656px) 100vw, 656px" /></figure>



<p>You can use <code>RegistrationSucceeded</code> and <code>AuthenticationSucceeded</code> to interact with your Database, store the details and redirect the user to their dashboard.</p>



<p>In <code>RegistrationSucceeded</code>, a <code>WebAuthenticationCredential</code> will be given to you. This is a data transfer object with the following properties you need to store in your database:</p>



<ul class="wp-block-list">
<li>ID</li>



<li>PublicKey</li>



<li>AuthenticationAttempts</li>



<li>DisplayName</li>
</ul>



<p>Error will be fired when something goes wrong. A message will also show with the details about what happened, but it isn&#8217;t meant to be shared with the end user. During the sign up and sign in processes, you should display generic messages for security, to avoid letting bad actors know what&#8217;s going on. If you need to inform the user something related to these messages, you can send them an automated email instead.</p>



<p><code>CredentialRequested</code> will be fired during the authentication ceremony. A userId and a credentialId will be given to you, and you should return a new <code>WebAuthenticationCredential</code> instance with the details coming from the <code>RegistrationSucceededEvent</code>.</p>



<p>Also, when <code>AuthenticationSucceeded</code> happens, the event will come with an <code>authenticationAttempts</code> parameter. This will be an incremental value used to update your credentials. This is part of the <code>WebAuthn</code> protocol sign in ceremony used to detect cloned authenticators, which is supported by Xojo. Please notice this value might come always as &#8220;0&#8221; when using Safari, for example, but Google Chrome will increase its value each time.</p>



<p>You can initiate a Registration or Authentication ceremony by calling Register or Authenticate, respectively.</p>



<ul class="wp-block-list">
<li><strong>Register</strong>(userId As String, username As String = &#8220;&#8221;, displayName As String = &#8220;&#8221;)<br>The parameter userId is required, the new credential will be built specifically for it. It can be anything that makes sense in your application, like an auto-incremental number or a random UUID . The other parameters are meant for giving the credential a friendly name. The username could be a nickname, or an email. In workflows where you allow the user to store more than one passkey, the displayName could be something like &#8220;Backup key&#8221;.</li>



<li><strong>Authenticate</strong>(Optional allowCredentials() As String)<br>This will initiate the authentication ceremony. You can optionally pass an array of credential IDs, allowed for the user trying to get access to the protected resource.</li>
</ul>



<h2 class="wp-block-heading">Adoption and Compatibility</h2>



<p>Not every user may know they even exist, what they are, how they work or if they will be more secure than using their pet&#8217;s name and birthdate. This can cause some friction. Other users that adopted the usage from day one might have at least two physical USB keys. They expect your application to allow them to enter more than one, just in case they lose their main USB key.</p>



<p>Passkeys are here to stay and their adoption will continue growing on web services. That said, depending on the combination of operating system and browser, there are some gotchas. Google Chrome or Firefox should work on every operating system. Apple users will probably obtain the best user experience if they&#8217;re tied to this ecosystem. Linux users using alternative browsers could experience some challenges.</p>



<p>If compatibility is a must for your application, you should still offer an alternative to Passkeys. For example, legacy passwords, or &#8220;magic login links&#8221; sent by email.</p>



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



<p>We are sure Passkeys will be the norm in the coming years. Read more in the <a href="https://documentation.xojo.com/api/web/webauthenticationcredential.html" target="_blank" rel="noreferrer noopener">Xojo Docs</a>. Xojo is ready to embrace them and you can start adopting them in your Xojo Web application today!</p>



<p><em>Ricardo has always been curious about how things work. Growing up surrounded by computers</em> he became interested in <em>web technologies in the dial-up connections era. Xojo has been his secret weapon and language of preference since 2018. When he’s not online, chances are he will be scuba diving … or crocheting amigurumis. Find Ricardo on Twitter <a href="https://web.archive.org/web/20220805000833/https://www.twitter.com/piradoiv" target="_blank" rel="noreferrer noopener">@piradoiv</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>
					
		
		<enclosure url="https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-passwordless-signup.mp4" length="684699" type="video/mp4" />
<enclosure url="https://blog.xojo.com/wp-content/uploads/2025/08/passkeys-passwordless-signin.mp4" length="435817" type="video/mp4" />

			</item>
		<item>
		<title>Welcome to the Grid</title>
		<link>https://blog.xojo.com/2025/12/09/welcome-to-the-grid/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Tue, 09 Dec 2025 16:29:53 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[2025r3]]></category>
		<category><![CDATA[Grid Control]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15663</guid>

					<description><![CDATA[Xojo 2025r3 introduces the first iteration of the DesktopGrid control. This long-awaited control allows you to display as many rows and columns as needed, making&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Xojo 2025r3 introduces the first iteration of the DesktopGrid control. This long-awaited control allows you to display as many rows and columns as needed, making it ideal for complex data layouts. Let’s take a closer look at some of its features.</p>



<p>Like other controls in the Xojo framework, DesktopGrid is a data-source-based control. Instead of manually adding cells, rows, or columns as you would with a ListBox, the DesktopGrid itself requests the data it needs when it needs it. This approach brings several benefits:</p>



<p><strong>ContainerControl-based cells:</strong> The cells in a DesktopGrid are full ContainerControls, just like the ones you’re already familiar with. You can use the same layout for all cells or customize different layouts for individual cells, rows, or columns. Each cell represents a live control and behaves accordingly.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="741" src="https://blog.xojo.com/wp-content/uploads/2025/12/Captura-de-pantalla-2025-12-04-a-las-11.50.43-1024x741.png" alt="" class="wp-image-15666" srcset="https://blog.xojo.com/wp-content/uploads/2025/12/Captura-de-pantalla-2025-12-04-a-las-11.50.43-1024x741.png 1024w, https://blog.xojo.com/wp-content/uploads/2025/12/Captura-de-pantalla-2025-12-04-a-las-11.50.43-300x217.png 300w, https://blog.xojo.com/wp-content/uploads/2025/12/Captura-de-pantalla-2025-12-04-a-las-11.50.43-768x556.png 768w, https://blog.xojo.com/wp-content/uploads/2025/12/Captura-de-pantalla-2025-12-04-a-las-11.50.43-1536x1112.png 1536w, https://blog.xojo.com/wp-content/uploads/2025/12/Captura-de-pantalla-2025-12-04-a-las-11.50.43-2048x1483.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<ul class="wp-block-list">
<li><strong>Lower memory footprint:</strong> DesktopGrid keeps only the cells that are currently visible on screen “alive,” which significantly reduces memory usage, especially when working with very large data sets. For example, when you resize the containing window, the DesktopGrid will request additional content from its DataSource <strong>only if necessary</strong>. When cells move outside the visible area of the DesktopGrid, their corresponding ContainerControl instances are “closed,” triggering an event you can handle, and freeing the memory they were using.</li>



<li><strong>Faster execution</strong>: Large data sets are not preloaded into the control. This means that opening a window with a DesktopGrid or running an app with many cells happens almost instantly, providing a smooth and responsive experience even with extensive data.</li>
</ul>



<figure class="wp-block-video"><video height="1080" style="aspect-ratio: 1920 / 1080;" width="1920" controls src="https://blog.xojo.com/wp-content/uploads/2025/12/FastExecution.mp4"></video></figure>



<ul class="wp-block-list">
<li><strong>Layout Flexibility</strong>: Since the number of rows and columns is determined by the DataSource, a DesktopGrid instance can have a flexible layout rather than a rigid, static one. For example, you can adjust the number of columns based on the available width of the DesktopGrid. You can also set different widths for individual columns, while the row height remains fixed.</li>
</ul>



<figure class="wp-block-video"><video height="1080" style="aspect-ratio: 1920 / 1080;" width="1920" controls src="https://blog.xojo.com/wp-content/uploads/2025/12/FlexibleGridLayout.mp4"></video></figure>



<ul class="wp-block-list">
<li><strong>Data representation changes &#8220;on the fly&#8221;</strong>: Because the DataSource provides the content for each cell, you can dynamically change the data representation (the ContainerControl layout) at runtime or even pull data from a completely different source.</li>



<li><strong>A better separation of responsibilities</strong>: While you can implement the GridDataSource interface directly on the DesktopGrid or in its containing Window, using a dedicated DataSource class is the cleaner approach. This ensures a clearer separation between the view (the DesktopGrid), the model (the data feeding the cells), and the controller (which manages interactions between the two). A single DataSource can also feed multiple DesktopGrid instances, making your code more reusable.</li>



<li><strong>Headers everywhere:</strong> By default, DesktopGrid displays column and row headers. You can modify this in the Inspector Panel or via code. Depending on your scenario, you might choose to show both headers, just one, or hide them entirely. By default, the headers display simple numbering for each column and row. However, you can fully customize their content using the PaintHeaderContentForColumn and PaintHeaderContentForRow methods of your GridDataSource implementation, giving you complete control over how headers appear.</li>
</ul>



<h2 class="wp-block-heading">Is the DesktopGrid a replacement for DesktopListBox?</h2>



<p>While you can use DesktopGrid for many purposes, it is not a direct replacement for DesktopListBox in all scenarios. If your data is primarily textual (like simple labels) or relies on features specific to DesktopListBox, such as hierarchical data representation, then DesktopListBox is still the better choice.</p>



<p>DesktopGrid shines in scenarios where you need complex layouts in each cell using live controls rather than temporary pictures or workarounds. Each cell can have its own layout, including interactive controls such as ListBoxes, buttons, or other reactive elements that respond to user interactions. This makes DesktopGrid ideal for rich, interactive, and highly customizable grid layouts.</p>



<h2 class="wp-block-heading">Performance Caveats to Consider</h2>



<p>Although the first iteration of DesktopGrid was designed with performance in mind, there are some factors that may affect its redraw speed. The most significant is that each cell uses live controls, so performance will be similar to placing the same number of controls directly on a Window. While alternative approaches—such as reusable cells or backing picture representations—could improve speed, they come with their own trade-offs.</p>



<p>As a general rule, performance depends on cell size and the number of visible cells at any given time. A large DesktopGrid with many rows and columns, even if each cell contains just a simple label, may experience slower refresh rates. Additionally, actual performance can vary depending on the operating system and its version, as these affect the underlying drawing and refresh processes.</p>



<h2 class="wp-block-heading">Wiring the Grid</h2>



<p>Although this is just the first iteration of the DesktopGrid control, we are already working on the next set of features while further refining the existing ones. You can read more about this control in the <a href="https://documentation.xojo.com/api/user_interface/desktop/desktopgrid.html" target="_blank" rel="noreferrer noopener">Xojo Documentation</a>. We want to extend a big <strong>THANK YOU</strong> to everyone who provided feedback and dedicated their time testing the Grid during the beta cycle, you know who you are! Your input is invaluable, and the feature requests you submitted (combined with others already on our roadmap) will help shape a DesktopGrid that better fits your needs.</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>
					
		
		<enclosure url="https://blog.xojo.com/wp-content/uploads/2025/12/FastExecution.mp4" length="432356" type="video/mp4" />
<enclosure url="https://blog.xojo.com/wp-content/uploads/2025/12/FlexibleGridLayout.mp4" length="2560805" type="video/mp4" />

			</item>
		<item>
		<title>Optimizing Xojo Code, Part 2: Using a Timer to Keep the UI Responsive</title>
		<link>https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Tue, 25 Nov 2025 16:00:00 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Code Optimization]]></category>
		<category><![CDATA[Developer Challenge]]></category>
		<category><![CDATA[Timers]]></category>
		<category><![CDATA[UI Responsiveness]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15526</guid>

					<description><![CDATA[Welcome back! If you missed the first part in this series, check out Optimizing Xojo Code, Part 1: Getting Started, where we dissected the blocking&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Welcome back! If you missed the first part in this series, check out <strong><a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/">Optimizing Xojo Code, Part 1: Getting Started</a></strong>, where we dissected the blocking <code>While</code> loop that counted up to <code>kCountTo</code>, updated a label, and kept the UI responsive only by calling <code>App.DoEvents</code>. That code works, but it spends most of its life running on the UI thread. In this tutorial we’ll rebuild that workflow step by step and end up with the first optimized solution: a timer-driven solution that keeps the interface responsive.</p>



<h3 class="wp-block-heading">Step 1: Let&#8217;s sketch the goal</h3>



<p>We will need a button that, when pressed, starts a simulated wait that updates a label every 100 ms until a fixed duration (<code>kCountTo</code>, which remains <code>20000</code> ms in our example) is reached. So, the timer will fire periodically and handle the counting there. The button simply resets state and starts the timer.</p>



<h3 class="wp-block-heading">Step 2: Prepare the UI components</h3>



<p>Create a <code>DesktopLabel</code> named <code>StatusLabel</code> to display progress.<br>Add a <code>DesktopButton</code> (caption it “Method 1”) whose <code>Pressed</code> event will kick off the timer.<br>Finally, place a <code>Timer</code> control onto the window, name it <code>mTimer</code>, set its <code>Period</code> to <code>100</code>, and set <code>RunMode</code> to <code>Multiple</code> (but leave it off until the button starts it).<br>Add an <code>Integer</code> property to the window such as <code>mMsWaited</code> to accumulate elapsed milliseconds, and keep <code>kCountTo</code> defined as <code>20000</code>.</p>



<h3 class="wp-block-heading">Step 3: Wire up the button</h3>



<p>The button handler becomes very simple. Reset the tracked milliseconds, show <code>"0"</code> in the label, ensure the timer runs at 100 ms ticks, and let it fire repeatedly:</p>



<pre class="wp-block-code"><code>Sub Pressed()
  // Reset the tracked elapsed ms and start the timer at 100 ms ticks.
  mMsWaited = 0
  StatusLabel.Text = "0"
  mTimer.Period = 100
  mTimer.RunMode = Timer.RunModes.Multiple
End Sub</code></pre>



<p>This code primes the state but does not block. The timer will perform the actual counting.</p>



<h3 class="wp-block-heading">Step 4: Let the timer take over</h3>



<p>Implement <code>mTimer.Action</code> to run on the UI thread. Each tick adds the timer’s period to <code>mMsWaited</code>, updates the label, and turns itself off once <code>kCountTo</code> has been reached:</p>



<pre class="wp-block-code"><code>Sub Action()
  mMsWaited = mMsWaited + Me.Period

  If mMsWaited &gt;= kCountTo Then
    Me.RunMode = Timer.RunModes.Off
    StatusLabel.Text = "done"
  Else
    StatusLabel.Text = mMsWaited.ToString
  End If
End Sub</code></pre>



<p>This keeps your UI responsive because the timer fires briefly and returns control back to the event loop instead of spinning inside a <code>While</code> loop.</p>



<h3 class="wp-block-heading">Step 5: Test the flow</h3>



<p>Run the app, click the button previously created and watch the label count up and stop at the target value. The timer approach lets other interface interactions remain responsive while still providing clear progress feedback.</p>



<h2 class="wp-block-heading">What makes this timer driven solution a solid first step?</h2>



<p>It shows how you can preserve the original behavior while giving the UI breathing room. It avoids <code>App.DoEvents</code>, reduces tight loops, and still delivers frequent updates. In the next article we’ll build on this idea and explore alternative approaches that continue to improve responsiveness and structure.</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>Optimizing Code Series:</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 1: Getting Started</a></li>



<li><a href="https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 2: Using a Timer to Keep the UI Responsive</a></li>



<li><a href="https://blog.xojo.com/2026/01/14/optimizing-xojo-code-part-3-programmatic-timers-and-addhandler/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 3: Programmatic Timers and AddHandler</a></li>



<li><a href="https://blog.xojo.com/2026/02/02/optimizing-xojo-code-part-4-timer-calllater/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 4: Timer.CallLater</a></li>



<li><a href="https://blog.xojo.com/2026/03/02/optimizing-xojo-code-part-5-threads-and-userinterfaceupdate/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 5: Threads and UserInterfaceUpdate</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Optimizing Xojo Code, Part 1: Getting Started</title>
		<link>https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Thu, 20 Nov 2025 15:50:38 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Code Optimization]]></category>
		<category><![CDATA[Developer Challenge]]></category>
		<category><![CDATA[Performance Tuning]]></category>
		<category><![CDATA[Programming Tips]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15493</guid>

					<description><![CDATA[We all write code that&#160;works. It compiles, it runs, and it accomplishes its task. But sometimes, “working” isn’t quite the same as “optimal.” Optimization is&#8230;]]></description>
										<content:encoded><![CDATA[
<p>We all write code that&nbsp;<em>works</em>. It compiles, it runs, and it accomplishes its task. But sometimes, “working” isn’t quite the same as “optimal.” Optimization is about making your applications faster, more responsive, and more efficient, leading to a better experience for the end-users.</p>



<p>Let’s look at a small, functional snippet of Xojo code. It does its job but it has room to grow, to become more polished.</p>



<h3 class="wp-block-heading" id="the-code-in-question">The Code in Question</h3>



<details class="wp-block-details is-layout-flow wp-block-details-is-layout-flow"><summary><strong>Important Disclaimer</strong></summary>
<p>This code snippet is <em>intentionally suboptimal</em> and provided <strong>solely for demonstration purposes</strong> to kick off our optimization discussion. It relies on <code>App.DoEvents</code> in a tight loop, which is a <strong>discouraged anti-pattern</strong> in Xojo desktop apps. <strong>Do NOT use this in production!</strong> Read more here: <a href="https://forum.xojo.com/t/re-optimizing-xojo-code-part-1-getting-started" target="_blank" rel="noreferrer noopener">https://forum.xojo.com/t/re-optimizing-xojo-code-part-1-getting-started</a></p>
</details>



<p>It’s designed to simulate a waiting period, updating a label as it progresses:</p>



<pre class="wp-block-code"><code>Public Const kCountTo as Number = 20000

Sub Pressed() Handles Pressed
  Var numMsWaited As Integer = 0
  While numMsWaited &lt; kCountTo
    numMsWaited = numMsWaited + 100
    App.DoEvents(100)
    StatusLabel.Text = numMsWaited.ToString
  Wend
  
  StatusLabel.Text = "done"
End Sub</code></pre>



<p>This code technically works in simple tests… successfully counts up to&nbsp;<code>kCountTo</code>, updating&nbsp;<code>StatusLabel</code>&nbsp;along the way and yielding control with&nbsp;<code>App.DoEvents</code>. It gets the job done, but as the disclaimer notes, it&#8217;s ripe for optimization due to its flaws. Are there alternative approaches that could make this process more efficient, more responsive, or perhaps more elegant?</p>



<h3 class="wp-block-heading" id="lets-optimize-this-code">So&#8230; Can We Optimize This Xojo Code Snippet?</h3>



<p>Analyze this snippet and consider how you might improve it. Think about performance, responsiveness, and any Xojo-specific features that could offer a more robust solution.</p>



<p>We encourage you to share your insights, your refactored code, or even just your ideas for improvement, on the&nbsp;<a href="https://forum.xojo.com/">Xojo forum</a>.</p>



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



<p>I’ll present some optimized versions in future posts. Stay tuned and put on your optimization hats!</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>Optimizing Code Series:</strong></p>



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2025/11/20/optimizing-xojo-code-part-1-getting-started/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 1: Getting Started</a></li>



<li><a href="https://blog.xojo.com/2025/11/25/optimizing-xojo-code-part-2-using-a-timer-to-keep-the-ui-responsive/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 2: Using a Timer to Keep the UI Responsive</a></li>



<li><a href="https://blog.xojo.com/2026/01/14/optimizing-xojo-code-part-3-programmatic-timers-and-addhandler/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 3: Programmatic Timers and AddHandler</a></li>



<li><a href="https://blog.xojo.com/2026/02/02/optimizing-xojo-code-part-4-timer-calllater/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 4: Timer.CallLater</a></li>



<li><a href="https://blog.xojo.com/2026/03/02/optimizing-xojo-code-part-5-threads-and-userinterfaceupdate/" target="_blank" rel="noreferrer noopener">Optimizing Xojo Code, Part 5: Threads and UserInterfaceUpdate</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Xojo 2025r2.1: Publishing macOS Apps Under Tahoe</title>
		<link>https://blog.xojo.com/2025/10/14/xojo-2025r2-1-publishing-macos-apps-under-tahoe/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Tue, 14 Oct 2025 21:20:03 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[macOS Tahoe]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=15445</guid>

					<description><![CDATA[macOS 26 is in the wild, and many Xojo users have likely updated their Macs to the latest version. While Xojo 2025r2.1 is compatible and&#8230;]]></description>
										<content:encoded><![CDATA[
<p><a href="https://blog.xojo.com/2025/09/15/xojo-support-for-macos-26-and-ios-26/" target="_blank" rel="noreferrer noopener">macOS 26 is in the wild</a>, and many Xojo users have likely updated their Macs to the latest version. While Xojo 2025r2.1 is compatible and can build apps that run under the latest macOS, the <a href="https://blog.xojo.com/2025/03/25/how-to-publish-macos-and-ios-apps-to-the-app-store-directly-from-xojo/" target="_blank" rel="noreferrer noopener">Publish feature</a> depends on certain tools provided by Xcode. Unfortunately, one of these tools has undergone a significant change in the latest Xcode release, causing the Publish feature to no longer function correctly.</p>



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



<p>There are two possible solutions:</p>



<ul class="wp-block-list">
<li><strong>If your Mac still runs under macOS 15.7 Sequoia</strong> (or an earlier macOS version supported by Xojo&#8217;s Publish feature) with Xcode 26 installed,  you can restore Publish feature compatibility by installing Xcode 16.4.x and making that version the active one in your toolchain (especially if you have multiple Xcode versions installed).</li>



<li><strong>If your Mac is running macOS 26.x Tahoe</strong> with Xcode 26 installed, Xojo&#8217;s Publish feature for macOS apps won&#8217;t work as expected, specifically when it attempts to retrieve the AppID from the App Store Connect. The good news is that by the time this error occurs, your app has already been successfully compiled and the .pkg file created. You can use Apple’s <a href="https://www.google.com/url?sa=t&amp;source=web&amp;rct=j&amp;opi=89978449&amp;url=https://apps.apple.com/us/app/transporter/id1450874784%3Fmt%3D12&amp;ved=2ahUKEwiitNb4mo-QAxWphv0HHc48DjQQFnoECBcQAQ&amp;usg=AOvVaw2lhxdNCd0mHUPXUYrhF8U_" target="_blank" rel="noreferrer noopener">Transporter app</a> to complete the final step of uploading the .pkg file to App Store Connect.</li>
</ul>



<p>This issue has been fixed and the solution will be included in Xojo 2025r3. The update also improves how the App ID is retrieved by relying on the available provider listing. This rare issue could affect users whose Apple ID is associated with multiple publishing services, for example, if the same Apple ID is used for both app development and podcast publishing.</p>



<p>Once Xojo 2025r3 is released, the Publish feature will work as before on macOS Sequoia (and previous supported macOS versions), and it will also function properly with the new Xcode 26 toolchain &#8211; whether installed on Sequoia or on the latest macOS 26. Read more about Xojo Support for macOS 26 and iOS 26 on the <a href="https://blog.xojo.com/2025/09/15/xojo-support-for-macos-26-and-ios-26/" target="_blank" rel="noreferrer noopener">Xojo Blog</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 – Part 5: Adding Text Alignment</title>
		<link>https://blog.xojo.com/2025/10/08/how-to-create-a-custom-button-control-in-xojo-part-5-adding-text-alignment/</link>
		
		<dc:creator><![CDATA[Gabriel Ludosanu]]></dc:creator>
		<pubDate>Wed, 08 Oct 2025 15:54:00 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Tutorials]]></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=15436</guid>

					<description><![CDATA[In our previous installment, we successfully wired up keyboard focus to our custom&#160;DesktopCanvas subclass, making it fully accessible and user-friendly. Now, we’re going to tackle&#8230;]]></description>
										<content:encoded><![CDATA[
<p>In our previous installment, we successfully wired up keyboard focus to our custom&nbsp;<code>DesktopCanvas</code> subclass, making it fully accessible and user-friendly.</p>



<p>Now, we’re going to tackle another key feature: customizable text alignment. By the end of this tutorial, you’ll be able to set the button’s text to align left, center, or right, and we’ll introduce a small amount of padding to keep the text from touching the edges when it’s not centered. This approach uses a strongly typed&nbsp;<code>Enumeration</code>&nbsp;to ensure we only accept valid alignment values, maintaining the high quality of our custom control.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="314" height="182" src="https://blog.xojo.com/wp-content/uploads/2025/09/Screenshot-2025-09-30-150534.png" alt="" class="wp-image-15440" srcset="https://blog.xojo.com/wp-content/uploads/2025/09/Screenshot-2025-09-30-150534.png 314w, https://blog.xojo.com/wp-content/uploads/2025/09/Screenshot-2025-09-30-150534-300x174.png 300w" sizes="auto, (max-width: 314px) 100vw, 314px" /></figure>



<h3 class="wp-block-heading" id="define-the-text-alignment-options">1. Define the Text Alignment Options</h3>



<p>To make our alignment property easy to use and type-safe, we will define a new enumeration inside the&nbsp;<code>CanvasButton</code>&nbsp;class.</p>



<p>Inside your&nbsp;<code>CanvasButton</code>&nbsp;class, go to&nbsp;<strong>Insert &gt; Enumeration</strong>&nbsp;and add the following:</p>



<pre class="wp-block-code"><code>  Left = 0
  Center = 1
  Right = 2</code></pre>



<h3 class="wp-block-heading" id="add-new-properties-for-alignment-and-padding">2. Add New Properties for Alignment and Padding</h3>



<p>Next, we need two new properties in the&nbsp;<code>CanvasButton</code>&nbsp;class to store the selected alignment and the padding value.</p>



<p>The&nbsp;<code>TextAlignment</code>&nbsp;property will use our new&nbsp;<code>TextAlign</code>&nbsp;enumeration, and, crucially, it defaults to&nbsp;<code>TextAlign.Center</code>.<br>The&nbsp;<code>TextPadding</code>&nbsp;property provides an adjustable inner margin, which is especially important for left and right alignment.</p>



<pre class="wp-block-code"><code>Public Property TextAlignment As TextAlign = TextAlign.Center
Public Property TextPadding As Integer = 8</code></pre>



<h3 class="wp-block-heading" id="update-the-paint-method">3. Update the Paint Method</h3>



<p>The core of this change happens in the&nbsp;<code>Paint</code>&nbsp;event handler. We need to modify the logic that calculates the horizontal position of the text (<code>tx</code>) to respect the value of our new&nbsp;<code>TextAlignment</code>&nbsp;property.</p>



<p>Locate the&nbsp;<code>Paint</code>&nbsp;event and replace the existing code with the following:</p>



<pre class="wp-block-code"><code>Sub Paint(g As Graphics, areas() As Rect) Handles Paint
  #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(0, 0, g.Width, g.Height, currentCornerRadius, currentCornerRadius)
  
  // Draw the focus ring
  If IsFocused And AllowFocusRing Then
    g.DrawingColor = Color.HighlightColor
    g.PenSize = 1
    g.DrawRoundRectangle(2, 2, g.Width-4, g.Height-4, CornerRadius-2, CornerRadius-2)
  End If
  
  // 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.
  // Updated: compute X based on TextAlignment (Left, Center, Right) while preserving centered behavior as default.
  Var tx As Double
  Select Case TextAlignment
  Case TextAlign.Left
    tx = TextPadding
  Case TextAlign.Right
    tx = g.Width - tw - TextPadding
  Case TextAlign.Center
    tx = (g.Width - tw) / 2
  End Select
  // 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)
End Sub</code></pre>



<p>The magic happens at line 60 <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<h3 class="wp-block-heading" id="inspector-integration">4. Inspector Integration</h3>



<p>If you want the alignment to be easily adjustable in the Xojo Inspector, you should expose the&nbsp;<code>TextAlignment</code>&nbsp;and&nbsp;<code>TextPadding</code>&nbsp;properties. For&nbsp;<code>TextAlignment</code>, because it uses an&nbsp;<code>Enumeration</code>, Xojo will automatically display a helpful dropdown menu with Left, Center, and Right options once you expose it through the Inspector Behavior editor.</p>



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



<li>Select ‘Inspector Behavior…’</li>



<li>Scroll through the property list and check the checkboxes for both&nbsp;<code>TextAlignment</code>&nbsp;and&nbsp;<code>TextPadding</code>.</li>
</ul>



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



<p>You can now set the text alignment directly in the code or via the Inspector.</p>



<p>For example, to set alignment in code:</p>



<pre class="wp-block-code"><code>// Set the button to right-aligned text
MyCanvasButton.TextAlignment = CanvasButton.TextAlign.Right</code></pre>



<p>Since the default value for&nbsp;<code>TextAlignment</code>&nbsp;is&nbsp;<code>Center</code>, no existing code needs to be modified, and all your current custom buttons will continue to render perfectly centered unless you explicitly change the alignment property.</p>



<p>Hope this update was useful.</p>



<p>You can grab the latest source on GitHub:&nbsp;<a href="https://github.com/xolabsro/CanvasButton">GitHub – 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>
					
		
		
			</item>
	</channel>
</rss>
