<?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>2024r3 &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/2024r3/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, 18 Aug 2025 20:38: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>Preemptive Threads Are Here, and They Are… Pretty Good</title>
		<link>https://blog.xojo.com/2024/10/01/preemptive-threads-are-here-and-they-are-pretty-good/</link>
		
		<dc:creator><![CDATA[Kem Tekinay]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:39:29 +0000</pubDate>
				<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Preemptive Threads]]></category>
		<category><![CDATA[Threading]]></category>
		<category><![CDATA[Threads]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13693</guid>

					<description><![CDATA[At long last, Xojo has introduced what might be the most-requested feature of all time: preemptive threads. But what are they, when and how do&#8230;]]></description>
										<content:encoded><![CDATA[
<p>At long last, Xojo has introduced what might be the most-requested feature of all time: preemptive threads. But what are they, when and how do you use them, and what are their limitations? Let&#8217;s get into it…</p>



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



<p>Threads have been a part of of the Xojo language for a long time, and by now experienced users know the basics: subclass a <code>Thread</code>, fill in the <code>Run</code> event, then call <code>Start</code>. The code in <code>Run</code> will execute independently from the rest of your code leaving your app responsive while it does work in the background.</p>



<p>Mostly.</p>



<p>See, until now, a <code>Thread</code> was only &#8220;cooperative&#8221;, meaning it ran alongside your main code with the framework deciding when to switch between them and how long each should execute. While the main code was running, the <code>Thread</code> code was paused, and while the <code>Thread</code> was running, the main code was paused.</p>



<p>Think of it like standing before two devices that perform different functions when cranked, but only having one crank available. You run the first machine for a bit, then the other, then back to the first, until they are done. And you do it really, really fast.</p>



<p>This worked pretty well when your goal was, say, to keep your user interface responsive. You could spin long-running code into a <code>Thread</code>, then present the results once it finished.</p>



<p>But it was inadequate if your objective was to speed up some intense process, or the code in your <code>Thread</code> did not present logical places to yield time back to your main code. In the former scenario, you were better off not using a <code>Thread</code>, or perhaps using <code>Worker</code> (a severely limited earlier attempt at allowing simultaneous processing), while in the latter you would have to manually yield back processing time, leading to even slower operation.</p>



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



<p>Cooperative threads are fine for many tasks, but when you need something that truly runs independently within your app, a &#8220;preemptive&#8221; thread is required.</p>



<p>A preemptive thread spins off onto another core in your machine, which probably has at least four, and runs there entirely isolated from other threads. It&#8217;s like launching a separate, mini-app that you can share information with.</p>



<p>The limitations that apply to cooperative threads drop away. Since it runs on a different core, it cannot slow down or interfere with your main code, and will run as fast as its core will allow.</p>



<h2 class="wp-block-heading">Challenging Times</h2>



<p>This sounds almost too good to be true, but it&#8217;s not without its challenges. While cooperative threads were rather easy to work with, preemptive threads require an extra layer of thought and awareness for Xojo users.</p>



<p>When a cooperative thread&#8217;s code is running, you know nothing else is, so you don&#8217;t have to worry about, say, updating a <code>Dictionary</code> or removing an element from an array. But with preemptive threads, code runs simultaneously with other code so you cannot just update that <code>Dictionary</code> if there is a chance that the main code, or another preemptive thread, might be doing it too.</p>



<p>Consider this example.</p>



<pre class="wp-block-code"><code>// In our thread
If MyArray.Count = 0 And FinishUp Then
  Exit
Else
  Process MyArray.Pop
End If

//////////////////////////////

// In the main code
FinishUp = True
MyArray.Add 1</code></pre>



<p>You might think the thread is going to process the last element and then exit its loop because <code>FinishUp</code> was set to <code>True</code>, but with preemptive threads we have to be aware of <a href="https://en.wikipedia.org/wiki/Race_condition">race conditions</a> where the order of actions is unpredictable. Here, the main code could set <code>FinishUp</code> to <code>True</code>, and the thread could see that <code>MyArray</code> was empty and exit before the main code could add the last element. Conditions can change at literally any instant, even in the middle of a single line of code.</p>



<p>Fortunately, there are ways to protect against this and you must use them to ensure orderly operation and avoid surprises.</p>



<h2 class="wp-block-heading">Know Your Type</h2>



<p>The first step is creating a preemptive thread, and Xojo&#8217;s implementation is pretty straightforward. Rather than introducing a unique class, you can continue to work with the existing <code>Thread</code> by setting its new <code>Type</code> property to <code>Thread.Types.Preemptive</code>. The <code>Type</code> can be set when instantiating the <code>Thread</code> or from within its running code. You can even switch types at will, although once running, the <code>Type</code> can only be changed from within the <code>Thread</code>.</p>



<p>Example:</p>



<pre class="wp-block-code"><code>// A subclass of Thread called PThread

MyThread = New PThread
PThread.Type = Thread.Types.Preemptive
PThread.Start</code></pre>



<p>Or within the <code>Run</code> event, you could do this:</p>



<pre class="wp-block-code xojo"><code>Me.Type = Thread.Types.Preemptive</code></pre>



<p>You can also set <code>Type</code> through the Inspector after dragging a <code>Thread</code> to a window.</p>



<h2 class="wp-block-heading">Protect Yourself</h2>



<p>Now that you have a preemptive thread ready to go, you have to think about how to protect common resources. Xojo has done a good job of making a lot of the framework safe, but that just means your app shouldn&#8217;t crash if, say, the <code>Thread</code> tries to manipulate a variable at the same time as other code. It&#8217;s up to you to make sure one area of your app doesn&#8217;t clobber the changes made by another.</p>



<p>Consider this code that maintains a <code>Dictionary</code> of Integer arrays.</p>



<pre class="wp-block-code"><code>// Thread code
Var arr() As Integer

If MyDictionary.HasKey(x) Then
  arr = MyDictionary.Value(x)
Else
  MyDictionary.Value(x) = arr
End If

arr.Add 1

//////////////////////////////

// Main code
If Not MyDictionary.HasKey(x) Then
  Var arr() As Integer
  MyDictionary.Value(x) = arr
End If</code></pre>



<p>Run this long enough and you&#8217;re going to wonder why some data got lost. Why? Because both the <code>Thread</code> and main code might be checking for the key at the exact same instant and filling it in when it&#8217;s not found. If the <code>Thread</code> does it first, the main code will almost instantly replace it with an empty array.</p>



<p>Instead, you should use a <code>Semaphore</code> or <code>CriticalSection</code> to make sure code is protected.</p>



<p>You&#8217;d first instantiate one of these in a common property like a <code>Window</code> or <code>Module</code>. (I&#8217;m using <code>Semaphore</code> here, but it works the same for <code>CriticalSection</code>.)</p>



<pre class="wp-block-code Xojo"><code>MySemaphore = New Semaphore
MySemaphore.Type = Thread.Types.Preemptive</code></pre>



<p>Notice the new <code>Type</code> property? It must match the one in <code>Thread</code> and can be used between the main code and a <code>Thread</code> or between same-typed threads. (This is one of the limitations of Xojo&#8217;s implementation: you cannot share a <code>Semaphore</code> or <code>CriticalSection</code> between preemptive and cooperative threads.)</p>



<p>The example can be updated like this:</p>



<pre class="wp-block-code"><code>// Thread code
Var arr() As Integer

MySemaphore.Signal

If MyDictionary.HasKey(x) Then
  arr = MyDictionary.Value(x)
Else
  MyDictionary.Value(x) = arr
End If

MySemaphore.Release

arr.Add 1

//////////////////////////////

// Main code
MySemaphore.Signal

If Not MyDictionary.HasKey(x) Then
  Var arr() As Integer
  MyDictionary.Value(x) = arr
End If

MySemaphore.Release</code></pre>



<p>This will force either the main code or <code>Thread</code> to wait for the other to complete before continuing, ensuring proper order and avoiding the race condition.</p>



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



<p>Using preemptive threads comes with certain restrictions. The biggest one is the aforementioned inability to share a <code>Semaphore</code> or <code>CriticalSection</code> with a cooperative thread. The other is the same as in a cooperative thread: you cannot update a user interface component directly instead relying on the <code>UserInterfaceUpdate</code> mechanism (more on that below).</p>



<p>If you are setting up multiple threads to work on different parts of some object, that may crash hard depending on the type of object. For example, writing to the same file or different parts of a <code>MemoryBlock</code> is fine, but updating a <code>Picture</code> may not be. In those cases, you will have to get creative.</p>



<h2 class="wp-block-heading">What&#8217;s It Good For?</h2>



<p>Choosing preemptive threads over cooperative means that you either have some code that needs to truly run in the background that would otherwise interfere with you user interface, or you have some large task that can be logically processed in parts.</p>



<h3 class="wp-block-heading">Window Service</h3>



<p>In the former case, the easiest technique might be to drag a <code>Thread</code> to your window, set its <code>Type</code>, and implement the <code>Run</code> event. It can be started from within the window either through a manual process like a pressing a button, or automatically when the window opens.</p>



<p>Just like with a cooperative thread, you can send data back to your window using the <code>AddUserInterfaceUpdate</code> method and implementing the <code>UserInterfaceUpdate</code> event.</p>



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



<p>If your task involves something that can be split up into logical chunks, I encourage you to look at my <code>ThreadPool</code> module, accessible through the Xojo Examples or <a href="https://github.com/ktekinay/Xojo-ThreadPool/tree/develop">my GitHub page</a>. (The latter has a README with more details.)</p>



<p>The ideal usage for <code>ThreadPool</code> is when you have some data that can be processed in sections. For example, suppose you wanted to count the vowels in a large file. You could subclass <code>ThreadPool</code> and implement its <code>Process</code> event to count one block. You would then send the file into your subclass in chunks of, say, 256k each and gather the results.</p>



<p>The benefit of <code>ThreadPool</code>, among other things, is that it will handle the coordination for you so the dangers of using preemptive threads are minimized. You still have to consider how to send your results back to your main code safely, perhaps using <code>Semaphore</code>/<code>CriticalSection</code> or the <code>AddUserInterfaceUpdate</code> method, but each block can be considered independently of the others.</p>



<p>(A big thanks to MVP Anthony Cyphers for writing the example included with Xojo.)</p>



<h2 class="wp-block-heading">Juggling Chainsaws</h2>



<p>The power of preemptive threads is clear, but the potential pitfalls can be serious. Unless you&#8217;re very careful, you can easily create bugs that may not be readily apparent, and may take hours or even days to track down. (I say this from unfortunate experience.) Unless you have a compelling reason to take on that challenge, don&#8217;t bother.</p>



<p>What I&#8217;m trying to say is, if a cooperate thread does the job adequately, there is no need to introduce the headache that preemptive threads can bring.</p>



<p>But if you do have a legitimate need, like a long-running process that needs to run quickly without blocking your UI, go for it, just be careful.</p>



<p>In any case, it&#8217;s great that we finally have that option.</p>



<p><em>Kem Tekinay is a Mac consultant and programmer who has been using Xojo since its first release to create custom solutions for clients. He is the author of the popular utilities <a href="http://www.mactechnologies.com/index.php?page=downloads#tftpclient" target="_blank" rel="noreferrer noopener">TFTP Client</a> and <a href="http://www.mactechnologies.com/index.php?page=downloads#regexrx" target="_blank" rel="noreferrer noopener">RegExRX</a> (both written with Xojo) and lives in Connecticut with his wife Lisa, and their cat.</em></p>



<p>Need More Information? Read more about <a href="https://documentation.xojo.com/api/language/thread.html#thread-type" target="_blank" rel="noreferrer noopener">preemptive threads</a> in the Xojo Documentation and <a href="https://blog.xojo.com/2024/10/01/cooperative-to-preemptive-weaving-new-threads-into-your-apps/" target="_blank" rel="noreferrer noopener">Blog</a>. Or read about <a href="https://blog.xojo.com/2024/09/05/using-semaphores-to-manage-resources/" target="_blank" rel="noreferrer noopener">Semaphore</a> and <a href="https://blog.xojo.com/2024/09/18/using-criticalsection-to-manage-resources/" target="_blank" rel="noreferrer noopener">CriticalSection</a>, also on the Xojo Blog.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Introducing Named Color and CSS Classes in Xojo Web</title>
		<link>https://blog.xojo.com/2024/10/01/introducing-named-color-and-css-classes-in-xojo-web/</link>
		
		<dc:creator><![CDATA[Ricardo Cruz]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:32:13 +0000</pubDate>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[Xojo IDE]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13668</guid>

					<description><![CDATA[The latest Xojo release is a big leap forward in terms of design options for Xojo Web users. Xojo 2024r3 comes with new tools for&#8230;]]></description>
										<content:encoded><![CDATA[
<p>The latest Xojo release is a big leap forward in terms of design options for Xojo Web users. Xojo 2024r3 comes with new tools for making beautiful web applications with less effort.</p>



<h2 class="wp-block-heading">A Quick Reminder About What Bootstrap Is</h2>



<p>As I will be mentioning it during this post, let me take a moment to remind readers what Bootstrap is, and what are we using it for at Xojo.</p>



<p>Bootstrap is the library we use for the visual part of web applications made with Xojo. You can think about it as Gtk on Linux, or UIKit on iOS.</p>



<p>While there is a vast amount of alternative libraries, it&#8217;s been probably the most popular framework for the last decade. You can check the <a href="https://getbootstrap.com" data-type="link" data-id="https://getbootstrap.com" target="_blank" rel="noreferrer noopener nofollow">Bootstrap website</a> for more information.</p>



<h2 class="wp-block-heading">ColorGroup Named Colors</h2>



<p>Until this release, the Named option when configuring a ColorGroup was not available on web projects. 2024r3 brings the ability to choose from the Web Basic colors, Web Extended colors and, what I find more interesting, Bootstrap colors, which also support dark mode out of the box.</p>



<figure class="wp-block-video"><video height="908" style="aspect-ratio: 1448 / 908;" width="1448" controls src="https://blog.xojo.com/wp-content/uploads/2024/09/named-colors-from-the-ide.mp4"></video></figure>



<p>As you can expect, if you drop a custom Bootstrap 5.3 theme with another set of colors, the IDE will automatically update in order to preview them.</p>



<figure class="wp-block-video"><video height="908" style="aspect-ratio: 1436 / 908;" width="1436" controls src="https://blog.xojo.com/wp-content/uploads/2024/09/named-colors-bootstrap-theme-support.mp4"></video></figure>



<h2 class="wp-block-heading">Using Named Colors by Code</h2>



<p>When a dynamic need arises, it is also possible to use Bootstrap Named colors programmatically, if you find it easier. Here is an example:</p>



<pre class="wp-block-code"><code>Var colorName As String

If paymentCardIsValid Then
  colorName = "success"
Else
  colorName = "danger"
End If

Rectangle1.BackgroundColor = ColorGroup.NamedColor(colorName)</code></pre>



<p>Or in a <code>WebCanvas.Paint</code> event:</p>



<pre class="wp-block-code"><code>Var colorName As String = If(paymentCardIsValid, "success", "danger")
g.DrawingColor = ColorGroup.NamedColor(colorName)
g.FillRectangle(0, 0, g.Width, g.Height)</code></pre>



<p>You can check the list of available colors in the <a href="https://getbootstrap.com/docs/5.3/customize/color/" data-type="link" data-id="https://getbootstrap.com/docs/5.3/customize/color/" target="_blank" rel="noreferrer noopener nofollow">Color section of the official Bootstrap documentation</a>. Basic and Extended Web Colors will work as well.</p>



<h2 class="wp-block-heading">Using Bootstrap CSS Classes</h2>



<p>Bootstrap comes with a set of utility CSS classes for a variety of visual things. You probably won&#8217;t need them all, as the Xojo IDE will get you there in most of the cases, and we work hard improving the IDE to make it easier, release by release.</p>



<p>That said, if you are an advanced user, and you have previous experience working with Bootstrap, you may find it useful to add CSS classes directly from the Inspector.</p>



<p>Go to the Advanced tab, add some Bootstrap CSS classes, separated by spaces&#8230; and voilà!</p>



<p>Here is a demo:</p>



<figure class="wp-block-video"><video height="910" style="aspect-ratio: 1652 / 910;" width="1652" controls src="https://blog.xojo.com/wp-content/uploads/2024/09/css-classes-demo.mp4"></video></figure>



<p>We have included a new example, called &#8220;Applying Bootstrap CSS classes to controls&#8221;, that you can find under Platforms &gt; Web. Please give it a try.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="807" src="https://blog.xojo.com/wp-content/uploads/2024/09/Captura-de-pantalla-2024-09-18-a-las-10.56.29-1024x807.png" alt="" class="wp-image-13672" srcset="https://blog.xojo.com/wp-content/uploads/2024/09/Captura-de-pantalla-2024-09-18-a-las-10.56.29-1024x807.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/09/Captura-de-pantalla-2024-09-18-a-las-10.56.29-300x236.png 300w, https://blog.xojo.com/wp-content/uploads/2024/09/Captura-de-pantalla-2024-09-18-a-las-10.56.29-768x605.png 768w, https://blog.xojo.com/wp-content/uploads/2024/09/Captura-de-pantalla-2024-09-18-a-las-10.56.29.png 1267w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>CSS Classes are not limited to Bootstrap, if you have added styles in the HTML Header section, you can use them as well.</p>



<p>You can also add and remove them using the new <code>CSSClasses</code> property, which is available in every WebUIControl subclass.</p>



<h2 class="wp-block-heading">WebRectangle Got Some Love</h2>



<p>You won&#8217;t need to setup the border color, border thickness or the corner size, for WebRectangle, in the Opening event anymore.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="702" height="853" src="https://blog.xojo.com/wp-content/uploads/2024/09/Captura-de-pantalla-2024-09-18-a-las-11.02.31.png" alt="" class="wp-image-13673" srcset="https://blog.xojo.com/wp-content/uploads/2024/09/Captura-de-pantalla-2024-09-18-a-las-11.02.31.png 702w, https://blog.xojo.com/wp-content/uploads/2024/09/Captura-de-pantalla-2024-09-18-a-las-11.02.31-247x300.png 247w" sizes="(max-width: 702px) 100vw, 702px" /><figcaption class="wp-element-caption">Xojo 2024r2.1 on the left, Xojo 2024r3 on the right</figcaption></figure>
</div>


<p>When designing web applications, I found myself using a lot of WebRectangle controls and, by default, they have a rounded border.</p>



<p>The side-effect is subtle, but now that you can control the border radius directly from the Inspector, the IDE preview will be closer to how it will look in the browser. And you are going to avoid writing a few lines of code!</p>



<p>In addition, some Bootstrap themes define a different Corner Size. Setting this property to &#8220;-1&#8221; will honor that Bootstrap theme&#8217;s default border radius.</p>



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



<p>As always, the release comes with much more than I can tell you about in one blog post. With over 30 Bug fixes and 9 Feature Requests implemented in the Web target alone, make sure to take a look at the <a href="https://documentation.xojo.com/resources/release_notes/2024r3.html" data-type="link" data-id="https://documentation.xojo.com/resources/release_notes/2024r3.html" target="_blank" rel="noreferrer noopener">Xojo 2024r3 Release Notes</a> to see the whole picture.</p>



<p>Happy coding!</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/2024/09/named-colors-from-the-ide.mp4" length="837283" type="video/mp4" />
<enclosure url="https://blog.xojo.com/wp-content/uploads/2024/09/named-colors-bootstrap-theme-support.mp4" length="429757" type="video/mp4" />
<enclosure url="https://blog.xojo.com/wp-content/uploads/2024/09/css-classes-demo.mp4" length="721074" type="video/mp4" />

			</item>
		<item>
		<title>Cooperative to Preemptive: Weaving New Threads into your Apps</title>
		<link>https://blog.xojo.com/2024/10/01/cooperative-to-preemptive-weaving-new-threads-into-your-apps/</link>
		
		<dc:creator><![CDATA[William Yu]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:31:59 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Concurrency Management]]></category>
		<category><![CDATA[Multithreaded Applications]]></category>
		<category><![CDATA[Preemptive Threads]]></category>
		<category><![CDATA[Threading]]></category>
		<category><![CDATA[Threads]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13606</guid>

					<description><![CDATA[Our latest Xojo update introduces a new thread type that maximizes the potential of your multi-core systems. This new preemptive thread model enhances efficiency and&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Our latest Xojo update introduces a new thread type that maximizes the potential of your multi-core systems. This new preemptive thread model enhances efficiency and responsiveness, allowing for improved multitasking and resource management while delivering significant performance gains. In this post, we’ll explore the benefits of this upgrade, delve into the implementation details, and guide you on how to fully utilize the new preemptive threading capabilities.</p>



<h2 class="wp-block-heading">Threading Models</h2>



<p><strong>Cooperative Threads</strong>: This is the threading model that Xojo has traditionally supported and continues to offer. In this model, threads must voluntarily yield control at specific points that we define. This ensures that most operations in Xojo code are thread-safe, as we manage access to MemoryBlocks, Arrays, etc. However, this approach can lead to inefficiencies if a thread fails to yield, potentially blocking UI, and because only one thread runs at a time, it doesn&#8217;t fully utilize multiple cores or truly run in parallel.</p>



<p><strong>Preemptive Threads</strong>: Introduced in Xojo 2024r3, this new thread type allows threads to be interrupted at any point, enhancing responsiveness and fully utilizing multiple cores. While this model provides significant performance improvements, it also introduces new challenges. Because threads can be interrupted at any time, you&#8217;ll need to be more diligent about locking resources, such as MemoryBlocks and Arrays, to avoid potential race conditions.</p>



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



<p>We&#8217;ve added a new <a href="https://documentation.xojo.com/api/language/thread.html#thread-type" target="_blank" rel="noreferrer noopener">Thread.Type</a> property that allows you to switch your threads to the new preemptive thread model, here&#8217;s how you can start one up:</p>



<pre class="wp-block-code xojo"><code>Thread1.Type = Threads.Types.Preemptive
Thread1.Start</code></pre>



<p>You can set this property either before starting your thread or while the thread is running. However, if changing it while the thread is active, it must be done safely from within the running thread itself, and not externally.</p>



<pre class="wp-block-code"><code>Event Window1.Opening
  // Start the thread and setup the type in the Run event instead
  Thread1.Start
End Event

Sub Thread1.Run
  Me.Type = Threads.Types.Preemptive
  // Run a very long process preemptively.
  newMemBlock = memBlock.Compress
  
  Me.Type = Threads.Types.Cooperative
  // Switching to cooperative mode and modifying a shared array safely.
  mySharedArray.Add("New item")
End Sub</code></pre>



<h2 class="wp-block-heading">Concurrency and Synchronization</h2>



<p>As mentioned earlier, cooperative threads avoid many of the issues that arise with preemptive threads, since we control when thread switching occurs. With preemptive threads, however, you can no longer safely modify things, like shared arrays, the same way you could before with cooperative threads. To manage this, you&#8217;ll need to use tools like <code>CriticalSections</code> and <code>Semaphores</code> more frequently to protect your shared resources.</p>



<p>The challenge lies in efficiently supporting both threading models while enabling the main thread to synchronize with either type. To address this, we’ve added a new Type property to <code>CriticalSection</code> and <code>Semaphores</code>, which must match the thread type you’re using to protect shared resources.</p>



<pre class="wp-block-code"><code>// Imagine the main thread and two additional threads all trying to access a Dictionary simultaneously.
Sub RunTest
  Thread1.Type = Thread.Types.Preemptive
  Thread2.Type = Thread.Types.Preemptive

  CSLock = New CriticalSection
  // Since we are using this CriticalSection in preemptive threads,
  // the synchronization type must be compatible.
  CSLock.Type = Thread1.Type

  Thread1.Start
  Thread2.Start

  Do
    CSLock.Enter
    MyDictionary.RemoveAll
    CSLock.Leave
  Loop
End Sub

Sub Thread1.Run
  Do
    CSLock.Enter
    MyDictionary.Value("Random1") = Rnd
    CSLock.Leave
  Loop
End Sub

Sub Thread2.Run
  Do
    CSLock.Enter
    MyDictionary.Value("Random2") = Rnd
    CSLock.Leave
  Loop
End Sub</code></pre>



<h2 class="wp-block-heading">What things are thread-safe?</h2>



<p>We’ve updated our framework to safeguard areas that were previously not preemptive thread-safe. For the most part, our entire framework is now safe for concurrent use with preemptive threads, with a few exceptions like XojoScript and Runtime.IterateObjects. When sharing resources such as MemoryBlocks, Dictionaries, or Arrays among threads, you may need to use <code>CriticalSections</code> or <code>Semaphores</code> to ensure safe access. However, if you&#8217;re only reading from these resources without modifying them, synchronization is not required. You&#8217;ll be happy to know that calling <code>Thread.AddUserInterfaceUpdate</code> from a preemptive thread is also safe.</p>



<h2 class="wp-block-heading">Performance Considerations</h2>



<p>With the ability to switch your threads to preemptive, there are some performance factors to consider. While running 100 threads at once might seem appealing, it often leads to over-utilizing your system’s resources. For optimal efficiency, it’s best to limit the number of threads to match the number of available cores. To assist with this, we’ve introduced the new <a href="https://documentation.xojo.com/api/os/system.html#system-corecount" target="_blank" rel="noreferrer noopener">System.CoreCount</a>, which helps you determine the number of cores on your system.</p>



<p>While Xojo&#8217;s framework doesn’t shield you from every potential issue, we do handle synchronization for key operations like object creation and destruction. However, you may notice these actions are slower in preemptive threads due to the extra synchronization required.</p>



<h2 class="wp-block-heading">Usage and Examples</h2>



<p>There’s no question that preemptive threads offer significant advantages, and when used correctly, they can greatly enhance your app&#8217;s performance. Check out our threading example projects included with the 2024r3 release to see preemptive threads in action and enjoy weaving these new threads into your future apps!</p>



<p><em>A special thanks to our MVPs for their invaluable help in refining and testing this new feature! Be sure to check out the new ThreadPool example for some practical, real-world use cases and read MVP Kem Tekinay&#8217;s blog post <a href="https://blog.xojo.com/2024/10/01/preemptive-threads-are-here-and-they-are-pretty-good/" target="_blank" rel="noreferrer noopener">Preemptive Threads Are Here and They Are &#8230;. Pretty Good</a>.</em></p>



<p>Need More Information? Read more about <a href="https://documentation.xojo.com/api/language/thread.html#thread-type" target="_blank" rel="noreferrer noopener">preemptive threads</a> in the Xojo Documentation and <a href="https://blog.xojo.com/tag/preemptive-threads/" target="_blank" rel="noreferrer noopener">Blog</a>. Or read about <a href="https://blog.xojo.com/2024/09/05/using-semaphores-to-manage-resources/" target="_blank" rel="noreferrer noopener">Semaphore</a> and <a href="https://blog.xojo.com/2024/09/18/using-criticalsection-to-manage-resources/" target="_blank" rel="noreferrer noopener">CriticalSection</a>.</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>Android Tablet Support</title>
		<link>https://blog.xojo.com/2024/10/01/android-tablet-support/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:31:26 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Cats]]></category>
		<category><![CDATA[Layout Editor]]></category>
		<category><![CDATA[Tablet]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13552</guid>

					<description><![CDATA[Android apps made with Xojo have always worked on tablets, but until Xojo 2024r3 there has been no easy way to design your screens for&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Android apps made with Xojo have always worked on tablets, but until Xojo 2024r3 there has been no easy way to design your screens for tablets. Below are the new features that should make it easier to create Android tablet apps.</p>



<h2 class="wp-block-heading">Layout Editor</h2>



<p>The Layout Editor has been enhanced with two settings that can adjust the layout.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="288" height="62" src="https://blog.xojo.com/wp-content/uploads/2024/08/image-4.png" alt="" class="wp-image-13553"/></figure>



<p>The command bar has two toggle buttons. The first one already existed and it is for displaying the layout in portrait (the default) or landscape.</p>



<p>The new toggle button displays the layout in a phone size (the default) or a tablet size. When you switch between any of these toggles, the locking is applied to the controls on the layout.</p>



<p>The layout editor also remembers the selections so that the next time you visit the layout, it will be where you left it. Here you can see a landscape tablet layout:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="793" src="https://blog.xojo.com/wp-content/uploads/2024/08/image-5-1024x793.png" alt="" class="wp-image-13554" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/image-5-1024x793.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/08/image-5-300x232.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/image-5-768x595.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/image-5-1536x1189.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/08/image-5-2048x1585.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Default Screen</h2>



<p>The App Inspector has an additional Default Tablet Screen property. When your app is launched on a phone or tablet-sized device, the specified screen is what gets displayed.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="634" height="218" src="https://blog.xojo.com/wp-content/uploads/2024/08/image-6.png" alt="" class="wp-image-13555" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/image-6.png 634w, https://blog.xojo.com/wp-content/uploads/2024/08/image-6-300x103.png 300w" sizes="auto, (max-width: 634px) 100vw, 634px" /></figure>



<p>You can also choose &#8220;None&#8221; for a default screen if you just want to share a single screen across both types of devices.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>If you choose &#8220;None&#8221; for the Default Phone Screen, then the app won&#8217;t launch on a phone. If you choose &#8220;None&#8221; for a Default Tablet Screen, the app will launch on the tablet using the Default Phone Screen, which matches prior behavior.</p>
</blockquote>



<h2 class="wp-block-heading">Design Considerations</h2>



<p>Xojo for Android uses locking to automatically adjust controls on the layout. Locking will work for certain types of layouts that you want to run on both phones and tablets, but may not be sufficient for more complex layouts. In these situations, you are better served by designing completely separate layouts for phone and tablet and then using the above Default Screen properties to show the correct one.</p>



<p>When you need to show additional screens, you can show the phone or tablet screen in code by checking the device using DeviceData.Orientation and DeviceData.UserInterfaceType.</p>



<pre class="wp-block-code"><code>If System.Device.UserInterfaceType = SystemDeviceData.UserInterfaceTypes.Tablet Then
  // Show tablet screen
  myTabletScreen.Show
Else
  // Show phone screen
  myPhoneScreen.Show
End If</code></pre>



<p>When you have multiple screens, it often makes sense to put the UI in containers and then use the containers on the different screens.</p>



<p>You can run your apps on a Tablet emulator for testing (you can create one using Android Studio) or you can debug directly on device. I enabled on-device debugging for a Lenovo Tab M10 Plus 3rd Gen with these steps:</p>



<ul class="wp-block-list">
<li>Go to Settings.</li>



<li>Select About tablet.</li>



<li>Tap 7 times in a row on the build number. This enabled Developer options. You may be prompted to enter your PIN.</li>



<li>Select System and then Developer Options.</li>



<li>Turn on USB debugging and give it permission.</li>
</ul>



<p>The tablet will now appear as a debug device in Xojo, allowing you to run your Android projects on it.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="3552" height="2893" src="https://blog.xojo.com/wp-content/uploads/2024/09/D0D09B0C-7135-4067-A893-29D1420CAA14.png" alt="" class="wp-image-13724" srcset="https://blog.xojo.com/wp-content/uploads/2024/09/D0D09B0C-7135-4067-A893-29D1420CAA14.png 3552w, https://blog.xojo.com/wp-content/uploads/2024/09/D0D09B0C-7135-4067-A893-29D1420CAA14-300x244.png 300w, https://blog.xojo.com/wp-content/uploads/2024/09/D0D09B0C-7135-4067-A893-29D1420CAA14-1024x834.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/09/D0D09B0C-7135-4067-A893-29D1420CAA14-768x626.png 768w, https://blog.xojo.com/wp-content/uploads/2024/09/D0D09B0C-7135-4067-A893-29D1420CAA14-1536x1251.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/09/D0D09B0C-7135-4067-A893-29D1420CAA14-2048x1668.png 2048w" sizes="auto, (max-width: 3552px) 100vw, 3552px" /></figure>



<h2 class="wp-block-heading">What about Chromebook?</h2>



<p><a href="https://www.chromium.org/chromium-os/chrome-os-systems-supporting-android-apps/" target="_blank" rel="noreferrer noopener">Some Chromebooks</a> are <a href="https://support.google.com/chromebook/answer/7021273" target="_blank" rel="noreferrer noopener">able to run Android apps</a> and <a href="https://www.chromium.org/chromium-os/chrome-os-systems-supporting-android-apps/" target="_blank" rel="noreferrer noopener">those that can</a> are also able to run Xojo&#8217;s Android apps. Android apps can be installed via the Play Store (give <a href="https://play.google.com/store/apps/details?id=com.xojo.catsup&amp;hl=en_US&amp;pli=1" target="_blank" rel="noreferrer noopener">CatsUp a try</a>) or manually, although doing it manually is rather difficult (I have not yet gotten that working on my Chromebook). The Play Store options works well, however. Here&#8217;s CatsUp from the Play Store running on my Lenovo 300e Chromebook:</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="768" src="https://blog.xojo.com/wp-content/uploads/2024/08/F98FE354-8315-4BCA-B204-C9D24EE0B86B_1_102_o-1024x768.jpeg" alt="" class="wp-image-13576" style="width:913px;height:auto" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/F98FE354-8315-4BCA-B204-C9D24EE0B86B_1_102_o-1024x768.jpeg 1024w, https://blog.xojo.com/wp-content/uploads/2024/08/F98FE354-8315-4BCA-B204-C9D24EE0B86B_1_102_o-300x225.jpeg 300w, https://blog.xojo.com/wp-content/uploads/2024/08/F98FE354-8315-4BCA-B204-C9D24EE0B86B_1_102_o-768x576.jpeg 768w, https://blog.xojo.com/wp-content/uploads/2024/08/F98FE354-8315-4BCA-B204-C9D24EE0B86B_1_102_o-1536x1152.jpeg 1536w, https://blog.xojo.com/wp-content/uploads/2024/08/F98FE354-8315-4BCA-B204-C9D24EE0B86B_1_102_o.jpeg 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>When run on the Chromebook, Android apps can have a size of Phone, Tablet or Resizable. You can see that as an option in the title bar of the above screenshot. For best results you probably want to design your apps for a landscape tablet.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Xojo for Android does not have direct support for Chromebook features at this time, but if there is something you&#8217;d like to see, be sure to create an Issue so that we can look into it.</p>
</blockquote>



<p>Since Chromebooks are just (low-end) Linux machines at their core, they can technically run Xojo Linux apps (x86 or ARM depending on the Chromebook), but this usually requires some sort of <a href="https://support.google.com/chromebook/answer/9145439" target="_blank" rel="noreferrer noopener">additional Linux installation</a>.</p>



<p>And of course, Chromebooks are typically meant to run web apps, which Xojo can also do quite well.</p>



<h2 class="wp-block-heading">Eddie&#8217;s Electronics Example Project</h2>



<p>The Android Eddie&#8217;s Electronics example project has been updated to run on both phones and tablets. It makes use of Containers to contain the UI and displays them using screens for the appropriate device type.</p>



<p>Here you can see the Customer screen for a tablet displays the list of customers on the left, with details and invoices on the right.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="676" src="https://blog.xojo.com/wp-content/uploads/2024/08/image-7-1024x676.png" alt="" class="wp-image-13557" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/image-7-1024x676.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/08/image-7-300x198.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/image-7-768x507.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/image-7-1536x1014.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/08/image-7.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Compare that to the phone version which has you navigate between that information using separate screens.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="483" height="1024" src="https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncsc-483x1024.png" alt="" class="wp-image-13564" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncsc-483x1024.png 483w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncsc-142x300.png 142w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncsc-768x1628.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncsc-725x1536.png 725w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncsc.png 850w" sizes="auto, (max-width: 483px) 100vw, 483px" /></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="485" height="1024" src="https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncyb-485x1024.png" alt="" class="wp-image-13565" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncyb-485x1024.png 485w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncyb-142x300.png 142w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncyb-768x1620.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncyb-728x1536.png 728w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-ncyb.png 856w" sizes="auto, (max-width: 485px) 100vw, 485px" /></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="482" height="1024" src="https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-nddd-482x1024.png" alt="" class="wp-image-13566" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-nddd-482x1024.png 482w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-nddd-141x300.png 141w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-nddd-768x1632.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-nddd-723x1536.png 723w, https://blog.xojo.com/wp-content/uploads/2024/08/SCR-20240829-nddd.png 852w" sizes="auto, (max-width: 482px) 100vw, 482px" /></figure>
</div>
</div>



<p>Tablet supports opens up a whole other category of users for your Android apps and should be particularly useful to those making bespoke apps for clients.</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>Fuzzy Searches with SQLite&#8217;s SOUNDEX</title>
		<link>https://blog.xojo.com/2024/10/01/fuzzy-searches-with-sqlites-soundex/</link>
		
		<dc:creator><![CDATA[William Yu]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:31:15 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[Fuzzy searches]]></category>
		<category><![CDATA[SoundEx]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[SQLiteDatabase]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13654</guid>

					<description><![CDATA[Though a minor update, Xojo now offers access to another core SQLite function: SOUNDEX. What is SOUNDEX? SOUNDEX is a core function in SQLite that&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Though a minor update, Xojo now offers access to another core SQLite function: SOUNDEX.</p>



<h2 class="wp-block-heading">What is SOUNDEX?</h2>



<p>SOUNDEX is a core function in SQLite that encodes a string into a 4-byte sequence, enabling indexing based on pronunciation. While the technical details of the algorithm are available on <a href="https://en.wikipedia.org/wiki/Soundex" target="_blank" rel="noreferrer noopener">Wikipedia</a>, the gist is that SOUNDEX(&#8220;Smith&#8221;) will match SOUNDEX(&#8220;Smythe&#8221;), making it useful for large searches to identify different spellings of the same term.</p>



<h2 class="wp-block-heading">How is it used?</h2>



<p>For the curious, you can see how words are indexed by simply invoking a select on a SOUNDEX term:</p>



<pre class="wp-block-code"><code>Var db As New SQLiteDatabase
db.Connect

Var rs As RowSet
rs = db.SelectSQL("SELECT SOUNDEX('Smith')")
Var smith As String = rs.ColumnAt(0).StringValue
rs = db.SelectSQL("SELECT SOUNDEX('Smythe')")
Var smythe As String = rs.ColumnAt(0).StringValue</code></pre>



<p>Running this you&#8217;ll notice that &#8216;Smith&#8217; and &#8216;Smythe&#8217; both return the same SOUNDEX 4-byte sequence of &#8220;S530&#8221; &#8212; Here&#8217;s a quick breakdown of how this was generated:</p>



<ol class="wp-block-list">
<li><strong>First Letter (S)</strong>: The first letter of the name stays the same, so &#8220;S&#8221; from the name &#8220;Smith&#8221; or &#8220;Smythe&#8221; becomes the first character in the code.</li>



<li><strong>Numbers (530)</strong>: The remaining characters in the code represent the sounds of the next letters in the name. Each number is based on a group of similar-sounding consonants:
<ul class="wp-block-list">
<li><strong>5</strong>&nbsp;= &#8220;M&#8221; (because M sounds like &#8220;M&#8221; in &#8220;Smith&#8221; or &#8220;Smythe&#8221;)</li>



<li><strong>3</strong>&nbsp;= &#8220;T&#8221; (because T sounds like &#8220;T&#8221; in &#8220;Smith&#8221; or &#8220;Smythe&#8221;)</li>



<li><strong>0</strong>&nbsp;= No sound match or a vowel, so it acts as a filler to complete the 4-character code.</li>
</ul>
</li>
</ol>



<h2 class="wp-block-heading">Practical Use Case</h2>



<p>With a better understanding of the algorithm, we can put it to practical use by searching our database for names that sound similar to &#8220;Smith.&#8221;</p>



<pre class="wp-block-code"><code>db.ExecuteSQL("CREATE TABLE contacts(id INTEGER PRIMARY KEY, name TEXT)")
db.ExecuteSQL("INSERT INTO contacts (name) VALUES ('Smith'), ('Smythe'), ('Simith'), ('John')")

rs = db.SelectSQL("SELECT name FROM contacts WHERE SOUNDEX(name) = SOUNDEX('Smith')")

// Expected to find 3 names: Smith, Smythe, and Simith
Var namesFound As Integer = rs.RowCount</code></pre>



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



<p>Because the SOUNDEX algorithm is designed around English pronunciation patterns, it may not work as well for languages with different sound structures or alphabets, so results may vary depending on the language. It&#8217;s also worth noting that this feature is available for all targets, except Android at this time.</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>Photos, Metadata and Location on iOS Pictures</title>
		<link>https://blog.xojo.com/2024/10/01/photos-metadata-and-location-on-ios-pictures/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:31:02 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Metadata]]></category>
		<category><![CDATA[MobileLocation]]></category>
		<category><![CDATA[MobileMapViewer]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13647</guid>

					<description><![CDATA[Starting with Xojo 2024r3, it is now possible to get image metadata, assign location data (Location Tracking), and to save images directly to a device&#8217;s&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Starting with Xojo 2024r3, it is now possible to get image metadata, assign location data (Location Tracking), and to save images directly to a device&#8217;s photo album in your Xojo iOS apps.</p>



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



<h2 class="wp-block-heading">Getting the Image Metadata</h2>



<p>In order to get the metadata from a given image, first retrieve a valid instance from the Picture Class using MobileImagePicker, select Photos or Camera as the image source.</p>



<p>Once we get the Picture instance, for example as the received parameter in the Selected event from the ImagePicker instance, we only need to access its Metadata property. The property will return a Dictionary instance, so we can iterate its entries or convert it to a JSONItem instance for simplicity if all you want to do is store the information. For example, we can use the following fragment of code in the Selected event of the ImagePicker instance:</p>



<pre class="wp-block-code"><code>Var js As JSONItem
Try
  js = New JSONItem(pic.Metadata)
  MessageBox(js.ToString)
Catch e As JSONException

End Try
</code></pre>



<p>Assuming that &#8220;pic&#8221; is the name of the received parameter that points to the user selected (or captured) image, the previous fragment of code will show a dialog with the image metadata.</p>



<h2 class="wp-block-heading">Getting the Image Location…&nbsp;and Putting it On the Map!</h2>



<p>An interesting action could be reading the location data of the selected image and adding an entry on a MobileMapViewer instance. So, for example, again in the Selected event of an ImagePicker instance, we could add the following snippet of code:</p>



<pre class="wp-block-code"><code>If pic &lt;&gt; Nil Then
  ImageViewer.Image = pic
  
  // The metadata is retrieved as a Dictionary, so let's get the
  // metadata from the selected picture
  metadata  = pic.Metadata
  
  If metadata &lt;&gt; Nil Then
    Var jlocation As Dictionary = metadata.Lookup("Location", Nil)
    
    // Getting the Location information (also as Dictionary)
    If jlocation &lt;&gt; Nil Then
      
      // And assigning the Latitude and Longitude
      // values to the properties
      latitude  = jlocation.Value("Latitude").DoubleValue
      longitude = jlocation.Value("Longitude").DoubleValue
      
      // Then, we will show the Picture location on the Map
      Timer.CallLater(100, AddressOf Showlocation)
    End If
    
  End If
  
End If</code></pre>



<p>Latitude and Longitude are Double type properties that have been added to the Screen containing the ImagePicker instance, also added is an ImageViewer instance responsible for displaying the selected image preview, and a MapViewer instance on which the &#8220;pin&#8221; corresponding to the location of the image will be added.</p>



<p>As you can see, the shared method CallLater of the Timer class is used to invoke the ShowLocation method. This method will be responsible for displaying the actual pin on the map:</p>



<pre class="wp-block-code"><code>Private Sub Showlocation()
  // Let's create a new Location instance from the stored
  // latitude and longitude values in order to add it
  // to the Mapviewer…
  
  Var maplocation As New MapLocation(latitude, longitude)
  MapViewer1.AddLocation(maplocation)
  
  // …and let's make sure the metadata is updated
  // to the viewed image
  ImageViewer.Image.Metadata = metadata
End Sub</code></pre>



<p>The following screenshot shows the outcome of executing the previous code:</p>


<div class="wp-block-image">
<figure class="aligncenter"><img loading="lazy" decoding="async" width="828" height="1792" src="https://blog.xojo.com/wp-content/uploads/2024/09/PicturePicker.jpg" alt="" class="wp-image-13648" srcset="https://blog.xojo.com/wp-content/uploads/2024/09/PicturePicker.jpg 828w, https://blog.xojo.com/wp-content/uploads/2024/09/PicturePicker-139x300.jpg 139w, https://blog.xojo.com/wp-content/uploads/2024/09/PicturePicker-473x1024.jpg 473w, https://blog.xojo.com/wp-content/uploads/2024/09/PicturePicker-768x1662.jpg 768w, https://blog.xojo.com/wp-content/uploads/2024/09/PicturePicker-710x1536.jpg 710w" sizes="auto, (max-width: 828px) 100vw, 828px" /></figure>
</div>


<p>Of course, you&#8217;ll need to enable the Maps entitlement in the Build Settings &gt; iOS &gt; Capabilities inspector.</p>



<h2 class="wp-block-heading">Setting the Location in a Picture</h2>



<p>Just as we can get the location out of an image, we can also modify it… or set a location to those photographs that we get through the ImagePicker using the Camera source. Assigning a location is very simple:</p>



<ul class="wp-block-list">
<li>Add an instance of MobileLocation to the project (for example the screen where we manage image capture).</li>



<li>Add the Latitude and Longitude properties of type Double as two new properties on the same screen.</li>



<li>In the LocationChanged event of the MobilLocation instance assign the values received in the Latitude and Longitude parameters to the properties created previously:</li>
</ul>



<pre class="wp-block-code xojo"><code>Self.Latitude = Latitude
Self.Longitude = Longitude</code></pre>



<ul class="wp-block-list">
<li>Then, in the Selected event of the ImagePicker instance, use the following snippet of code:</li>
</ul>



<pre class="wp-block-code"><code>Var d As New Dictionary
d.Value("Latitude") = Self.Latitude
d.Value("Longitude") = Self.Longitude

Var Location As New Dictionary
Location.Value("Location") = d

pic.Metadata = Location</code></pre>



<h2 class="wp-block-heading">Saving Pictures to Photos</h2>



<p>Until now, MobileSharingPanel was probably the go-to option when it came to saving any of the images generated in your iOS Xojo app or images captured with the camera using the ImagePicker. Starting with Xojo 2024r3, you can also use the SaveToPhotos method of the Picture class, which will take care of saving the image while preserving the associated metadata.</p>



<p>So, for example, you will only have to add the following line of code at the end of the previous block so that the captured image is saved with the location:</p>



<pre class="wp-block-code xojo"><code>pic.SaveToPhotos(Picture.Formats.PNG)</code></pre>



<p>However, when using this method on images in your iOS app, make sure to enable the Photos Access capability in the Build Settings &gt; iOS &gt; Capabilities Inspector Panel.</p>



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



<p>As you have seen, it&#8217;s now really easy to get metadata from Picture instances in your Xojo iOS apps, as well as leverage Location information and assign location information to any of existing or new images. Plus, you no longer need to resort to <a href="https://documentation.xojo.com/api/user_interface/mobile/mobilesharingpanel.html#mobilesharingpanel">MobileSharingPanel</a> if all you want is your iOS app to save images to the Photos app album on the iOS device.</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>Android Declare and Library Enhancements</title>
		<link>https://blog.xojo.com/2024/10/01/android-declare-and-library-enhancements/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:30:45 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Declares]]></category>
		<category><![CDATA[Kotlin]]></category>
		<category><![CDATA[Libraries]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13442</guid>

					<description><![CDATA[There have been several enhancements to Declare and Kotlin Library support in Xojo 2024 Release 3 which, along with previous improvements, should allow you to&#8230;]]></description>
										<content:encoded><![CDATA[
<p>There have been several enhancements to Declare and Kotlin Library support in Xojo 2024 Release 3 which, along with previous improvements, should allow you to interface your Android projects with more from the native ecosystem.</p>



<p>This post describes the things you can do with Declares and Libraries with Android projects.</p>



<h2 class="wp-block-heading">Declare Integer Types</h2>



<p>The size-specific Integer types are now precise when used with Declares. The mappings are as follows:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>Xojo Type</strong></td><td><strong>Kotlin Type</strong></td></tr><tr><td>Int8, Byte</td><td>Byte</td></tr><tr><td>UInt8</td><td>UByte</td></tr><tr><td>Int16</td><td>Short</td></tr><tr><td>UInt16</td><td>UShort</td></tr><tr><td>Int32</td><td>Int</td></tr><tr><td>UInt32</td><td>UInt</td></tr><tr><td>Integer, Int64</td><td>Long</td></tr><tr><td>UInteger, UInt64</td><td>ULong</td></tr></tbody></table></figure>



<p>When mapping to Android API functions or Library functions, be sure to use the correct Xojo type that matches what is expected on Android. By far you will use Int32 and Integer.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>If you previously created Declares, you will likely need to change usage of Integer to Int32 as the mapping for that have changed compared to prior versions.</p>
</blockquote>



<h2 class="wp-block-heading">Nullable Types</h2>



<p>Xojo object variables (also properties, parameters and return values) can be Nil. With Kotlin, the default is that these things cannot be null (the equivalent of Nil). To ensure that you don’t get compile errors with your parameters, declare them as nullable in Kotlin by appending the “?” to the end of the type name.</p>



<h2 class="wp-block-heading">Application Context</h2>



<p>Many Android APIs require the application context. This is not available in a Library so it has to be supplied by the app itself. There is a property for this:</p>



<pre class="wp-block-code"><code>MobileApplication.AndroidContextHandle As Ptr</code></pre>



<p>You can pass this value to a function on the Library that then either saves it or uses it directly.</p>



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



<p>Xojo uses the Ptr type to interface with Declares, however Kotlin does not have a Ptr type. Instead the Any type is used with Kotlin. This means that if you are passing something that is a Ptr to Kotlin (such as the app context above), your library function declaration should use “Any?” as the type of the parameter.</p>



<p>In your function, cast the parameter to the actual type you want. The same rule applies to return values. If the return value in the Declare is a Ptr, then in Kotlin the function declaration should be “Any?”.</p>



<p>You can also use Ptr with API calls to save object references as described below.</p>



<h2 class="wp-block-heading">Library Permissions</h2>



<p>Depending on the API you are using, you may need to add permissions to the app manifest.xml for the Library. These permissions also need to be applied to the main app. This can be done using the Advanced tab of the Android Build Settings. There you’ll find the Permissions property in the Inspector where you can add one Permission per line.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Previous versions let you separate permissions by spaces or commas. Going forward, each permission must be on its own line. Empty lines are ignored.</p>
</blockquote>



<p>There you can add the permission constants that are required by your Library. In addition, you can follow the constant with additional attributes and they will also be applied to the app’s manifest file.</p>



<p>For example, to include the android:maxSdkVersion attribute with the BLUETOOTH permission:</p>



<pre class="wp-block-code"><code>android.permission.BLUETOOTH android:maxSdkVersion="30"</code></pre>



<h2 class="wp-block-heading">Library Dependencies</h2>



<p>Similarly to permissions, your Library may make use of additional dependencies, which could even be other Libraries. These are added to the build.gradle file for the Library, but also need to be included in the main app.</p>



<p>You can add these dependencies using the Dependencies property on the Advanced Android Build Settings.</p>



<h2 class="wp-block-heading">Creating Objects</h2>



<p>Previous versions of Xojo only let you call Companion (essentially shared) methods on Library classes. Now you can also work with class instances and call instance methods. This gives you even better control and ability to interface with Android APIs.</p>



<p>To create an object, your Library class should have a factory method on the Companion that returns a new instance. It is clearest to use create() as this method name.</p>



<p>In Xojo you create a Declare to this create() method and call it, saving the result in a Ptr.</p>



<pre class="wp-block-code"><code>Declare Function create Lib "com.example.utility.counter" () As Ptr<br>Var counter As Ptr = create</code></pre>



<p>Instead of using a shared factory method, you can also call the Class constructor using this syntax:</p>



<pre class="wp-block-code"><code>Declare Function counter Lib "com.example.utility.counter" () As Ptr</code></pre>



<p>Because the function name has the same name as the class itself, this will call the constructor of the class.</p>



<p>When you want to call a method on the instance, you pass the instance as a Ptr. First, Declare to the method adding “.instance” to the library location to indicate you are calling a class instance.</p>



<pre class="wp-block-code"><code>Declare Function increment Lib "com.example.utility.counter.instance" (ref As Ptr) As Integer</code></pre>



<p>Then you can call the method and save its value.</p>



<pre class="wp-block-code"><code>Var count As Integer = increment(counter)</code></pre>



<p>The reference as the Ptr must be the first parameter passed in the Declare. Follow it with other parameters as usual.</p>



<p>You can also call instance methods directly in the Android API in this manner.</p>



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



<p>There are Android APIs that use callbacks to methods that you provide. In Xojo these methods are Delegates and are methods that you supply using <a href="https://documentation.xojo.com/api/language/addressof.html#addressof" target="_blank" rel="noreferrer noopener">AddressOf</a>. It is very important that the signature of this method exactly matches what the callback expects which means you’ll be limited to just the Boolean and Ptr types.</p>



<p>If you want to use an API that uses its own callbacks, you’ll be better served by creating a Library and having the API do the callback to your own Library methods, which you can then call back to your Xojo methods.</p>



<p>You can pass the reference to the Xojo method using AddressOf like this:</p>



<pre class="wp-block-code"><code>Var cb As Ptr = AddressOf TestCallback<br>Declare Sub xojocallback Lib "com.example.utility.callback" (cb As Ptr)<br>xojocallback(cb)</code></pre>



<p>The Xojo method can only use parameter types of Boolean and Ptr. It looks like this:</p>



<pre class="wp-block-code"><code>Public Sub TestCallback(b As Boolean, i As Ptr, s As Ptr)</code></pre>



<p>In the Kotlin library you have to cast the incoming parameter to a function reference. This is a two-step process where you verify the function has the correct number of parameters and then you cast it to the specific parameter types. Sample code:</p>



<pre class="wp-block-code"><code>if (cb is Function3&lt;*, *, *, *&gt;) {
    try {
         (cb as Function3&lt;Boolean, Long, String, Unit&gt;).invoke(true, 42, "Hello")
         println("Sent callback to Xojo")
    } catch (e: ClassCastException) {
         println("Casting failed: ${e.message}")
    }
}</code></pre>



<p>The &#8220;Function3&#8221; indicates a function with 3 parameters (the last &#8220;*&#8221; indicates the return type), but you can change that as needed using Function1, Function2, etc. You can pass anything back through a Ptr type, but the Xojo code has to convert them using Ptr methods so you should not change the types of the values you send back to be different than what your Xojo code expects.</p>



<h2 class="wp-block-heading">Object Declares</h2>



<p>Object Declares are not new, but for completeness are described here. Essentially an Object Declare uses special syntax to Declare to a UI control.</p>



<p>The typical way to use an Object Declare is by adding an Extends method to a Module. For example, an extension method to allow MobileButton to change its colors could look like this:</p>



<pre class="wp-block-code"><code>SetBackColor(Extends ctrl As MobileButton, c As Color)</code></pre>



<p>The Object Declare looks like this:</p>



<pre class="wp-block-code xojo"><code>Declare Sub setBackgroundColor Lib "Object:ctrl:MobileButton" (myColor As Int32)
setBackgroundColor(c.ToInteger)</code></pre>



<p>Breaking this down, we’re calling the setBackgroundColor function. The Lib denotes this new type of Object declare: an Object, separated by a colon, the Xojo name of the object (in this case, our “ctrl” parameter), followed by another colon, and the Xojo type of the object.</p>



<h2 class="wp-block-heading">Kotlin Declares</h2>



<p>You can use the Android-specific  &#8220;Kotlin&#8221; Declare designation to indicates that what is specified in the Alias section of the Declare should be used as is. This is particularly helpful when you want to cast Ptr values to a specific type for use with OS APIs.</p>



<p>This code gets a ColorStateList object for a Xojo Color value:</p>



<pre class="wp-block-code"><code>Var c As Color = Color.Blue

Declare Function valueOf Lib "android.content.res.ColorStateList:Kotlin" Alias _
"android.content.res.ColorStateList.valueOf(android.graphics.Color.argb(alpha.toInt(), r.toInt(), g.toInt(), b.toInt()))" _
(alpha As Int32, r As Int32, g As Int32, b As Int32) As Ptr

Var csl As Ptr = valueOf(255 - c.Alpha, c.Red, c.Green, c.Blue)</code></pre>



<p>This code can then be used to call <a href="https://developer.android.com/reference/com/google/android/material/button/MaterialButton#setStrokeColor(android.content.res.ColorStateList)" target="_blank" rel="noreferrer noopener">setStrokeColor</a> on a MobileButton:</p>



<pre class="wp-block-code"><code>Declare Sub import Lib "android.content.res.ColorStateList:Import" // Imports the ColorStateList class

Declare Sub setStrokeColor Lib "Object:ctrl:MobileDateTimePicker:Kotlin" Alias "setStrokeColor(strokecolor as ColorStateList)" (strokeColor As Ptr)
setStrokeColor(csl)</code></pre>



<p>As you can see, in the Alias is the Kotlin method call that casts the incoming Ptr value to a ColorStateList.</p>



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



<p>Note the &#8220;import&#8221; declare in the code snippet above. This is also specific to Android. This Declare indicates that a specific class should be imported so that it can be used for casting purposes. If you left off that import, then the cast to ColorStateList would cause a compile error because ColorStateList would not be known.</p>



<p>You only need to import a specific class once. After you&#8217;ve done so it can be referenced by any other Declare, even ones in different methods.</p>



<p>The use of an import Declare is optional and is meant to simply the Kotlin method call code in the Alias. Instead of using import you can specify the full class path in the cast like this:</p>



<pre class="wp-block-code xojo"><code>Declare Sub setStrokeColor Lib "Object:ctrl:MobileDateTimePicker:Kotlin" Alias "setStrokeColor(strokecolor as android.content.res.ColorStateList)" (strokeColor As Ptr)
setStrokeColor(csl)</code></pre>



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



<p>Many classes in the framework now have Handle properties (or methods) which you can use with various Declare techniques described above. These include: FolderItem, Font, GraphicsPath, Locale, TimeZone, Graphics, Picture. In addition, the mobile controls have Handle properties that can serve as an alternative for an Object Declare.</p>



<h2 class="wp-block-heading">Sample Project</h2>



<p>You can download the sample project that demonstrates a library and some of the concepts described above. You can use this as a template or starting point for creating your own libraries or Declares.</p>



<p><a href="https://files.xojo.com/BlogExamples/UtilityLibrary2.zip" target="_blank" rel="noreferrer noopener">Sample Utility Library Project</a></p>



<p>You might also want to take a look at the <a href="https://github.com/XojoGermany/AndroidDesignExtensions" target="_blank" rel="noreferrer noopener">Android Design Extensions open source project</a>, which has hundreds of Declares that can enhance your Android apps.</p>



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



<ul class="wp-block-list">
<li><a href="https://blog.xojo.com/2023/08/15/creating-an-android-library-with-kotlin-for-use-with-xojo/" target="_blank" rel="noreferrer noopener">Android Libraries blog post</a></li>



<li><a href="https://blog.xojo.com/2023/08/09/android-declares/" target="_blank" rel="noreferrer noopener">Android Declares blog post</a></li>
</ul>



<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>Xojo Code Editor Changes: Line Highlight, Syntax Help Area and Standardize Format</title>
		<link>https://blog.xojo.com/2024/10/01/xojo-code-editor-changes-line-highlight-syntax-help-area-and-standardize-format/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:30:29 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Code Editor]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13569</guid>

					<description><![CDATA[The Xojo Code Editor has a few notable changes for Xojo 2024r3 that you might find useful. Line Highlight The first change is that the&#8230;]]></description>
										<content:encoded><![CDATA[
<p>The Xojo Code Editor has a few notable changes for Xojo 2024r3 that you might find useful.</p>



<h2 class="wp-block-heading">Line Highlight</h2>



<p>The first change is that the entire line containing the cursor is now highlighted. This makes it much easier to find where your cursor is on large displays and matches behavior that is common in other coding editors, such as BBEdit or Visual Studio Code. This highlight is controlled in Coding Settings:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="330" height="52" src="https://blog.xojo.com/wp-content/uploads/2024/09/image.png" alt="" class="wp-image-13591" srcset="https://blog.xojo.com/wp-content/uploads/2024/09/image.png 330w, https://blog.xojo.com/wp-content/uploads/2024/09/image-300x47.png 300w" sizes="auto, (max-width: 330px) 100vw, 330px" /></figure>



<p>Here is what he row highlight looks like:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="971" height="1024" src="https://blog.xojo.com/wp-content/uploads/2024/08/image-11-971x1024.png" alt="" class="wp-image-13570" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/image-11-971x1024.png 971w, https://blog.xojo.com/wp-content/uploads/2024/08/image-11-284x300.png 284w, https://blog.xojo.com/wp-content/uploads/2024/08/image-11-768x810.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/image-11-1456x1536.png 1456w, https://blog.xojo.com/wp-content/uploads/2024/08/image-11.png 1568w" sizes="auto, (max-width: 971px) 100vw, 971px" /></figure>



<h2 class="wp-block-heading">Syntax Help Area</h2>



<p>With the enhancement to show method overloads in the Syntax Help area a couple years ago, the area was changed to dynamically resize its contents depending on what is shown there. Although some liked this design there were others that felt that it was distracting to have the Syntax Help Area size change so often.</p>



<p>An improvement made last year altered the syntax help area behavior so that it is only updated when the mouse cursor stops moving for a moment. Because of that change, we are able to introduce the option to have a fixed-size Syntax Help Area.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="784" height="88" src="https://blog.xojo.com/wp-content/uploads/2024/08/image-12.png" alt="" class="wp-image-13571" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/image-12.png 784w, https://blog.xojo.com/wp-content/uploads/2024/08/image-12-300x34.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/image-12-768x86.png 768w" sizes="auto, (max-width: 784px) 100vw, 784px" /></figure>



<p>In the Coding Settings, you can choose: 2, 3, 4, 5, 6 Lines or Resizable. The default is now 3 lines. If more information is shown than will fit in the Syntax Help Area, there is a scrollbar (which you can now actually use since the area won&#8217;t update with new information until you stop moving the mouse).</p>



<p>You should also notice improved syntax help in general. The lookup engine is now better able to infer context to show more accurate information. I&#8217;m particularly pleased that CType now shows in the Syntax Help Area because I can never remember the order of the parameters!</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="234" src="https://blog.xojo.com/wp-content/uploads/2024/08/image-13-1024x234.png" alt="" class="wp-image-13572" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/image-13-1024x234.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/08/image-13-300x68.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/image-13-768x175.png 768w, https://blog.xojo.com/wp-content/uploads/2024/08/image-13.png 1052w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Standardize Format</h2>



<p>A long-standing request (from 2010!) was to have the Standardize Format option available on the Code Editor command bar. Lots of people like their code formatted nicely and Standardize Format is a great way to do that.</p>



<p>Now you can easily click a button on the command bar to quickly format everything in the code editor, instead of first having to Select All and then choose a contextual menu option.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="948" height="304" src="https://blog.xojo.com/wp-content/uploads/2024/08/image-14.png" alt="" class="wp-image-13573" srcset="https://blog.xojo.com/wp-content/uploads/2024/08/image-14.png 948w, https://blog.xojo.com/wp-content/uploads/2024/08/image-14-300x96.png 300w, https://blog.xojo.com/wp-content/uploads/2024/08/image-14-768x246.png 768w" sizes="auto, (max-width: 948px) 100vw, 948px" /></figure>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>If you really like your code to be formatted automatically, don&#8217;t forget you can always turn on &#8220;Apply standardize format after ending line&#8221; in the Coding Settings.</p>
</blockquote>



<p>And don&#8217;t forget that you can also create your own script to format your code any way you want. Learn more about this in <a href="https://documentation.xojo.com/topics/code_management/custom_code_reformatting.html#custom-code-reformatting" target="_blank" rel="noreferrer noopener">Custom Code Reformatting</a> in the docs. You might also want to try to this <a href="https://github.com/paullefebvre/ReformatCode" target="_blank" rel="noreferrer noopener">powerful reformatting script</a>.</p>



<p>If you have other suggestions for Code Editor improvements, please be sure to create an Issue. One popular suggestion is to have the text under the cursor be highlighted throughout the code editor (see <a href="https://tracker.xojo.com/xojoinc/xojo/-/issues/74741" target="_blank" rel="noreferrer noopener">Issue #74741</a>), which I have started to investigate. Read all about the Xojo <a href="https://documentation.xojo.com/getting_started/using_the_ide/code_editor.html#">Code Editor</a> in the Xojo Docs.</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>Xojo 2024r3 is Now Available!</title>
		<link>https://blog.xojo.com/2024/10/01/xojo-2024r3-is-now-available/</link>
		
		<dc:creator><![CDATA[Xojo]]></dc:creator>
		<pubDate>Tue, 01 Oct 2024 15:29:54 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[2024r3]]></category>
		<category><![CDATA[Code Editor]]></category>
		<category><![CDATA[Preemptive Threads]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13757</guid>

					<description><![CDATA[We are excited to announce the arrival of Xojo 2024 Release 3, a major update to the Xojo development platform. This latest version includes over&#8230;]]></description>
										<content:encoded><![CDATA[
<p>We are excited to announce the arrival of Xojo 2024 Release 3, a major update to the Xojo development platform. This latest version includes over 200 changes and improvements, enhancing the overall user experience and expanding the platform&#8217;s capabilities.</p>



<h2 class="wp-block-heading">What&#8217;s New in Xojo 2024 Release 3</h2>



<p>We&#8217;ve been working hard to bring you the best possible cross-platform development experience, and Xojo 2024 Release 3 delivers. Here are some of the highlights:</p>



<div class="wp-block-columns are-vertically-aligned-top is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow">
<p class="has-text-align-center"><strong>Preemptive Threading</strong></p>



<p class="has-text-align-center">In this highly anticipated feature, take your applications to the next level with preemptive threading. Preemptive threads allow you to create more responsive and efficient code, maximizing the potential of your multi-core systems.</p>



<p class="has-text-align-center"><a href="https://blog.xojo.com/tag/preemptive-threads/" data-type="link" data-id="https://blog.xojo.com/2024/10/01/cooperative-to-preemptive-weaving-new-threads-into-your-apps/" target="_blank" rel="noreferrer noopener">Learn how to take advantage of preemptive threads.</a></p>
</div>



<div class="wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow">
<p class="has-text-align-center"><strong>Improved Code Editor</strong></p>



<p class="has-text-align-center">We&#8217;ve made significant improvements to the Code Editor, including row highlighting, a command bar button for Standardize Format, and Syntax Help area size control, making it easier for you to write and maintain your code.</p>



<p class="has-text-align-center"><a href="https://blog.xojo.com/2024/10/01/xojo-code-editor-changes-line-highlight-syntax-help-area-and-standardize-format/" data-type="link" data-id="https://blog.xojo.com/2024/10/01/xojo-code-editor-changes-line-highlight-syntax-help-area-and-standardize-format/" target="_blank" rel="noreferrer noopener">Learn about the new Code Editor changes.</a></p>
</div>
</div>



<div class="wp-block-columns are-vertically-aligned-top is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow">
<p class="has-text-align-center"><strong>Web Framework Updates</strong></p>



<p class="has-text-align-center">The Web framework now uses Bootstrap v5.3.3 and Bootstrap Icons v1.11.3, and supports adding CSS classes to controls, giving you more flexibility and customization options.</p>



<p class="has-text-align-center"><a href="https://blog.xojo.com/2024/10/01/introducing-named-color-and-css-classes-in-xojo-web/" data-type="link" data-id="https://blog.xojo.com/2024/10/01/introducing-named-color-and-css-classes-in-xojo-web/" target="_blank" rel="noreferrer noopener">Read about the Web framework improvements.</a></p>
</div>



<div class="wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow">
<p class="has-text-align-center"><strong>Native Platform Enhancements</strong></p>



<p class="has-text-align-center">macOS Popovers can now be resized, and the Windows HTMLViewer can access the camera and microphone, while the iOS Picture control can access EXIF metadata.</p>



<p class="has-text-align-center"><a href="https://blog.xojo.com/2024/10/01/photos-metadata-and-location-on-ios-pictures/" target="_blank" rel="noreferrer noopener">Check out this post about the iOS picture control enhancements and more.</a></p>
</div>
</div>



<div class="wp-block-columns are-vertically-aligned-top is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow">
<p class="has-text-align-center"><strong>Android Support</strong></p>



<p class="has-text-align-center">Xojo 2024 Release 3 introduces Android tablet support, improved Declare support, and RegEx classes, making it easier for you to create Android apps.</p>



<p class="has-text-align-center"><a href="https://blog.xojo.com/2024/10/01/android-tablet-support/" data-type="link" data-id="https://blog.xojo.com/2024/10/01/android-tablet-support/" target="_blank" rel="noreferrer noopener">Android Tablet Support</a> • <a href="https://blog.xojo.com/2024/10/01/android-declare-and-library-enhancements/" data-type="link" data-id="https://blog.xojo.com/2024/10/01/android-declare-and-library-enhancements/" target="_blank" rel="noreferrer noopener">Enhanced Android Declares &amp; Library</a></p>
</div>



<div class="wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow">
<p class="has-text-align-center"><strong>Fuzzy Searches with SQLite&#8217;s SOUNDEX</strong></p>



<p class="has-text-align-center">We&#8217;ve added support for SQLite&#8217;s SOUNDEX function, which enables fuzzy searches to help you find similar-sounding words and phrases in your database.</p>



<p class="has-text-align-center"><a href="https://blog.xojo.com/2024/10/01/fuzzy-searches-with-sqlites-soundex/" data-type="link" data-id="https://blog.xojo.com/2024/10/01/fuzzy-searches-with-sqlites-soundex/" target="_blank" rel="noreferrer noopener">Read about SQLite SOUNDEX support.</a></p>
</div>
</div>



<p>These updates and enhancements are designed to make your development experience more efficient, productive, and enjoyable. Whether you&#8217;re building a new application or updating an existing one, Xojo 2024 Release 3 provides you with the tools and capabilities you need to succeed.</p>



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



<p>To learn more about Xojo 2024 Release 3 and to get started with the development process, please visit the <a href="https://documentation.xojo.com/versions/2024r3/resources/release_notes/2024r3.html" data-type="link" data-id="https://documentation.xojo.com/versions/2024r3/resources/release_notes/2024r3.html" target="_blank" rel="noreferrer noopener">Xojo 2024r3 Release Notes</a>. The update can be downloaded right now, from the <a href="https://xojo.com/download/" data-type="link" data-id="https://xojo.com/download/" target="_blank" rel="noreferrer noopener">Xojo downloads page</a>.</p>



<h3 class="wp-block-heading">What&#8217;s Next?</h3>



<p>We&#8217;re always working on new features, updates, and enhancements to our platform. If you have any suggestions or ideas, please don&#8217;t hesitate to add them to the <a href="https://tracker.xojo.com/xojoinc/xojo" data-type="link" data-id="https://tracker.xojo.com/xojoinc/xojo" target="_blank" rel="noreferrer noopener">Xojo tracker</a>. We&#8217;re always looking for ways to improve and expand Xojo.</p>



<p class="has-text-align-center"><strong>Thank you for being part of the Xojo community. We&#8217;re excited to see what you&#8217;ll create with Xojo 2024r3!</strong></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>
