<?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>API &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/api/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:25 +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>Get There From Here with the MobileMapViewer for Android</title>
		<link>https://blog.xojo.com/2025/07/08/get-there-from-here-with-the-mobilemapviewer-for-android/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 08 Jul 2025 18:01:00 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[2025r2]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Maps]]></category>
		<category><![CDATA[MobileMapViewer]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14873</guid>

					<description><![CDATA[A new control added to Android for Xojo 2025r2 is MobileMapViewer. This control uses the Google Maps SDK to display mapping data in your apps.&#8230;]]></description>
										<content:encoded><![CDATA[
<p>A new control added to Android for Xojo 2025r2 is MobileMapViewer. This control uses the Google Maps SDK to display mapping data in your apps.</p>



<p>Before you can use MobileMapViewer you will need to have a Google Maps account configured so that you can generate an API Key. Instructions for doing this on available from Google: <a href="https://mapsplatform.google.com">Google Maps Platform</a>, <a href="https://developers.google.com/maps/documentation/embed/get-api-key">Get Google Maps API Key</a>.</p>



<p>Google Maps is not free to use. Although there is some free usage available for testing your app, your account does get billed based on usage once the small amount of free testing credits are used up.</p>



<p>When you have your API Key, you can add it to your Xojo project using a new App property. Select App in the Navigator and in the Inspector, put the key in the Google Maps API Key field. Note that the key is not saved with text projects and is instead saved as part of the UI state file that is local to the development machine. This prevents the key from being accidently committed to a source code repository.</p>



<p>With the configuration work out of the way, you can now use the control. Drag a <a href="https://documentation.xojo.com/api/user_interface/mobile/mobilemapviewer.html#mobilemapviewer">MobileMapViewer</a> from the Library onto a screen. When you run the project you&#8217;ll see an interactive map that you can swipe, zoom and move around as you like.</p>



<p>This code shows Fenway Park in Boston:</p>



<pre class="wp-block-code"><code>FenwayLocation = New MapLocation("Fenway Park, Boston, MA USA")
FenwayLocation.Title = "Fenway Park"

MapViewer1.ZoomRadius = 5
MapViewer1.GoToLocation(FenwayLocation) // Center map within radius km

MapViewer1.AddLocation(FenwayLocation) // Drop a pin</code></pre>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="482" height="1024" src="https://blog.xojo.com/wp-content/uploads/2025/06/CleanShot-2025-06-17-at-14.43.39@2x-482x1024.png" alt="" class="wp-image-14991" srcset="https://blog.xojo.com/wp-content/uploads/2025/06/CleanShot-2025-06-17-at-14.43.39@2x-482x1024.png 482w, https://blog.xojo.com/wp-content/uploads/2025/06/CleanShot-2025-06-17-at-14.43.39@2x-141x300.png 141w, https://blog.xojo.com/wp-content/uploads/2025/06/CleanShot-2025-06-17-at-14.43.39@2x-768x1632.png 768w, https://blog.xojo.com/wp-content/uploads/2025/06/CleanShot-2025-06-17-at-14.43.39@2x-723x1536.png 723w, https://blog.xojo.com/wp-content/uploads/2025/06/CleanShot-2025-06-17-at-14.43.39@2x.png 916w" sizes="(max-width: 482px) 100vw, 482px" /></figure>



<p>The <a href="https://documentation.xojo.com/api/user_interface/mobile/mobilemapviewer.html#mobilemapviewer">MobileMapVIewer API</a> matches what has already been in use for iOS. You can also use the <a href="https://documentation.xojo.com/api/ios/maplocation.html">MapLocation class</a> to track specific locations. Although the overall API matches what has been used for iOS, there is one exception: MapLocation.PointsOfInterest() is not yet implemented. Implementing this requires another Google SDK and API Key (the <a href="https://developers.google.com/maps/documentation/places/web-service/overview">Places API</a>) and is being reviewed for a future release. We may also consider adding alternative mapping engines as well.</p>



<p>Note: <a href="https://youtu.be/p6V2Ew1M0sE?si=wLQo3S8HKaiULKid&amp;t=72">You can&#8217;t get there from here</a> is an old Maine saying.</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>Identify Yourself with UserAuthentication for Android</title>
		<link>https://blog.xojo.com/2025/07/08/identify-yourself-with-userauthentication-for-android/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 08 Jul 2025 18:01:00 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[2025r2]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Authentication]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14879</guid>

					<description><![CDATA[Mobile devices typically have a way for the user to identify themself. This can be using a fingerprint sensor, face detection or even with an&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Mobile devices typically have a way for the user to identify themself. This can be using a fingerprint sensor, face detection or even with an old-school passcode or password. The <a href="https://documentation.xojo.com/api/ios/userauthentication.html#userauthentication">UserAuthentication class</a>, now also available for Android, is a great way to do this authentication.</p>



<p>UserAuthentication works similarly to how it is used on iOS. You can drag the control from the Library onto your layout and then implement the AuthenticationSucceeded event.</p>



<p>To request authentication, call the Request() method with a short string asking the reason why you need authentication.</p>



<pre class="wp-block-code"><code>UserAuthentication1.Request("Authorize me, HAL")</code></pre>



<p>Because this is using system-level APIs, you and your app never know the details about the authentication. You will not know the password, passcode or have any specifics about a fingerprint or face. Instead, if the system determines that the authentication was successful, then the AuthenticationSucceeded event is called.</p>



<p>Here&#8217;s a quick video of it in action.</p>



<figure class="wp-block-video"><video height="640" style="aspect-ratio: 360 / 640;" width="360" controls src="https://blog.xojo.com/wp-content/uploads/2025/06/HALVideoSmall.mov"></video></figure>



<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>
					
		
		<enclosure url="https://blog.xojo.com/wp-content/uploads/2025/06/HALVideoSmall.mov" length="8694754" type="video/quicktime" />

			</item>
		<item>
		<title>Android Design Extensions 3.5 for Xojo 2024r4+</title>
		<link>https://blog.xojo.com/2024/12/10/android-design-extensions-3-5-for-xojo-2024r4/</link>
		
		<dc:creator><![CDATA[Martin T.]]></dc:creator>
		<pubDate>Tue, 10 Dec 2024 16:38:03 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Android Design Extensions]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Declares]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=14175</guid>

					<description><![CDATA[With the release of Xojo 2024r4, it’s time to unveil a new version of the Android Design Extensions. The focus of version 3.5 (compatible with&#8230;]]></description>
										<content:encoded><![CDATA[
<p>With the release of Xojo 2024r4, it’s time to unveil a new version of the Android Design Extensions. The focus of version 3.5 (compatible with all Xojo versions starting from 2024r4+) was on code maintenance and introducing exceptions for unsupported API calls, depending on the running Android version. This should make your work as a developer easier.</p>



<p>You can now use the <em>SetBottomAppBarMenuAlignmentModeXC </em>extension method for MobileScreen to set the alignment of the buttons in your MobileScreen.Toolbar.</p>



<p>Additionally, new declares for MobileMessageBox have been added, allowing you to display an icon next to the title as well as next to individual buttons.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="498" height="1024" src="https://blog.xojo.com/wp-content/uploads/2024/12/3C6F953F-1315-4016-8A7B-F2427E7F54BC-498x1024.png" alt="" class="wp-image-14176" srcset="https://blog.xojo.com/wp-content/uploads/2024/12/3C6F953F-1315-4016-8A7B-F2427E7F54BC-498x1024.png 498w, https://blog.xojo.com/wp-content/uploads/2024/12/3C6F953F-1315-4016-8A7B-F2427E7F54BC-146x300.png 146w, https://blog.xojo.com/wp-content/uploads/2024/12/3C6F953F-1315-4016-8A7B-F2427E7F54BC-768x1579.png 768w, https://blog.xojo.com/wp-content/uploads/2024/12/3C6F953F-1315-4016-8A7B-F2427E7F54BC-747x1536.png 747w, https://blog.xojo.com/wp-content/uploads/2024/12/3C6F953F-1315-4016-8A7B-F2427E7F54BC-996x2048.png 996w, https://blog.xojo.com/wp-content/uploads/2024/12/3C6F953F-1315-4016-8A7B-F2427E7F54BC.png 1080w" sizes="(max-width: 498px) 100vw, 498px" /></figure>



<p>Give it a try! More exciting Android features are coming soon. Stay tuned!</p>



<p>Feel free to take a look at the developer repository, create feature requests, and provide feedback on extending this extension library.</p>



<p>I’m happy to receive any voluntary financial support for the work I’ve done so far, which you are welcome to <a href="https://www.paypal.com/paypalme/MTrippensee">share here</a>. You can download the project with many examples at <a href="https://github.com/XojoGermany/AndroidDesignExtensions">https://github.com/XojoGermany/AndroidDesignExtensions</a>.</p>



<p>Happy coding.</p>



<p><em>Martin T. is a Xojo MVP and has been very involved in testing Android support.</em></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Xojo Web Rescues a .NET Project</title>
		<link>https://blog.xojo.com/2024/10/23/xojo-web-rescues-a-net-project/</link>
		
		<dc:creator><![CDATA[Wayne Golding]]></dc:creator>
		<pubDate>Wed, 23 Oct 2024 16:40:14 +0000</pubDate>
				<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[URLConnection]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=13909</guid>

					<description><![CDATA[I had a call recently from a customer whose upstream supplier informed them that they would not be accepting anything less than TLS 1.2 encryption.&#8230;]]></description>
										<content:encoded><![CDATA[
<p>I had a call recently from a customer whose upstream supplier informed them that they would not be accepting anything less than TLS 1.2 encryption. The customer’s application is written using .NET 1.1 (they are testing a new version but aren’t ready to deploy to production just yet). Their supplier insisted on a 1-week time limit. Can I help?</p>



<p>My answer was, of course, “Let me have a look and get back to you.”</p>



<p>I went to my favourite dev tool, Xojo, and went through the process of developing a solution.&nbsp;The connection is a REST API, so I’ll start with a web project and use the HandleURL event. And I’ll use a URLConnection to pass on the request.&nbsp; Wait … could it be that simple?</p>



<pre class="wp-block-code"><code>Function HandleURL(request As WebRequest, response As WebResponse) Handles HandleURL as Boolean

  // Create the outbound connection
  Var connector As New URLConnection
 
  // Copy the content of the request
  connector.SetRequestContent(request.Body, request.MIMEType)

  // Send the request
  Var result As String
  Try
    result = connector.SendSync("POST", kAddress + request.Path)
  Catch err As RuntimeException
    // Catch DNS, Certificate &amp; Timeout errors
    response.Status = 500
    response.Write(err.Message)
    Return True
  End

  // Return the result of the request
  response.Status = connector.HTTPStatusCode
  response.Write(result)

  Return True

End Function</code></pre>



<p>The answer is, &#8220;Yes!&#8221;&nbsp; This is all the code in the entire project.</p>



<p>You will notice that there is no security, but in this instance that is fine as the virtual machine is running this is on the same network as the client server and the firewall is configured to only allow connections from that server.</p>



<p>After processing over 60 thousand requests, memory use is 7.3MB and never exceeded 13MB.&nbsp;CPU usage was at the maximum 1.5%.</p>



<p>Even after using Xojo for 20 years this still blows my mind.</p>



<p><em>Wayne Golding has been a Xojo developer since 2005 and is a Xojo MVP. He operates the IT Company <a href="http://www.axisdirect.nz">Axis Direct Ltd </a>which primarily develops applications using Xojo that integrate with Xero www.xero.com. Wayne’s hobby is robotics where he uses Xojo to build applications for his Raspberry Pi, often implementing IoT for remote control.</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>Testing REST-based Web Services</title>
		<link>https://blog.xojo.com/2023/03/07/testing-rest-based-web-services/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Tue, 07 Mar 2023 15:16:55 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[URLConnection]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=11358</guid>

					<description><![CDATA[Using Xojo's URLConnection to communicate with web services is pretty straightforward. But testing the actual REST API calls can get tricky. To make it easier to test and experiment with REST API calls, Paul created a app in Xojo that lets you test REST APIs. He called it RESTy in its original format back in 2015. You can download the updated project here built with Xojo 2022r4.1.]]></description>
										<content:encoded><![CDATA[
<p>Using Xojo&#8217;s URLConnection to communicate with web services is pretty straightforward. But testing the actual REST API calls can get tricky. To make it easier to test and experiment with REST API calls, Paul created an app in Xojo for doing just this. He called it RESTy in its original format back in 2015. The most recent version of the example project can be found in Xojo by choosing File > New Project, clicking on Examples then clicking on Communication > Internet > Web Services >RESTy.</p>



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



<p>RESTy uses the <a href="https://documentation.xojo.com/api/networking/urlconnection.html#urlconnection">URLConnection</a> class to send a request to a web service and get a result. If the result is text (JSON, for example)&nbsp;it displays in the <strong>Response</strong> tab. Here, I am calling the <a href="https://documentation.xojo.com/topics/communication/internet/testing_a_web_service.html">Eddie&#8217;s Electronics web service</a> to return a list of all the customers by specifying the URL and clicking the Fetch button:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="965" height="1024" src="https://blog.xojo.com/wp-content/uploads/2023/03/getallcustomers-965x1024.png" alt="" class="wp-image-11365" srcset="https://blog.xojo.com/wp-content/uploads/2023/03/getallcustomers-965x1024.png 965w, https://blog.xojo.com/wp-content/uploads/2023/03/getallcustomers-283x300.png 283w, https://blog.xojo.com/wp-content/uploads/2023/03/getallcustomers-768x815.png 768w, https://blog.xojo.com/wp-content/uploads/2023/03/getallcustomers.png 1200w" sizes="(max-width: 965px) 100vw, 965px" /></figure>



<p>For other data (binary data such as pictures) you can use the Fetch to File button to save the request to a file.</p>



<p>The Authentication tab is used to provide Basic Authentication should the web service require it.</p>



<p>The Request Content tab can be used to provide Content data that the request might need. For example, the Eddie&#8217;s Electronics web service also lets you request the details for a specific customer by providing simple JSON containing the customer ID. To try this using RESTy app:</p>



<ol class="wp-block-list">
<li>Click on the Request Content Tab.</li>



<li>To indicate the customer you wish to retrieve, enter the following JSON into the field on that tab: <code>{"ID": 10039}</code></li>



<li>Select <strong>POST</strong> from the Send Method popup menu.</li>



<li>In the URL field, enter: <code>https://eews-demos.xojo.com/GetCustomer</code></li>



<li>Press the Fetch button.</li>
</ol>



<p>If you have entered everything correctly, will see the data for Caleb Horn in JSON format:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="965" height="1024" src="https://blog.xojo.com/wp-content/uploads/2023/03/getonecustomer-1-965x1024.png" alt="" class="wp-image-11367" srcset="https://blog.xojo.com/wp-content/uploads/2023/03/getonecustomer-1-965x1024.png 965w, https://blog.xojo.com/wp-content/uploads/2023/03/getonecustomer-1-283x300.png 283w, https://blog.xojo.com/wp-content/uploads/2023/03/getonecustomer-1-768x815.png 768w, https://blog.xojo.com/wp-content/uploads/2023/03/getonecustomer-1.png 1200w" sizes="auto, (max-width: 965px) 100vw, 965px" /></figure>



<p>And to see the JSON formatted nicely, click the Format JSON button:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="965" height="1024" src="https://blog.xojo.com/wp-content/uploads/2023/03/formattedJSON-965x1024.png" alt="" class="wp-image-11368" srcset="https://blog.xojo.com/wp-content/uploads/2023/03/formattedJSON-965x1024.png 965w, https://blog.xojo.com/wp-content/uploads/2023/03/formattedJSON-283x300.png 283w, https://blog.xojo.com/wp-content/uploads/2023/03/formattedJSON-768x815.png 768w, https://blog.xojo.com/wp-content/uploads/2023/03/formattedJSON.png 1200w" sizes="auto, (max-width: 965px) 100vw, 965px" /></figure>



<p>This will let you you explore calling various REST API services. You can explore the source code to see how it uses URLConnection to do so.</p>



<p>To be sure, RESTy is very basic, but you have the source code so you and add features to it and modify it for your own testing needs.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>CatsUp! 2022</title>
		<link>https://blog.xojo.com/2022/03/16/catsup-2022/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 16 Mar 2022 15:53:53 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Cats]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=10135</guid>

					<description><![CDATA[With just a few lines of code, you can create a Xojo app for iOS and Android that shows a new cat picture each time you launch it. I call this app “CatsUp!”. It's a play on ketchup/catsup, get it?]]></description>
										<content:encoded><![CDATA[
<p>Back in 2015, I wrote a <a href="https://blog.xojo.com/2015/10/01/cats-up-using-httpsocket-with-the-cat-rest-api/">blog post</a> about an iOS app called CatsUp! that used <a href="https://thecatapi.com">The Cat API</a> to display random cat pictures. Things have changed a lot since then, so it&#8217;s time for an update!</p>



<p>With just a few lines of code, you can create a mobile app that shows a new cat picture each time you launch it. I call this app “CatsUp!”. It&#8217;s a play on <a href="https://writingexplained.org/catsup-vs-ketchup-difference">ketchup/catsup</a>, get it?</p>



<h3 class="wp-block-heading">Set Up The Project</h3>



<p>Create a new iOS project called “CatsUp”. Drag an ImageViewer control onto Screen1, make it fill most of the area and change its Name to &#8220;CatImage&#8221;. Drag a Button to the bottom and change its Caption to “Cat Me!”. Also change the Screen Title to be &#8220;CatsUp!&#8221;. The result should look something like this:</p>



<figure class="wp-block-image size-medium"><img loading="lazy" decoding="async" width="184" height="300" src="https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-09.52.48@2x-184x300.png" alt="" class="wp-image-10136" srcset="https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-09.52.48@2x-184x300.png 184w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-09.52.48@2x-626x1024.png 626w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-09.52.48@2x.png 750w" sizes="auto, (max-width: 184px) 100vw, 184px" /></figure>



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



<p>The&nbsp;<a href="https://docs.thecatapi.com/">Cat API documentation page</a>&nbsp;describes the full API. For access to most features you will want to sign up for a free account and use an API key. For the purposes of this post, I will just use it without an API key. The URL for the method to get a random cat picture is:</p>



<pre class="wp-block-preformatted">https://api.thecatapi.com/v1/images/search</pre>



<p>The above URL returns JSON that contains the location of a picture to display. Paste it into a web browser to try it. In my test I got this JSON:</p>



<pre class="wp-block-preformatted">[{"breeds":[],"id":"99v","url":"https://cdn2.thecatapi.com/images/99v.jpg","width":384,"height":384}]</pre>



<p>To make CatsUp, we will essentially add some code to 1) send the first request, 2) get the JSON and pull out the picture URL, 3) get the picture and display it.</p>



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



<p>Add the Pressed event to the Button with this code:</p>



<pre class="wp-block-preformatted">CatConnection.Send("GET", "https://api.thecatapi.com/v1/images/search")</pre>



<p>This calls the Send() method on a URLConnection object, called CatConnection, to get the JSON with the picture URL.</p>



<p>So now you need to drag a URLConnection object from the Library onto the Screen. Click on this newly added URLConnection1 item in the Tray and in the Inspector change its name to &#8220;CatConnection&#8221;. Add its ContentReceived event with this code:</p>



<pre class="wp-block-preformatted">Var json As JSONItem = New JSONItem
json.Load(content)

Var catItem As JSONItem
catItem = json.ValueAt(0)

Var picURL As String
picURL = catItem.Value("url").StringValue

ImageDownload.Send("GET", picURL)</pre>



<p>The above code loads the JSON into a JSONItem and then fetches the &#8220;url&#8221; value. It sends this URL to another URLConnection, called ImageDownload, to get the actual picture to display.</p>



<p>Drag a second URLConnection onto the screen and change its name to &#8220;ImageDownload&#8221;. Add its ContentReceived event with this code:</p>



<pre class="wp-block-preformatted">Var pic As Picture = Picture.FromData(content)
CatImage.Image = pic</pre>



<p>Try running the project in the iOS Simulator. Click the button to see a new cat picture.</p>



<p>This is what I see:</p>



<figure class="wp-block-image size-medium is-resized"><img loading="lazy" decoding="async" src="https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.46.03@2x-157x300.png" alt="" class="wp-image-10139" width="229" height="438" srcset="https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.46.03@2x-157x300.png 157w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.46.03@2x-536x1024.png 536w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.46.03@2x-768x1468.png 768w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.46.03@2x-803x1536.png 803w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.46.03@2x-1071x2048.png 1071w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.46.03@2x.png 1204w" sizes="auto, (max-width: 229px) 100vw, 229px" /></figure>



<p>Oops, silly me. I actually created this as an Android project and ran it in the Android Emulator. Sorry about that, here is what it looks like as an iOS project running in the iOS Simulator:</p>



<figure class="wp-block-image size-medium is-resized"><img loading="lazy" decoding="async" src="https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.47.56@2x-edited.png" alt="" class="wp-image-10141" width="234" height="532" srcset="https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.47.56@2x-edited.png 1000w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.47.56@2x-edited-132x300.png 132w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.47.56@2x-edited-450x1024.png 450w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.47.56@2x-edited-768x1747.png 768w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.47.56@2x-edited-675x1536.png 675w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.47.56@2x-edited-900x2048.png 900w" sizes="auto, (max-width: 234px) 100vw, 234px" /></figure>



<p>That&#8217;s right, the exact same code for this project can be used in both <strong>iOS</strong> and <strong>Android</strong> projects! And for another bit of Android news, this CatsUp! app, with a couple minor enhancements, is now available in the <a href="https://play.google.com/store/apps/details?id=com.xojo.catsup">Google Play Store</a>:</p>



<figure class="wp-block-image size-large is-resized"><a href="https://play.google.com/store/apps/details?id=com.xojo.catsup"><img loading="lazy" decoding="async" src="https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.52.46@2x-618x1024.png" alt="" class="wp-image-10143" width="349" height="578" srcset="https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.52.46@2x-618x1024.png 618w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.52.46@2x-181x300.png 181w, https://blog.xojo.com/wp-content/uploads/2022/03/CleanShot-2022-03-16-at-10.52.46@2x.png 750w" sizes="auto, (max-width: 349px) 100vw, 349px" /></a></figure>



<p>Have fun with this and may every day be a Caturday!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Updated Tutorial: Active Words</title>
		<link>https://blog.xojo.com/2021/09/16/updated-tutorial-active-words/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Thu, 16 Sep 2021 13:00:00 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[TextArea]]></category>
		<category><![CDATA[Xojo API 2.0]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=9171</guid>

					<description><![CDATA[Follow this tutorial to create active, aka clickable, words in the text of a TextArea control in your Xojo projects. Learn to use the Object-oriented Delegate design pattern to dynamically change how your app reacts when the user clicks on those active words. Best of all, this project is cross-platform, so you can use it for macOS, Windows and Linux!]]></description>
										<content:encoded><![CDATA[
<p><strong>This post was originally <a href="https://blog.xojo.com/2018/07/31/tutorial-active-words/">published</a> in 2018 and has been updated to use Xojo API 2.0</strong>.</p>



<p>Follow this tutorial&nbsp;to create active, aka clickable, words in the text of a TextArea control in your Xojo projects. Learn to use the Object-oriented <a href="https://blog.xojo.com/2016/07/25/make-an-rss-reader-with-xojoin-33-lines-of-code/">Delegate design pattern</a> to dynamically change how your app reacts when the user clicks on those active words. Best of all, this project is cross-platform, so you can use it for macOS, Windows and Linux!</p>



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



<p>The active words&nbsp;will be based on the use of <a href="https://documentation.xojo.com/api/data_types/pair.html">Pairs</a>, so one piece of information will be the active word and the other piece of information will be the associated data, which is always a String. The associated data could be a link or text you want to show in another control when the user clicks on the active word.</p>



<p>For the sake of this tutorial, the class we are creating has some limitations. For example, you won&#8217;t be able to repeat the same word and assign it to take different actions. If you want your code to react the same to the same active word or words throughout your project, well then, that&#8217;s what it will do. Anyway, this tutorial serves as a good starting point and you&#8217;ll be able to modify and improve it to meet your own needs.</p>



<p>Download the class with the example project from <a href="https://www.dropbox.com/s/11z4g56q99lvw3j/URLTextArea.xojo_binary_project.zip?dl=1">here</a>.</p>



<div class="wp-block-image is-style-default"><figure class="aligncenter"><img loading="lazy" decoding="async" width="802" height="666" src="https://blog.xojo.com/wp-content/uploads/2021/09/ActiveWords.gif" alt="" class="wp-image-9172"/></figure></div>



<h3 class="wp-block-heading">TextArea Subclass</h3>



<p>This feature will be based in the <a href="https://documentation.xojo.com/api/deprecated/textarea.html">TextArea</a> class, the first step is add a new TextArea control from the Library panel to the Navigator, change its name to <code>LinkDetectorTextArea</code>. Next, add the following Event Handlers to the TextArea subclass. These will be responsible for following the pointer movement and reacting to the registered active words for the instance.</p>



<ul class="wp-block-list"><li><b>Open</b>. To assign the pointer cursor, more appropriate for the kind of functionality this subclass will provide</li><li><b>MouseMove</b>. To detect if there is an active word under the cursor pointer to click on</li><li><b>MouseDown</b>. To call all the registered Observers when the user clicks on an active word, passing along the detected word and the associated information</li></ul>



<p>Since we also want to make these events available for any instance created from the subclass, we have to create them again as Event Definitions. With the subclass selected in the Navigator, select <code>Insert &gt; Event Definition</code> using the following signatures:</p>



<ul class="wp-block-list"><li><b>Event Name. Open</b>.</li><li><b>Event Name. MouseMove</b>. Parameters: <code>X as Integer, Y as Integer</code>.</li><li><b>Event Name. MouseDown</b>. Parameters: <code>X as Integer, Y as Integer</code>. Return Type: <code>Boolean</code>.</li></ul>



<p>Add some Private properties used by the added Event Handlers and other methods we have yet to define to the class. Set these properties as private because they just need to be accessed from the class itself and not from other pieces of external code or additional classes inherited from the subclass:</p>



<ul class="wp-block-list"><li><b>Name. boundedWord</b>. Type: <code>Pair</code>. This is the property that will point to the current matched active word from the text.</li><li><b>Name. previousBoundedWord</b>. Type: <code>Pair</code>. This property points to the previous matched word from the text.</li><li><b>Name. linkedWords</b>. Type: <code>Dictionary</code>. This is the Dictionary that will contain all the active words / additional data pairs.</li><li><b>Name. observers()</b>. Type: <code>ActionDelegate</code>. This is an Array containing all the registered observers of the type <code>ActionDelegate</code> yet to be defined.</li></ul>



<p>As we have seen, we need to define a Delegate type for the class. Select <code>Insert &gt; Delegate</code> with the following data:</p>



<ul class="wp-block-list"><li><b>Delegate Name</b>: ActionDelegate.</li><li><b>Parameters</b>: boundedWord as Pair.</li><li><b>Scope</b>: Public.</li></ul>



<h3 class="wp-block-heading">Assigning the Cursor Type</h3>



<p>Select the <code>Open</code> Event and add the following code in the corresponding Code Editor:</p>



<pre class="wp-block-preformatted">Me.MouseCursor = System.cursors.standardpointer
RaiseEvent open</pre>



<p>We simply use this Event for assigning the Arrow cursor type that is most appropriate.</p>



<h3 class="wp-block-heading">Matching the Active Words</h3>



<p>Next, select the <code>MouseMove</code> Event Handler and type the following code in the corresponding Code Editor:</p>



<pre class="wp-block-preformatted">Var tlen As Integer = Me.Text.Length
If previousBoundedWord &lt;&gt; Nil Then
  setStyleForWord(previousBoundedWord, False)
  previousBoundedWord = Nil
End If

Var boundLeft, boundRight As Integer = -1
Var startPosition As Integer = Me.CharacterPosition(x,y)

If CharacterPosition(x,y) &gt;= tLen Then
  If boundedWord &lt;&gt; Nil Then setStyleForWord( boundedWord, False )
  mboundedWord = Nil
ElseIf Me.Text.Middle(startPosition,1) &lt;&gt; Chr(32) And Me.Text.Middle(startPosition,1) &lt;&gt; EndOfLine Then
  For n As Integer = startPosition DownTo 0
    If Me.Text.Middle(n,1) = Chr(32) Or Me.Text.Middle(n,1) = EndOfLine or n = 0 Then
      boundLeft = n
      Exit
    End
    
  Next
  For n As Integer = startPosition To tlen
    If Me.Text.Middle(n+1,1) = Chr(32) Or Me.Text.Middle(n+1,1) = EndOfLine Or n = tlen Then
      boundRight = n+1
      Exit
    End
  Next
End

If boundLeft &lt;&gt; -1 And boundRight &lt;&gt; -1 Then
  Var isolatedWord As String = Me.Text.Middle(boundLeft, boundRight - boundLeft)
  Var check As pair = wordInDictionary( isolatedWord, boundleft, boundRight )
  If check  &lt;&gt; Nil Then 
    mboundedWord  = check
    If previousBoundedWord = Nil Then previousBoundedWord = mboundedWord
    setStyleForWord(previousBoundedWord, True)
  Else
    mboundedWord = Nil 
  End If
End If

RaiseEvent mouseMove(X, Y)</pre>



<p>This code is in charge of detecting the limits of the word under the cursor and finding if it is one of the active words registered for the class.</p>



<h3 class="wp-block-heading">Reacting to Active Words</h3>



<p>Finally, select the <code>MouseDown</code> Event Handler and write the following code into the associated Code Editor:</p>



<pre class="wp-block-preformatted">If linkedWords &lt;&gt; Nil And boundedWord &lt;&gt; Nil Then
  Var p As New pair(mboundedWord.Left,linkedWords.Value(mboundedWord.Left))
  For Each item As LinkDetectorTextArea.ActionDelegate In observers
    item.Invoke p
  Next
  Return True
End If

Return RaiseEvent mousedown(x,y)</pre>



<p>This code will invoke all the registered Observers for the active word detected under the cursor.</p>



<h3 class="wp-block-heading">Registering the Active Words</h3>



<p>We need a way to inform the instances about the active words to be aware of. We could do that from a Constructor or using a Computed Property. In this case, we will use a method for assigning the received Dictionary of Pairs to the Property in charge of storing that information. Select <code>Insert &gt; Method</code> and use this data in the associated Inspector Panel:</p>



<ul class="wp-block-list"><li><b>Name</b>: setDictionary.</li><li><b>Parameters</b>: d As Dictionary.</li><li><b>Scope</b>: Public.</li></ul>



<p>In the associated Code Editor, put this simple line of code:</p>



<pre class="wp-block-preformatted">linkedWords = d</pre>



<h3 class="wp-block-heading">Registering (and Deregistering) Observers</h3>



<p>As we have said, the class will be able to react to the active words, so we need to provide a couple of methods to register and deregister Observers at any time. Use the following information for the first method:</p>



<ul class="wp-block-list"><li><b>Method Name</b>: registerObserver.</li><li><b>Parameters</b>: observer as ActionDelegate.</li><li><b>Scope</b>: Public.</li></ul>



<p>And write this line of code in the associated Code Editor:</p>



<pre class="wp-block-preformatted">if observer &lt;&gt; nil then observers.add observer</pre>



<p>Add a second method that will be in charge of deregistering an Observer. Use the following data for that:</p>



<ul class="wp-block-list"><li><b>Method Name</b>: deleteObserver.</li><li><b>Parameters</b>: observer As LinkDetectorTextArea.ActionDelegate.</li><li><b>Scope</b>: Public.</li></ul>



<p>This is the code that will search and remove the received <code>ActionDelegate</code> from the instance Array of Observers:</p>



<pre class="wp-block-preformatted">If observer &lt;&gt; Nil Then
  Var n As Integer = observers.IndexOf(observer)
  observers.RemoveAt(n)
end</pre>



<h3 class="wp-block-heading">Regular Expressions to the Rescue …&nbsp;and Styling!</h3>



<p>Finally, add a couple of methods to finish the TextArea subclass. These will be Private for the class, auxiliary methods called mainly from the Event Handlers. The first one is the method that does the matching with the received candidate and upon finding a match, will return the corresponding data pair to the caller. To do this, add a new Method using the following data:</p>



<ul class="wp-block-list"><li><b>Method Name</b>: wordInDictionary.</li><li><b>Parameters</b>: word As string, leftposition As integer, RightPosition As integer.</li><li><b>Return Type</b>: Pair.</li><li><b>Scope</b>: Private.</li></ul>



<p>And write the following code in the associated Code Editor:</p>



<pre class="wp-block-preformatted">#Pragma Unused RightPosition

Var theRightPosition As Integer
Var re As New RegEx
re.SearchPattern = "[a-zA-Z]+"
Var rm As RegExMatch
rm = re.Search(word)

If rm &lt;&gt; Nil Then 
  Var foundword As String = rm.SubExpressionString(0)
  Var characterPosition As Integer = word.LeftBytes(rm.SubExpressionStartB(0)).Length
  word = foundword
  leftposition = leftposition + characterPosition
  therightposition = leftposition + word.Length
End If

If linkedWords.HasKey(word) Then Return New pair(word,leftposition.ToString+"-"+ theRightPosition.ToString)

Var blu As Integer
Var dictionaryKeys() as variant = linkedWords.Keys

for each thekey as string in dictionaryKeys  
  If thekey.IndexOf(word) &lt;&gt; -1 Then
    blu = Me.Text.IndexOf(thekey)
    If leftposition &gt;= blu And leftposition &lt;= (blu + thekey.Length) Then
      Var finalposition As Integer =blu+thekey.Length
      Return New pair(thekey,blu.ToText+"-"+finalposition.ToString)
    end if
  end
next

Return nil</pre>



<h3 class="wp-block-heading">Adding Style</h3>



<p>Finally, we need to choose how to inform the user that the word below the cursor is an active word so they can click on it. For this example, I&#8217;ve used the Underline text style, but you can change that. Add the last method for the class using the following data:</p>



<ul class="wp-block-list"><li><b>Method Name</b>: setStyleForWord</li><li><b>Parameters</b>: word As pair, mode As Boolean.</li><li><b>Scope</b>: Private.</li></ul>



<p>Use the <code>mode</code> parameter in order to use the method to apply or delete the style. For example, removing the style from the previous detected active word and styling the new one. Write the following code in the associated Code Editor:</p>



<pre class="wp-block-preformatted">Var cStart, cEnd As Double
cStart = word.Right.StringValue.NthField("-",1).Val
cEnd = word.Right.StringValue.NthField("-",2).Val - cStart

Var t As StyledText

t = Me.StyledText

cstart = If( cstart - 1 &lt; 0, 0, cstart)

t.Underline(cstart, cEnd) = mode</pre>



<h3 class="wp-block-heading">Putting it all together!</h3>



<p>With the subclass finished it is time to do some Window Layout so we can test the subclass functionality. Select the <code>Window1</code> item in the Navigator to access the Window Layout Editor and drag the <code>LinkDetectorTextArea</code> subclass from the Navigator onto the Window Layout. Use the Inspector to change its name to <code>myURLField</code>. Then add three Label controls and an HTMLViewer, both from the Library. The HTMLViewer will show the URL associated with the active word, while one of the three Label controls will show the detected active words. Both the URL loading as the displaying of the detected word will be done by a previously registered Observer (a window method). The finished window layout should look something like this:</p>



<div class="wp-block-image is-style-default"><figure class="aligncenter"><img loading="lazy" decoding="async" width="1732" height="1420" src="https://blog.xojo.com/wp-content/uploads/2018/07/TextAreaLinkLayout.png" alt="" class="wp-image-4608"/></figure></div>



<p>Where the text under the &#8220;Sample Text&#8221; label is the one assigned to the <code>Text</code> property of the <code>LinkDetectorTextArea</code> instance.</p>



<p>Now, let&#8217;s add to the <code>Window1</code> object the method that will act as an Observer, select the <code>Add &gt; Method</code> option in combination with the following data:</p>



<ul class="wp-block-list"><li><b>Name</b>: updateContents</li><li><b>Parameters</b>: p as pair</li><li><b>Scope</b>: Public</li></ul>



<p>And put the following code in the associated Code Editor:</p>



<pre class="wp-block-preformatted">linkedControl.Text = p.Left
HTMLViewer1.LoadURL p.Right</pre>



<p>Lastly, add the <code>Open</code> event to the <code>Window1</code> window, adding the following code to the associated Code Editor. This will initialize the <code>LinkDetectorTextArea</code> instance providing the clickable words and their associated URLs:</p>



<pre class="wp-block-preformatted">myURLField.setDictionary New Dictionary("Xojo":"https://www.xojo.com","iOS":"http://www.apple.com/ios/",_
"macOS":"http://www.apple.com/osx/", "Windows":"https://www.microsoft.com/en-US/windows","Linux":"https://es.wikipedia.org/wiki/GNU/Linux",_
"Raspberry Pi":"https://www.raspberrypi.org/","AprendeXojo":"https://www.aprendexojo.com","Web":"https://www.xojo.com/web")

myURLField.registerObserver WeakAddressOf updateContents</pre>



<p>Run the project, move the cursor over the text and you will see the how the active words are underlined on the fly; and if you click on any of them, the Window will display the detected word, while loading the associated URL.</p>



<p>Of course, this can be vastly improved and expanded upon … enjoy!</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>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Xojo and Windows 11</title>
		<link>https://blog.xojo.com/2021/06/24/xojo-and-windows-11/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Thu, 24 Jun 2021 22:04:34 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[Windows 11]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=8713</guid>

					<description><![CDATA[We are excited about Microsoft's announcement regarding Windows 11. A large portion of Xojo users develop on and/or for Windows. The new UI looks fantastic and will be a welcome upgrade for Windows users. Xojo and apps written in Xojo will run without modification on Windows 11.]]></description>
										<content:encoded><![CDATA[
<p>We are excited about Microsoft&#8217;s announcement regarding Windows 11. A large portion of Xojo users develop on and/or for Windows. The new UI looks fantastic and will be a welcome upgrade for Windows users. Xojo and apps written in Xojo will run without modification on Windows 11.<br><br>How will the new UI in Windows 11 affect apps written in Xojo? Historically Microsoft has had many different API sets for providing the user experience on Windows ranging from Win32 to .NET to WPF. Earlier this year Microsoft announced that WinUI 3.0 will bring all of these together allowing for a unified look and feel and user experience regardless of which API is being used under the hood. Microsoft plans to finalize WinUI 3.0 by the end of this year. Once they do, we can begin planning to update the Xojo Windows framework to support it.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="600" height="409" src="https://blog.xojo.com/wp-content/uploads/2021/06/Windows11Controls.png" alt="" class="wp-image-8716" srcset="https://blog.xojo.com/wp-content/uploads/2021/06/Windows11Controls.png 600w, https://blog.xojo.com/wp-content/uploads/2021/06/Windows11Controls-300x205.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /><figcaption>Windows 11 UI Controls, Image Credit: Microsoft</figcaption></figure></div>



<p>The first beta of Windows 11 is scheduled to be released next week and we will be testing the Xojo Windows framework on it. We will have more blog posts as more information becomes available about the next generation of Windows.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Using Gravatar in Web, Desktop &#038; iOS Applications</title>
		<link>https://blog.xojo.com/2021/03/15/using-gravatar-in-web-desktop-ios-applications/</link>
		
		<dc:creator><![CDATA[Wayne Golding]]></dc:creator>
		<pubDate>Mon, 15 Mar 2021 10:00:00 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Gravatar]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=7902</guid>

					<description><![CDATA[Learn to build a reusable Gravatar Connection class for web, desktop and iOS apps using the Gravatar API.]]></description>
										<content:encoded><![CDATA[
<p>Your Gravatar is an image and public profile that follows you from site to site, appearing beside your name when you do things like comment or post. Gravatars help identify your posts on blogs and web forums, so why not a web application?</p>



<p>It turns out that adding Gravatars to your application is very simple using the Gravatar API.*</p>



<h3 class="wp-block-heading">Build a Reusable Gravatar Connection</h3>



<p>First, create a new project in Xojo. You can choose any type of project and there are examples available on my <a href="https://github.com/axisdirectnz/Gravatar">GitHub</a> for Desktop, Web and iOS projects.</p>



<p>Click on the Insert button and select Class to add a new class to your project. Call the class “GravatarConnection” and make its super URLConnection.</p>



<p>Next, add a private function to generate the hash required to lookup a Gravatar:</p>



<pre class="wp-block-code"><code>Private Function GenerateGravatarHash(email As String) As String
      // Generate Gravatar Hash
      Var hash As String = Crypto.Hash(email.Lowercase.Trim, Crypto.HashAlgorithms.MD5)
      hash = EncodeHex(hash).Lowercase
      
      Return hash
      
    End Function
</code></pre>



<p>As you can see, this function takes the email address, creates an MD5 checksum, encodes that checksum as hex converting it to a lower case string and returning it to the calling method.</p>



<p>Now add a method to get the Profile Data:</p>



<pre class="wp-block-code"><code>Public Sub GetProfile(email As String)
  Me.ClearRequestHeaders
  Me.RequestHeader("User-Agent") = "*"
  Send("GET", "HTTPS://www.gravatar.com/" + GenerateGravatarHash(email) + ".json")
End Sub
</code></pre>



<p>Again, this method takes the email address and requests the profile in JSON format from&nbsp;<a href="http://www.gravatar.com/">www.gravatar.com</a>.</p>



<p>Next we’ll add three event definitions:</p>



<pre class="wp-block-code"><code>Event Avatar(Value As Picture)
Event Found(FullName As String, Location As String, AvatarURL As String)
Event NotFound()
</code></pre>



<p>These events will be raised based on the result of our request.</p>



<p>Now we need to handle the ContentReceived Event with:</p>



<pre class="wp-block-code"><code>Sub ContentReceived(URL As String, HTTPStatus As Integer, content As String) Handles ContentReceived
  If HTTPStatus = 404 Then
    RaiseEvent NotFound
    Return
  End If
  
  If URL.BeginsWith("HTTPS://www.gravatar.com/avatar/") Then
    Var pic As Picture = Picture.FromData(content)
    RaiseEvent Avatar(pic)
  Else
    Var d As Dictionary = ParseJSON(content)
    Var v() As Variant = d.value("entry")
    Var entry As Dictionary = v(0)
    Var names As Dictionary = entry.Value("name")
    v = entry.Value("photos")
    Var Avatar As Dictionary = v(0)
    RaiseEvent Found(names.Lookup("formatted", ""), entry.Lookup("currentLocation", ""), _
      Avatar.Lookup("value", ""))
  End If
End Sub</code></pre>



<p>Here we either raise the NotFound event or either the Gravatar or Found events, depending on the URL.</p>



<p>This class is freely available at <a href="https://github.com/axisdirectnz/Gravatar">https://github.com/axisdirectnz/Gravatar</a> and there are example projects for Desktop, Web &amp; iOS that show how to use the class.</p>



<h3 class="wp-block-heading">*UPDATE  3/22/21 &#8211; Per community feedback,  this post has been updated.  </h3>



<p>Thanks Jeannot and Thom! I would recommend anyone who has downloaded from Git before March  22, 2021, to do so again.</p>



<p><em>Wayne Golding has been a Xojo developer since 2005 and is a Xojo MVP. He operates the IT Company <a href="http://www.axisdirect.nz">Axis Direct Ltd </a>which primarily develops applications using Xojo that integrate with Xero www.xero.com. Wayne’s hobby is robotics where he uses Xojo to build applications for his Raspberry Pi, often implementing IoT for remote control.</em></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Yes Facebook, you can be Native AND Cross-Platform</title>
		<link>https://blog.xojo.com/2020/03/03/yes-facebook-you-can-be-native-and-cross-platform/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Tue, 03 Mar 2020 20:46:08 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[LLVM]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<category><![CDATA[Native App Development]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=6677</guid>

					<description><![CDATA[At Xojo we did the hard work of creating a framework with an API that manages the nuances, intricacies, and subtle yet important differences between 7 different platforms (macOS, Windows, Linux, web, Raspberry Pi, iOS and soon, Android) so you can focus on what makes your application unique. We have been doing it for over 20 years.]]></description>
										<content:encoded><![CDATA[
<p>In a recent <a href="https://engineering.fb.com/data-infrastructure/messenger/">blogpost</a>, the Facebook engineering team talked about finally arriving at the conclusion that Messenger needed to be a native app. While I&#8217;m glad they are seeing the light, they have reached the wrong conclusion about the trade-offs that come with being native. They believe you cannot develop in a cross-platform way and deliver a native app. </p>



<p>You absolutely <strong>can</strong>. Xojo creates native apps that are also cross-platform. It <strong>can</strong> be done. It&#8217;s just a matter of choosing the right framework. At Xojo, we didn&#8217;t take the easy path of drawing controls ourselves or using HTML5. We didn&#8217;t dumb things down to the least common denominator. We did the hard work of creating a framework with an API that manages the nuances, intricacies, and subtle yet important differences between 7 different platforms (macOS, Windows, Linux, web, Raspberry Pi, iOS and soon, Android) and multiple OS versions so you can focus on what makes your application unique. We have been doing it for over 20 years.</p>



<p>When discussing Facebook&#8217;s blog post, John Gruber of <a href="https://daringfireball.net/linked/2020/03/02/facebook-messenger-native">Daringfireball.net</a> said, &#8220;&#8230;native apps are smaller, faster, and more reliable.&#8221;</p>



<p>Nearly every user interface element in Xojo is native. The one exception is the desktop Listbox because way back when, none of the desktop operating systems provided one. Everyone made their own. Having said that, the Listbox is made up of native controls. The scrollbar is a native scrollbar. If the developer makes the contents editable by their end user, a native TextField control appears. The headers are native controls. The advantages of native controls can&#8217;t be overstated, Facebook was right about that. Modern operating systems provide an ever-increasing array of features via their native controls and thus using them gives you immediate and nearly free access to these features. From focus rings to spellchecking to accessibility and more much, using native controls makes the most sense.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="98" src="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.49.35-AM-1024x98.png" alt="" class="wp-image-6685" srcset="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.49.35-AM-1024x98.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.49.35-AM-300x29.png 300w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.49.35-AM-768x74.png 768w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.49.35-AM.png 1084w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>Focus rings, spellchecking (and auto-correct) on macOS</figcaption></figure>



<p>Event aesthetics come into play. Because the Xojo framework uses native controls, when Apple and Microsoft make changes to the look and feel of their controls, apps made in Xojo automatically change in appearance and behavior. Most recently, Apple added Dark Mode to both macOS and iOS and for most Xojo developers, adding this support required nothing more than indicating they wanted their apps to support it by clicking a checkbox.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="210" src="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.21-AM-1024x210.png" alt="" class="wp-image-6686" srcset="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.21-AM-1024x210.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.21-AM-300x62.png 300w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.21-AM-768x158.png 768w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.21-AM.png 1080w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></div>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="208" src="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.57-AM-1024x208.png" alt="" class="wp-image-6687" srcset="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.57-AM-1024x208.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.57-AM-300x61.png 300w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.57-AM-768x156.png 768w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-11.53.57-AM.png 1092w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>While Xojo provides the developer with an easy drag-and-drop way to create their application&#8217;s user interface, it also provides a straightforward API for interacting with controls via code. The TextField control, for example, provides events that tell you when the control has appeared for the first time, when the user has changed the selection or the text itself, and even when they press down on a key or release it. There are properties to change the size, style and behavior of controls. And all of this is a level of abstraction that lets you focus not on the details of the platform but on what makes your application unique.</p>



<figure class="wp-block-gallery aligncenter columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img loading="lazy" decoding="async" width="1024" height="211" src="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-1.09.24-PM-1024x211.png" alt="" data-id="6692" data-full-url="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-1.09.24-PM.png" data-link="https://blog.xojo.com/?attachment_id=6692" class="wp-image-6692" srcset="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-1.09.24-PM-1024x211.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-1.09.24-PM-300x62.png 300w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-1.09.24-PM-768x158.png 768w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-1.09.24-PM.png 1076w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></li></ul><figcaption class="blocks-gallery-caption">Windows</figcaption></figure>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-12.33.57-PM-1-1024x246.png" alt="" class="wp-image-6694" width="610" height="146" srcset="https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-12.33.57-PM-1-1024x246.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-12.33.57-PM-1-300x72.png 300w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-12.33.57-PM-1-768x184.png 768w, https://blog.xojo.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-03-at-12.33.57-PM-1.png 1076w" sizes="auto, (max-width: 610px) 100vw, 610px" /><figcaption>Linux</figcaption></figure></div>



<p>For example, under the hood for the desktop, Xojo&#8217;s TextField uses NSTextField on macOS, EditControl on Windows and GTKEntry on Linux. On iOS it&#8217;s the UITextField, on Android it&#8217;s EditText and on the web it&#8217;s &lt;input type=&#8221;text&#8221;&gt;. Each of these is very different but Xojo has done the hard work to provide a standard, straight-forward API so that you get the benefit of native controls without needing to learn the thousands of APIs and unique behaviors necessary to create a cross-platform app.</p>



<figure class="wp-block-gallery columns-2 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img loading="lazy" decoding="async" width="473" height="1024" src="https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0819-1-473x1024.png" alt="" data-id="6690" data-full-url="https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0819-1.png" data-link="https://blog.xojo.com/?attachment_id=6690" class="wp-image-6690" srcset="https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0819-1-473x1024.png 473w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0819-1-139x300.png 139w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0819-1-768x1663.png 768w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0819-1-709x1536.png 709w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0819-1-946x2048.png 946w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0819-1.png 1125w" sizes="auto, (max-width: 473px) 100vw, 473px" /></figure></li><li class="blocks-gallery-item"><figure><img loading="lazy" decoding="async" width="473" height="1024" src="https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0820-1-473x1024.png" alt="" data-id="6691" data-full-url="https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0820-1.png" data-link="https://blog.xojo.com/?attachment_id=6691" class="wp-image-6691" srcset="https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0820-1-473x1024.png 473w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0820-1-139x300.png 139w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0820-1-768x1663.png 768w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0820-1-709x1536.png 709w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0820-1-946x2048.png 946w, https://blog.xojo.com/wp-content/uploads/2020/03/IMG_0820-1.png 1125w" sizes="auto, (max-width: 473px) 100vw, 473px" /></figure></li></ul><figcaption class="blocks-gallery-caption">An iOS app made in Xojo in light and dark modes</figcaption></figure>



<p>It&#8217;s not just controls. The Xojo cross-platform framework includes dialog boxes, menus, access to the file system, printing, sockets, database access and much more.</p>



<p>Native is more than the user interface. It&#8217;s also about performance. Xojo compiles to native code for each platform as well. Behind the scenes it uses <a href="https://www.llvm.org">LLVM</a>, the same optimizing compiler that Apple, Google, Intel, AMD, Nvidia and many others use. Native code means native speed.</p>



<p>Thousands upon thousands of Xojo users have built cross-platform apps. The Xojo IDE itself and much of the Xojo framework are written in Xojo. So yes, we eat our own dog food. <a href="https://www.oranged.net">Studiometry</a> and <a href="https://www.propertyme.com.au">Property Me</a> are just two of the many examples of commercial cross-platform apps written in Xojo. There are countless others.</p>



<p>We have also done this in a way that makes it easy for students and hobbyists to learn programming so they can take it into their workplaces and build business applications. In some cases, those citizen developers create something revolutionary and become full-time professional developers. That&#8217;s why the Xojo user community is so diverse.</p>



<p><strong>So yes, you can create native applications that are also cross-platform.</strong> You just have to choose the right tool.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Your Path Forward with API 2.0</title>
		<link>https://blog.xojo.com/2019/10/29/your-path-forward-with-api-2-0/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Tue, 29 Oct 2019 20:50:22 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Xojo API 2.0]]></category>
		<category><![CDATA[Xojo IDE]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=6184</guid>

					<description><![CDATA[You might be assuming you absolutely must upgrade to API 2.0 right now, but that’s not the case.  We have designed it so that you have tremendous flexibility in terms of what and when and even if you move to API 2.0.]]></description>
										<content:encoded><![CDATA[
<p>For anything to be easy to learn and use, it needs to be as intuitive and consistent as possible. Over the past 20+ years, many APIs in Xojo have been added that were not intuitive or consistent. While longtime users have gotten used to them, they can make Xojo difficult to adopt for new users. API 2.0 is our solution.</p>



<p>We did this by creating a sensible set of API naming guidelines and then applying them to our existing APIs. APIs that followed the guidelines were left alone. Those that did not, were changed to meet them. Hindsight, as they say, is 20/20. Looking back, it would have been great had we established these guidelines way back in 1998 before we shipped v1.0 but we didn&#8217;t and the fact that we didn&#8217;t is no reason to avoid it now. We always plan for a long future ahead of us and thus have to be willing to make changes to make that future possible. That we are still here 20+ years later suggests we are doing something right.</p>



<p>If you are one of those long time users who has grown accustomed to the inconstancies that API 2.0 addresses, you might be wondering if there&#8217;s any value for you in using it. The answer is absolutely yes! While it will take a little time for you to get used to the new APIs, what you will find is that you become increasingly more productive because they are so consistent. You will find (as I did) that you can guess at what the API is and likely be correct. I personally made 95% of the Language Reference updates for API 2.0. The documentation wiki does not auto-complete so I had to double-check all the code I was updating. In no time I found that I rarely made errors because API 2.0 is so consistent. You will absolutely see productivity gains once you have used it for a short time.</p>



<p>While API 2.0 is a major step forward for Xojo in terms of intuitiveness and consistency, for those of you with large projects you may feel like migrating is a daunting task. Depending on size, there can be anywhere from a handful to thousands of deprecation warnings to deal with, each being a particular change that could be made.</p>



<p>You might be assuming you absolutely must upgrade your projects but that’s not necessarily the case. How much of a project you update and when depends significantly on how important it is for you to update your existing projects to API 2.0. </p>



<p>First, it’s important to understand that most of the deprecated APIs are going be around for a very long time. It’s possible (perhaps even likely) that they could continue to exist for the entire life of your software project. You could decide not to upgrade any portion of your project or only upgrade portions that require it and then only when necessary.</p>



<p>Many deprecated APIs still share their implementation with the API they replace. A good example is RecordSet.MoveNext and RowSet.MoveToNextRow. If a bug is fixed in MoveToNextRow it will also likely be fixed automatically in RecordSet.MoveNext even though that method is deprecated.</p>



<p>Should you find a bug in a deprecated API you are still using, first try the new, replacement API and see if the bug is no longer reproducible. If that’s the case, you have an immediate solution: just upgrade that one usage of the deprecated class to the new one.</p>



<p>If the bug still exists in the new, replacement class, please report the bug using <a href="https://www.xojo.com/download/extras.php">Feedback</a>. Once fixed, there’s a chance that it will be fixed in the deprecated class as well, assuming it still shares its underlying implementation with the old deprecated class which, again, is true in many cases.</p>



<p>When deciding what to do regarding API 2.0 and any particular project, your options are:</p>



<ol class="wp-block-list"><li><strong>Not Upgrading</strong> &#8211; You could choose not to upgrade an existing project to API 2.0. You could then only upgrade portions of it should that become necessary due to a bug fix or the introduction of new features.</li><li><strong>Upgrade Incrementally</strong> &#8211; Another option is to upgrade your code incrementally as an extra step before refactoring or adding new code to a particular part of a project. This is the path we have chosen for the Xojo IDE as it’s a very large project that would take many months to upgrade if we did it all at once.</li><li><strong>Upgrade All At Once</strong> &#8211; Finally, you may decide to go ahead and upgrade your entire project all at once. This has the advantage of allowing you to focus exclusively on the new APIs and no longer have to switch between the old and the new when going back and forth between older projects and newer ones.</li></ol>



<p>If you’re choosing not to upgrade an older project or do so incrementally and you find seeing the deprecation warnings distracting when you use the Analyze Project feature, you can turn off these warnings by choosing Project &gt; Analysis Warnings.</p>



<p>API 2.0 was introduced with desktop projects but it will be coming to web projects in Web Framework 2.0, for mobile in Android and eventually iOS as well. As a result it will be important to use the new APIs but for many of you, using them only with new projects and/or sporadically with older projects, may make sense.</p>



<p>API 2.0 is a huge change and change can often be difficult. There&#8217;s certainly a lot of comfort to be found in the familiar. Still change is sometimes necessary to keep things moving forward. Fortunately, in the case of API 2.0, we have designed it so that you have tremendous flexibility in terms of what options you choose for existing projects. </p>



<ul class="wp-block-list"><li>Read <a href="https://blog.xojo.com/tag/api-2-0/">more blog posts</a> about this transition.</li><li><a href="UserGuide: Moving Forward with API 2.0
">UserGuide: Moving Forward with API 2.0</a></li><li><a href="UserGuide: API 2 Guidelines">UserGuide: API 2 Guidelines</a></li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Converting Code to API 2.0</title>
		<link>https://blog.xojo.com/2019/10/29/converting-code-to-api-2-0/</link>
		
		<dc:creator><![CDATA[Xojo]]></dc:creator>
		<pubDate>Tue, 29 Oct 2019 17:29:50 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[2019r2]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Xojo API 2.0]]></category>
		<category><![CDATA[Xojo IDE]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=6175</guid>

					<description><![CDATA[2019r2 has many changes related to API 2.0. Most of your projects should open and run without any changes. You can then switch code to API 2.0 when you want (or not at all -- it's up to you). ]]></description>
										<content:encoded><![CDATA[
<p>Xojo 2019r2 has many changes related to API 2.0. Most of your projects should open and run without any changes. You can then switch code to API 2.0 when you want (or not at all &#8212; it&#8217;s up to you). </p>



<h3 class="wp-block-heading">General Tips</h3>



<p>With that said, here are a few things that you may have to update to be able to run your project using 2019r2 and later Xojo releases:</p>



<ul class="wp-block-list"><li>Some advanced properties on FolderItem have been removed.</li><li> You&#8217;ll have to use the Global prefix with the ToolTip class (or switch to new methods).</li><li> You&#8217;ll have to add the new EndOfFile method to anything that uses the Readable interface.</li></ul>



<h3 class="wp-block-heading">Converting Code to Use a New Class</h3>



<p>When converting code to use a new class that replaces a deprecated one, there are two different approaches that will help you do so efficiently.</p>



<h4 class="wp-block-heading">Method 1: <strong>Not Familiar with the New Class</strong></h4>



<p>When you’re not familiar with the new class, replace class members such as properties and methods first, before replacing the class declaration itself. This will allow you to use <a href="https://documentation.xojo.com/getting_started/using_the_ide/code_editor.html#Auto-Complete">auto-complete</a> to see which methods or properties replace the deprecated ones.</p>



<p>Consider the following code example:</p>



<pre class="wp-block-preformatted">Dim rs as RecordSet
rs =db.SQLSelect(“SELECT * FROM Customers”)
If rs &lt;&gt; nil then
While Not rs.EOF
//perform some data processing
&nbsp; rs.MoveNext
Wend
End If</pre>



<p>Deleting EOF and then pressing tab will display the auto-complete menu showing the replacement method, AfterLastRow:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="964" height="702" src="https://blog.xojo.com/wp-content/uploads/2019/10/Screen-Shot-2019-10-25-at-3.06.08-PM.png" alt="" class="wp-image-6181" srcset="https://blog.xojo.com/wp-content/uploads/2019/10/Screen-Shot-2019-10-25-at-3.06.08-PM.png 964w, https://blog.xojo.com/wp-content/uploads/2019/10/Screen-Shot-2019-10-25-at-3.06.08-PM-300x218.png 300w, https://blog.xojo.com/wp-content/uploads/2019/10/Screen-Shot-2019-10-25-at-3.06.08-PM-768x559.png 768w" sizes="auto, (max-width: 964px) 100vw, 964px" /></figure>



<p>Auto-complete will not replace EOF with AfterLastRow as the variable rs is still a RecordSet. However, you can manually make the change now. Once you have changed all class member references, you can then change the variable itself from RecordSet to RowSet.</p>



<h4 class="wp-block-heading">Method 2: <strong>Familiar with the New Class</strong></h4>



<p>If you are familiar with the new class, change the variable (rs in this case). Having done so, you can use auto-complete to change any class members references (properties, methods, etc.) to the new class.</p>



<p>In the beginning the changes in API 2.0 will be unfamiliar so Method 1 above will make sense. Over time you&#8217;ll be more familiar with API 2.0 and then Method 2 will work best. <em>The important thing is to remember that you can do this at your own pace. The APIs that have been replaced will continue to be available for a very long time.</em></p>



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



<p>These changes and more are described in detail in the <a href="https://documentation.xojo.com/UserGuide:API_2.0_Guidelines">API 2.0 Guidelines</a> topic in the docs. Be sure to give it a quick read to more easily get up and running with 2019r2. For other guidance on moving projects to API 2.0 to take advantage of newer features and improved naming (again, when you&#8217;re ready), be sure to read <a href="https://documentation.xojo.com/topics/api_design/moving_to_api_2.0.html">Moving to API 2.0</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Use Doc Categories to Find Information Fast</title>
		<link>https://blog.xojo.com/2019/10/09/use-doc-categories-to-find-information-fast/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 09 Oct 2019 16:44:52 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[2019r2]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Xojo API 2.0]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=6110</guid>

					<description><![CDATA[The Xojo Doc site has several thousand pages of information. To make it easier to quickly find things in the online docs, topics are categorized. You can find categories that a topic belongs to at the bottom of its page. ]]></description>
										<content:encoded><![CDATA[
<p>The <a href="https://documentation.xojo.com">Xojo Doc site</a> has several thousand pages of information. To make it easier to quickly find things in the online docs, topics are categorized. You can find categories that a topic belongs to at the bottom of its page. Here are several useful categories to start with.</p>



<h3 class="wp-block-heading">API 2.0</h3>



<p>You can use this category to show all API 2.0 items across all releases, which is quite useful with the release of 2019r2:</p>



<p><a href="https://documentation.xojo.com/Category:API_2.0">https://documentation.xojo.com/Category:API_2.0</a></p>



<h3 class="wp-block-heading">All Deprecated</h3>



<p>Use this category to show all deprecated items across all releases:</p>



<p><a href="https://documentation.xojo.com/Category:Deprecated">https://documentation.xojo.com/Category:Deprecated</a></p>



<h3 class="wp-block-heading">All Deprecated for a single release</h3>



<p>This category to shows all deprecated items for a specific release:</p>



<p><a href="https://documentation.xojo.com/Category:Deprecated2019r2">https://documentation.xojo.com/Category:Deprecated2019r2</a></p>



<p>Change the release value to see other releases.</p>



<h3 class="wp-block-heading">All New for a single release</h3>



<p>Use this category to show all new items for a specific release:</p>



<p><a href="https://documentation.xojo.com/Category:New2019r2">https://documentation.xojo.com/Category:New2019r2</a></p>



<p>Change the release value to see other releases.</p>



<h3 class="wp-block-heading">Show All User Guide topics</h3>



<p>This category displays all pages that are part of the User Guide:</p>



<p><a href="https://documentation.xojo.com/Category:User_Guide">https://documentation.xojo.com/Category:User_Guide</a></p>



<h3 class="wp-block-heading">Show All Categories</h3>



<p>There are many more categories. You can use this link to see them all:</p>



<p><a href="https://documentation.xojo.com/Special:Categories">https://documentation.xojo.com/Special:Categories</a></p>



<p>Or as mentioned earlier, at the bottom of each topic page you can view the list of categories to which it belongs. Jumping to other categories can help you find other related information for quickly.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Guest Post: Adding Language Translation to Your Xojo Apps</title>
		<link>https://blog.xojo.com/2019/05/13/guest-post-adding-language-translation-to-your-xojo-apps/</link>
		
		<dc:creator><![CDATA[Tim Dietrich]]></dc:creator>
		<pubDate>Mon, 13 May 2019 10:00:17 +0000</pubDate>
				<category><![CDATA[Guest Post]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[App Localization]]></category>
		<category><![CDATA[CURL]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Middleware]]></category>
		<category><![CDATA[Monkeybread Software]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Translation]]></category>
		<category><![CDATA[Web Service]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=5735</guid>

					<description><![CDATA[I've been amazed at the speed and accuracy of the Amazon Translate service. And after developing the AWSTranslator class, I was able to quickly and easily add language translation to my client's middleware app.]]></description>
										<content:encoded><![CDATA[<p>Recently, I was asked by a client if it would be possible to build language translation functionality into a Xojo-based middleware solution that I had developed for them. The Xojo app obtains product information (including product names, descriptions, and other marketing-related information) from suppliers via a SOAP call, and returns the data in a JSON-encoded response. They wanted to be able to translate the product information, which is provided in English, to other languages (such as French, German, etc). The client wanted something similar to <a href="https://translate.google.com/">Google Translate</a>. However, they wanted the translation function to be built directly into the app and to be performed &#8220;on demand.&#8221;</p>
<p>I did some research and found that Amazon provides a service that does exactly what the client was asking for. The service, called <a href="https://aws.amazon.com/translate/">Amazon Translate</a>, is available as one of many services that are available through Amazon Web Services.</p>
<p>In this post, I&#8217;ll walk you through the process of getting signed up for Amazon Translate, and then share some code that you can use to add language translation to your own Xojo projects. We&#8217;ll use the MBS Xojo CURL Plugin, which makes calling the Amazon Translate API easy. But first, let&#8217;s learn a little about Amazon Translate.</p>
<p><span id="more-5735"></span></p>
<h3><b>Amazon Translate</b></h3>
<p>Amazon Translate is an API that can be used to translate text on demand. You send it text in a &#8220;source language,&#8221; tell the API what that source language is, as well as the &#8220;target language&#8221; that you want the text translated to. The API responds with the translated text.</p>
<p>Amazon Translate uses machine learning and neural networks that have been designed specifically for language translation. When performing a translation, the service reads the text one sentence at a time, and reads each word individually, to determine the meaning of a sentence. In other words, the service doesn&#8217;t just translate words. Instead, it&#8217;s acting as an interpreter. This results in translations that are extremely accurate.</p>
<p>In order to use Amazon Translate, you&#8217;ll need an <a href="http://aws.amazon.com/">AWS account</a>. If you already have an AWS account, log into the account.</p>
<p>Next, you&#8217;ll need to create an &#8220;Identity and Access Management&#8221; (IAM) user. To do so, under Services, select &#8220;IAM&#8221; (which can be found in the &#8220;Security, Identity, &amp; Compliance&#8221; category). This will present you with the IAM Dashboard.</p>
<p>Under Groups, create a new group and give it a recognizable name. For example, you might call the group &#8220;translate.&#8221; As you are creating the group, give it the &#8220;TranslateFullAccess&#8221; permission.</p>
<p>Next, create an IAM user. Under Users, click the &#8220;Add user&#8221; button. Give the user a name such as &#8220;XojoTranslater.&#8221; For the &#8220;AWS access type&#8221; be sure to select &#8220;Programmatic access.&#8221; Add the user to the &#8220;translate&#8221; group that you created above. There&#8217;s no need to assign any tags to the user, so you can skip that step.</p>
<p>And finally, create an Access key for the user. Be sure to make note of both the &#8220;Access key ID&#8221; and &#8220;Secret access key&#8221; values that are automatically assigned. You&#8217;ll need these in order to make API calls.</p>
<h3><b>The MBS Xojo CURL Plugin</b></h3>
<p>If you don&#8217;t already have the <a href="https://www.monkeybreadsoftware.de/xojo/plugin-curl.shtml">MBS Xojo CURL Plugin</a>, download it and install it. To install the plugin, simply drag it into the Xojo &#8220;Plugins&#8221; folder.</p>
<p>The project will work with an unlicensed version of the MBS Xojo CURL Plugin. In this case, you&#8217;ll occasionally see a popup message reminding you to purchase a license. However, I highly encourage you to purchase a license. You can license the plugin individually, or as part of the MBS Complete plugin bundle.</p>
<h3><b>The Xojo Example Project</b></h3>
<p>To demonstrate the Amazon Translate service, I&#8217;ve put together an example Xojo desktop project (<a href="https://s3.amazonaws.com/tdietrich-opensource/aws-translate-demo.xojo_binary_project.zip">project file</a>). Before running the application, be sure to set the three App-level properties: AWSAccessKeyId, AWSSecretAccessKey, and the AWSRegion. For the AWSAccessKeyId and AWSSecretAccessKey properties, use the values that you set when you created the Access key for the user. For the AWSRegion, refer to <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html">this</a> and use the value that makes the most sense for you.</p>
<p>Once you&#8217;ve configured the app, run it, and it will look something like this.</p>
<p> </p>
<h3><b>The Xojo Code</b></h3>
<p>Let&#8217;s take a look at some of the code.</p>
<p>The AWSTranslator class is a subclass of the CURLSMBS class. The class does two important things: It provides access to a list of the languages that are supported, and provides a method for calling the Amazon Translate API.</p>
<p>The &#8220;Languages&#8221; property is a dictionary that you can use to get the names of the languages that Amazon Translate supports and the corresponding language codes. The example app uses this dictionary to populate the &#8220;Translate From&#8221; (SourcePopupMenu) and &#8220;Translate To&#8221; (TargetPopupMenu) popup menus.</p>
<p>The Translate method creates the payload that gets sent to the Amazon Translate API, and sets special HTTP headers that are needed in order to call the API. But most importantly, it uses the CURLSMBS class&#8217;s &#8220;SetupAWS&#8221; method to configure the CURL instance so that all of the steps that are required to &#8220;sign&#8221; the API request are done automatically. This is an amazingly convenient function of the MBS Xojo CURL Plugin. You can get a sense of what&#8217;s involved in signing the request <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">here</a>.</p>
<p>To translate text using the AWSTranslator class, you create an instance, configure it with your IAM credentials and AWS region, pass it the source language text, the source language code, and the target language code. In the example app, this all handled in the Window1.Translate method. The values are pulled from the App-level properties, as well as the various window controls. Finally, you call the AWSTranslator instance&#8217;s Translate method. If the translation is successful, the translated text will be available via the TranslatedText property. If any errors occur, the ErrorType and ErrorMessage properties will be set.</p>
<p>The &#8220;Estimated Translation Cost&#8221; is calculated whenever the Source Text changes. The value is calculated by taking the length (number of characters) of the Source Text and multiplying it by 0.000015 (the average cost for translating a single character).</p>
<h3><b>Wrapping Up</b></h3>
<p>I&#8217;ve been amazed at the speed and accuracy of the Amazon Translate service. And after developing the AWSTranslator class, I was able to quickly and easily add language translation to my client&#8217;s middleware app.</p>
<p>I hope you&#8217;re equally impressed by the Amazon Translate service, and that you find the AWSTranslator class to be helpful in your own Xojo projects.</p>
<p><i>Tim Dietrich is a custom software developer based in Richmond, Virginia. To learn more, visit: <a href="https://timdietrich.me/" target="_blank" rel="noopener noreferrer" data-saferedirecturl="https://www.google.com/url?q=https://timdietrich.me&amp;source=gmail&amp;ust=1552488320387000&amp;usg=AFQjCNEDiwUxo_XLnpKX-Bt3nL8FIQTxZA">https://timdietrich.me</a></i></p>


<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="711" src="https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM-1024x711.png" alt="" class="wp-image-5753" srcset="https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM-1024x711.png 1024w, https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM-300x208.png 300w, https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM-768x533.png 768w, https://blog.xojo.com/wp-content/uploads/2019/05/Screen-Shot-2019-04-01-at-4.21.01-PM.png 1532w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>XDC 2019 Keynote Recap</title>
		<link>https://blog.xojo.com/2019/05/01/xdc-2019-keynote-recap/</link>
		
		<dc:creator><![CDATA[Alyssa Foley]]></dc:creator>
		<pubDate>Wed, 01 May 2019 13:48:02 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[XDC]]></category>
		<category><![CDATA[64-bit]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Declares]]></category>
		<category><![CDATA[Interops]]></category>
		<category><![CDATA[Keynote]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=5691</guid>

					<description><![CDATA[Geoff just wrapped up the keynote here in sunny Miami, Florida. We've made significant progress towards these many large, multiyear projects. ]]></description>
										<content:encoded><![CDATA[<p>Geoff just wrapped up the keynote here in sunny, windy Miami, Florida.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-5733" src="https://blog.xojo.com/wp-content/uploads/2019/05/IMG_20190501_090424.jpg" alt="" width="631" height="473"></p>
<p>After a brief introduction welcoming attendees from 11 different countries, Geoff began the keynote by sharing some graphs showing how the Xojo community has been changing.</p>
<p><span id="more-5691"></span></p>
<p>Along with a growing interest in Xojo, account creation is up 200%, we&#8217;ve seen a change in the demographics of our users. In 2017 only 22% of Xojo users were women.&nbsp;This year, that number has nearly doubled to 41%!</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-5701" src="https://blog.xojo.com/wp-content/uploads/2019/04/Gender-1.gif" alt="" width="480" height="360"></p>
<p>A few years ago, just under half of Xojo users were under 35.&nbsp;Now in 2019, 61% of our users are under 35.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-5702" src="https://blog.xojo.com/wp-content/uploads/2019/04/Age.gif" alt="" width="480" height="360"></p>
<p>This broader change is partially the result of current Xojo community members who evangelize Xojo on social media, blogs or simply in speaking with friends and colleagues. We know that word of mouth recommendations always carry more weight than any advertisement. Geoff took some time to recognize a few members of the Xojo community that have gone the extra mile to build this community. Hal Gumbert and Tim Dietrich, both Xojo developers from the FileMaker community, regularly blog and share on social media their experiences with Xojo. Also thanks is due to Thomas Templemann whose rally cry on the forum encouraged users to review Xojo on slant.co. What may appear to be small single actions all add up to make a difference. The stronger our community is, the better Xojo will be.</p>
<p>Next Geoff announced the winners of the <a href="https://blog.xojo.com/2019/05/01/2019-xojo-design-award-winners/"><strong>Xojo </strong><strong>Design</strong><strong> Awards 2019</strong></a>, learn more&nbsp;more about these stellar examples of what has been done with Xojo!</p>
<p>Our team has been very busy over the last 12 months. Xojo has introduced 48 new features, made 75 changes and fixed 465 bugs. To name a few: we added Dark Mode for macOS, native labels in Windows, iOS Table pull to refresh and variable row heights, better text rendering on Windows, URLConnection in API 2.0, incremental compilation for 64-bit and ARM and significantly sped up the <a href="https://blog.xojo.com/2019/04/09/speeding-up-the-layout-editor/">layout editor</a>.</p>
<p>But we&#8217;ve also spent a lot of time working on some big, multiyear features so let&#8217;s take a look at where Xojo is going.</p>
<h3>Xojo Cloud</h3>
<p>Xojo Cloud is moving to 64-bit because the modern Linux distros are all 64-bit. Going forward, Named Hosts will allow you to point a domain at a specific app.&nbsp;We will be switching from CGIs to stand-alone apps to utilize modern web protocols and we are putting a load balancer in front of each app so you can easily handle more concurrent users.</p>
<h3>Interops</h3>
<p>If you don&#8217;t already know, Interops are basically a better way to make calls into OS APIs than declares. Interops require less code, remove the need to convert data between OS and Xojo types and are far easier to write. A quick example:</p>
<p>These four lines of declares connect to the EventStore database on your iOS device:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-5698" src="https://blog.xojo.com/wp-content/uploads/2019/04/Screen-Shot-2019-04-25-at-2.25.33-PM.png" alt="" width="1622" height="332"></p>
<p>Just to connect to the eventstore, you’re dealing with a lot of very unfriendly stuff.&nbsp;However, with Interops this is reduced to one simple line that is friendly Xojo code:</p>
<h3><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-5699" src="https://blog.xojo.com/wp-content/uploads/2019/04/Screen-Shot-2019-04-25-at-2.25.59-PM.png" alt="" width="1520" height="260"></h3>
<p>Interops are already a real thing.&nbsp;We are using them internally in the iOS XDC app for both for calendar events and local notifications as well.&nbsp;We are also using them to build the Android framework.</p>
<h3>IDE Update</h3>
<p>We’ve been doing a lot of work behind the scenes on IDE improvements. You’ve seen some of this in 2019r1 with the layout editor.</p>
<p>With that completed, we’ve now reached the point where the new Home screen and improved workflow are coming soon.</p>
<h3>API 2.0</h3>
<p>API 2.0, is a set of APIs that will replace many of the existing ones, they will provide better consistency in naming, offsets and error handling. In some cases, we are taking the opportunity to modernize the implementation as well. You already saw this with URLConnection&nbsp;introduced in 2018r4. URLConnection replaced the old HTTPSocket that used a library that had to be updated. URLConnnection uses the underlying OSs&#8217; library, so as those OSs get updated in order to provide better HTTP connections, your apps will automatically benefit. To name a couple more,&nbsp;API 2.0 supports Bezier Curves for all platforms, not just iOS. And the Date class has all the features we added to xojo.core.date, including: Locale support,&nbsp;DateInterval support&nbsp;and TimeZone support.</p>
<p>In most cases the APIs have not changed and not everything will be replaced. Those that are replaced will remain for many years so you don&#8217;t need to worry about rewriting your code right away.&nbsp;This change has gone faster than expected (yay, it does happen!) and we plan to be in beta&nbsp;after just a few more updates are made.</p>
<h3>Web Framework 2.0</h3>
<p>Last year we talked a lot about the design of Web 2.0, this year Geoff focused on implementation and the great progress made so far. As a way of testing out Web Framework 2.0, we decided to port something to the web using it. Since so many have asked for it over the years, we&#8217;re working on a&nbsp;web version of Feedback.&nbsp;It’s in the early stages and Greg will be demonstrating the web version in his XDC session.&nbsp;While there’s still more implementation to do, the fact that we are using it for internally tells you how far we have come. Once the implementation is complete, we will begin beta testing.</p>
<h3>Android</h3>
<p>As you may remember we showed you a Hello World on Android back in 2018. Since then we&#8217;ve got IDE integration, apps running on simulator and apps running on actual hardware. We&#8217;re also building Android apps internally. In fact, we have put together an&nbsp;Android version of the XDC app! You can go to the <a href="https://play.google.com/store/apps/details?id=com.xojo.xdc2019&amp;hl=en">Play Store</a> and download it right now. This is a simple app, basically the HTMLViewer. However, the app is native and was built the same way you will be building native apps in Xojo. Travis will show you more controls and have lots of details and demos in his XDC session.</p>
<p><img class=""><img class=""><img class=""><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-5706" src="https://blog.xojo.com/wp-content/uploads/2019/04/Screen-Shot-2019-04-25-at-3.16.24-PM.png" alt="" width="2252" height="1510"></p>
<p>So what&#8217;s left before Android is in your hands? In this as well, a lot of the &#8220;heavy lifting&#8221; has been done, we need to finish implementing the framework and port the debugger and then we will begin pre-release testing Xojo Android.</p>
<p>As you can see, Xojo has made significant progress towards these many large, multiyear projects. An additional note, currently work on Plugins in Xojo is paused to allow us to focus on Android. We&#8217;ll do our best to keep you updated via <a href="https://twitter.com/xojo">Twitter</a> and <a href="https://www.facebook.com/goxojo">Facebook</a> throughout the conference. Please use hashtag #XDC2019 online to search or share your own thoughts. Even if you aren&#8217;t here, we&#8217;ll do our best to reduce the Xojo FOMO! The XDC Video set is now <a href="https://www.xojo.com/store/#conference">available for sale</a>.</p>
<p>Speaking of great conferences, the <a href="https://www.monkeybreadsoftware.de/xojo/events/cologne-2019-event.shtml">MBS Software conference</a> will be in Cologne, Germany on October 24th and 25th of this year. There are already 40 people coming from 10 different countries, including Geoff Perlman!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Web Services: Xojo Web, at your service</title>
		<link>https://blog.xojo.com/2018/09/26/web-services-xojo-web-at-your-service/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Wed, 26 Sep 2018 10:00:59 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Middleware]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4950</guid>

					<description><![CDATA[In this two part tutorial we will see how easy it is to create a basic web service using Xojo Web. In the second part, we will create a Desktop client to talk with the web service (you may want to add iOS to the list).]]></description>
										<content:encoded><![CDATA[<p>Using Xojo Web to create complete web apps and solutions means not having to learn a bunch of interpreted languages and dozens of ever-changing frameworks. I&#8217;m looking at you: HTML, CSS (is that even a language?), JavaScript, PHP, et al. Of course, <a href="http://xojo.com/products/web.php">Xojo Web</a> not only makes it possible to create your own web apps, but it also acts as the perfect middleware that your desktop and iOS apps can communicate with. Learn about <strong>APIs</strong> and web services with Xojo in the tutorial blog post.<span id="more-4950"></span></p>
<p>In this two part tutorial you will see how easy it is to create a basic web service using Xojo Web. In the second part, we will create a Desktop client to talk with the web service (you may want to add iOS to the list).</p>
<p>Before we start, let me point out that this tutorial leaves out some details related to error checking, validation, data sanitizing and other specifics related to inputs and outputs in order to focus on the central topic. In addition, if you want to follow and reproduce the steps of this tutorial, then you need to download the <a href="https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite">Chinook Database, </a>named &#8220;test.sqlite&#8221; in this tutorial.</p>
<h2>Services in practice</h2>
<p>Let&#8217;s start creating a web service! Open the Xojo IDE, create a new <b>Web project</b>, and name it <code>WebService</code>. The first thing you&#8217;ll notice is that Xojo adds a web page to the project by default &#8211; even when our web service does not display a UI. The good part is that you can mix both worlds, adding the webservice part to your regular Web app!.</p>
<p>In fact this tutorial will put all the logic in the App object. Start by adding a new <b>property</b> in charge of the reference to our <b>SQLite</b> database (of course, it will work also with <b>PostgreSQL</b> or <b>MySQL</b> engines). Select the <code>App</code> object from the <b>Navigator</b> (the left panel in the Xojo IDE), choosing the <code>Insert &gt; Property</code> option from the contextual menu. With the new property selected, go to the <b>Inspector</b> to set the name, type and scope using these values:</p>
<ul>
<li><b>Name: </b>Database</li>
<li><b>Type: </b>SQLiteDatabase</li>
<li><b>Scope: </b>Private</li>
</ul>
<p>Next, we will add the Chinook Database to the Resources folder of our Web App. For that, select the deployment target under Build Settings (it can be macOS, Windows, Linux or Xojo Cloud, for example), and add a Copy Files build step to it. In the resulting Editor, add the Chinook database SQLite file and make sure you select the &#8220;Resources Folder&#8221; entry in the Destination popup menu, and the &#8220;Both&#8221; entry in the Applies To popup menu.</p>
<p>Now is time to create a new SQLiteDatabase instance and assign it to this property, so it will point to the SQLite database file when the app is running. For that, make sure the <code>App</code> object is selected and add the <code>Opening</code> <b>Event Handler</b> to it using the <code>Insert &gt; Event</code> option. Write the following code in the resulting <b>Code Editor</b>:</p>
<pre>#Pragma Unused args

Var f As FolderItem = SpecialFolder.Resource("Chinook_Sqlite.sqlite")

If f.Exists Then
  
  Try
    database = New SQLiteDatabase
    database.DatabaseFile = f
    
    Call database.Connect
  Catch e As DatabaseException
    MessageBox "Error connecting to the database"
  End Try
  
End If</pre>
<p>As you can see, it is pretty much the same code we already use when creating <b>SQLiteDatabase</b> instances in our Desktop apps, <em>linking</em> to our SQLite database file and stablishing the connection so we can operate with the database engine from our app.</p>
<h2>All the Magic of HandleURL</h2>
<p>Xojo Web projects offer a simple way to handle the request received. It is using the <code>HandleURL</code> event. This is the one that fires every time a client app (it may be a Web Browser, desktop or mobile app) connects to the URL associated with the <b>IP address and port combination</b> that is <em>listening</em> for incoming requests.</p>
<p>For example, a valid URL that can be <b>trapped</b> and processed by <code>HandleURL</code> is:</p>
<pre>http://www.nice-web-domain.com/getCustomers</pre>
<p>Where <code>getCustomers</code> is in this case one of our API methods.</p>
<p>So, with the <code>App</code> object selectd, choose <code>Insert &gt; Event</code> in order to add the <code>HandleURL</code> event.</p>
<p>As we will see, once the event has been added to a web app, it will receive the <code>Request</code> parameter (a <code>WebRequest</code> data type), waiting from us to send back a <code>Boolean</code> value as response: <code>True</code> to process the request or <code>False</code> (the default value) to ignore the response.</p>
<h2>Introducing Request, where the information lives!</h2>
<p>In fact, we will find in the <code>Request</code> object everything we need to process and (if it is the case) respond to the request from our Web service. For example, through we can get the interesting component from the <code>Path</code> property. If we consider this URL:</p>
<p><code>http://www.nice-web-domain.com/getCustomers?spain</code></p>
<p>The <code>Request.Path</code> property will return the <code>getCustomers</code> string; so our web service can process it acordingly from this point on.</p>
<h2>Receiving and Sending JSON data</h2>
<p>In order to keep this tutorial brief, our web API only has two methods in it: <code>GetAll</code> and <code>AddAlbum</code>. Using the first one, the client app will get the album name in the database wrapped in JSON format. With the second method, our client app will ask the web service to add a new record (a new album) to the right table on our example database.</p>
<p>How can we process the request associated data inside the <code>HandleURL</code> event? Here is where we will find very useful another of the <code>Request</code> object properties. The <code>Body</code> property includes the sent data as part of the request that are not already present in the headers. Generally speaking, it includes additional data via the <b>PUT</b> and <b>POST</b> verbs.</p>
<p>Now we can put the following code into our <code>HandleURL</code> Event Handler:</p>
<pre>Select Case Request.Path // What is the method received as part of the request? (URL)
Case "GetAll"
  Var output As JSONItem = GetAllAlbums // Assign the processed data to the output variable, if the received method is 'GetAllAlbums'
  
  Response.Header("charset") = "utf-8"
  Response.MIMEType = "application/json"
  Response.Status = 200
  response.write( output.ToString ) // And send it back to the client that made the request, converting the JSON to a String in first place
  
Case "AddAlbum"
  Var data As String = Request.Body.DefineEncoding(encodings.UTF8) // We have to apply the right encoding to the received data
  Var Input As JSONItem = New JSONItem( data ) // Creating a new JSON object from it
  addNewAlbum( Input.Value("newAlbum") ) // In this case, the request is to add a new Album to the database; passing thus the received data as part of the input
End Select

Return True</pre>
<p>The main point here is that we assign the received data to the <code>data</code> variable (if any), and define a known encoding to them so we won&#8217;t get into trouble while processing them afterwards. Of course, our example always expects to receive the additional data in JSON format, so this is why we create a new JSON instance from this data.</p>
<p>We use the <code>Select…Case</code> command to decide what method has to execute the web service, and that is based on the component stored in the <code>Path</code> property as you recall. So, if the request uses the <code>GetAll</code> method in the URL, we will call the real method <code>GetAllAlbums</code> in our Xojo code. After processing the information it will return a new <code>JSONItem</code> as the response we will send to the client.</p>
<p>How can we send the response to the request? Really simple: calling the <code>Write</code> method on the Response object, passing as parameter the text we want to send back. In our example, this is the <code>JSONItem</code> referenced by the <code>Output</code> variable. We also use the Response object to set the character encoding to UTF-8 and the MIME type to &#8220;Application/json&#8221;, in addition of setting the status value to 200 (that is, the request has been successfully handled).</p>
<p>If we receive a request with the <code>AddAlbum</code> method of our API, then we call the real <code>addNewAlbum</code> method in our Xojo code, passing as parameter the <code>JSONItem</code> object in charge of store the received data from the request (this is the one referenced by the <code>input</code> variable). In fact, the record structure is stored inside the <code>newAlbum</code> root node of the JSONItem.</p>
<h2>When it comes to the Database</h2>
<p>While <code>HandleURL</code> is in charge of processing the received request, we will use a couple of methods in our example app that will act as a <em>link</em> between the API and the database in the backend, both for retrieving and storing the requested information. (In a real world app it is very advisable to introduce checks and data sanitization before dealing with the database!)</p>
<p>Choose the <code>App</code> object again and use the <code>Insert &gt; Method</code> option in order to add the <code>GetAllAlbums</code> method, using the following method signature for that:</p>
<ul>
<li style="list-style-type: none;">
<ul>
<li><b>Method Name: </b>getAllAlbums</li>
<li><b>Return Type: </b>JSONItem</li>
<li><b>Scope: </b>Private</li>
</ul>
</li>
</ul>
<p>This is the code in charge of generating the JSONitem that we will <em>write </em>as part of the request response, including the <b>node</b> for every expected database record from the <code>Album</code> table in our example database:</p>
<pre>Var rc As RowSet = database.SelectSQL("Select * from album order by title asc") // Get the Recordset as result of the SQL selection: all the records
Var item As New JSONItem

If rc.RowCount &gt; 0 Then // We have records on the RecordSet
  
  While Not rc.AfterLastRow // so lets iterate them!
    Var d As New Dictionary // creating a new dictionary for each record, and that we will convert in a node
    d.Value("artistid") = rc.Column("artistid").StringValue // assingning the record ID to the name 'ArtistId' of the JSONItem
    d.Value("title") = rc.Column("title").StringValue // and the Title value to the 'Title' field of the JSONItem
    item.Value(rc.Column("albumid").StringValue) = d // You know you can assign a Dictionary as the value for a JSONItem node. Very useful!
    
    rc.MoveToNextRow
  Wend
  
  rc.Close
  
End If

var output As New JSONItem

output.Value("AllAlbums") = item // Then let's hang all these records form a main Node

Return output // And return it to the caller</pre>
<p>Next, create a new method named <code>addNewAlbum</code>. This is the one our web service will use to add a new record to the database, using for that the received data as part of the request. Use the following signature for the method definition:</p>
<ul>
<li style="list-style-type: none;">
<ul>
<li style="list-style-type: none;">
<ul>
<li><b>Method Name: </b>addNewAlbum</li>
<li><b>Paramters: </b>item as JSONItem</li>
<li><b>Scope:</b> Private</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>And put the following code in the associated Code Editor:</p>
<pre>Var title As String = item.Value("Title") // get the data associated to the "Title" field
Var artistid As String = item.Value("ArtistId") // and the 'ArtistID'

database.ExecuteSQL("insert into album(title,artistid) values(?, ?)", title, artistid ) // and insert that data as a new record into the database table
</pre>
<p>As you can see, the code is very simple: it gets the values for the received keys in the JSONitem nodes and uses them as part of the SQL sentence in order to add a new record to the database.</p>
<h1>A Web service… ready to serve!</h1>
<p>As you have seen, the code and app structure are really minimal! Of course, this is just a simple example but it gives you a good idea of the kind of possibilities web services offer and how fast you can put it together using Xojo and <strong>OOP</strong> concepts you already know! Of course, you can run your web app (and services) right from the IDE (just make sure to select 8081 as the Debug Port)… what is probably the recommended way to follow this simple example. For other more complex web apps, remember that you can use the one click solution <a href="https://www.xojo.com/cloud/"><strong>Xojo Cloud</strong></a> and of course any compatible Linux, Windows or Mac server.</p>
<p><em>Javier Rodri­guez has been the Xojo Spanish Evangelist since 2008, he’s also a Developer, Consultant and Trainer who has be using Xojo since 1998. He manages <a href="http://www.aprendexojo.com">AprendeXojo.com</a> and is the developer behind the GuancheMOS plug-in for Xojo Developers, Markdown Parser for Xojo, HTMLColorizer for Xojo and the Snippery app, among others</em></p>
<p>*<a href="https://www.aprendexojo.com/2016/06/crear-servicio-web-con-xojo/">Read this post in Spanish</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>#JustCode Challenge Week 3 &#8211; Dogs Up!</title>
		<link>https://blog.xojo.com/2018/07/06/just-code-challenge-week3/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Fri, 06 Jul 2018 10:00:23 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[#JustCode]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Challenge]]></category>
		<category><![CDATA[HTTPSocket]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4373</guid>

					<description><![CDATA[After 2 desktop apps in week 1 and week 2 of the Just Code challenge, my project this week is an iOS app. It's very important job is to display dog pictures. I call it Dogs Up!]]></description>
										<content:encoded><![CDATA[<p><span style="font-size: 16px;">After 2 desktop apps in week 1 and week 2 of the <a href="https://blog.xojo.com/2018/06/18/jump-right-in-just-code-challenge/">Just Code challenge</a>, my project this week is an iOS app. Its very important job is to display dog pictures. I call it Dogs Up!</span></p>
<p><span id="more-4373"></span></p>
<p>If you were at XDC 2018 maybe you caught my iOS session where I showed how to send an update to the App Store. The app I updated was <a href="https://blog.xojo.com/2015/10/01/cats-up-using-httpsocket-with-the-cat-rest-api/">Cats Up!</a>, a simple iOS app that display cat pictures. Dogs Up! is the dog version and it uses the <a href="https://dog.ceo/dog-api/">Dog API</a>.</p>
<p><img loading="lazy" decoding="async" class="wp-image-4374 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/06/iOS55Screenshot.png" alt="" width="281" height="500" /></p>
<p>To make this app, I made a copy of the Cats Up! project and then started changing the parts necessary to hook it up to the Dog API. Changing existing projects is a great way to learn and one of the reasons we are doing the Just Code Challenge.</p>
<p>The Cats Up! project used a single HTTPSocket to connect to its web service for the cat pictures. The Dog API required two HTTPSockets: one to request a URL to a dog picture and another to download the picture itself.</p>
<p>Once these steps were done, I just needed to update the JSON file with dog facts (instead of cat facts), find something to use for the dog icon and get a recording of a dog bark to use when a new picture is displayed.</p>
<p><a href="http://files.xojo.com/JustCode/DogsUp.zip">Download the Dogs Up! project</a>.</p>
<p>Download and check out earlier projects:</p>
<ul>
<li>Week 2: <a href="https://blog.xojo.com/2018/06/29/just-code-challenge-week2/">Password Generator</a></li>
<li>Week 1: <a href="https://blog.xojo.com/2018/06/22/just-code-challenge-week1/">Color Picker</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Identify Images Using IBM Watson&#8217;s Remote APIs</title>
		<link>https://blog.xojo.com/2018/05/23/identify-images-using-ibm-watsons-remote-apis/</link>
		
		<dc:creator><![CDATA[Xojo]]></dc:creator>
		<pubDate>Wed, 23 May 2018 10:00:33 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Watson]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4293</guid>

					<description><![CDATA[Have some fun with Artificial Intelligence and Xojo! See examples from IBM's Watson services and how to use them with Xojo to classify images.]]></description>
										<content:encoded><![CDATA[<p>Some of the most interesting web services you can use with Xojo through remote API calls are related to <a href="https://en.wikipedia.org/wiki/Artificial_intelligence">Artificial Intelligence</a>. There are many different APIs provided by the main players in the AI sector, but IBM&#8217;s Watson is by far the most well known.</p>
<p>I&#8217;m going to show you how to connect to IBM&#8217;s Watson services with REST APIs and how to use them with Xojo projects to identify images. This is just one example, of course, of the many ways to utilize Watson and AI in your Xojo apps.</p>
<p><span id="more-4293"></span></p>
<h3>IBM Watson</h3>
<p><a href="https://www.ibm.com/watson/" target="_blank" rel="noopener">IBM&#8217;s Watson services</a> have been online for several years and are continuously updated. They are paid services but you can create a Lite user to test and evaluate them. The <a href="https://console.bluemix.net/developer/watson/documentation?cm_mc_uid=39948455095014385868305&amp;cm_mc_sid_50200000=73496051523601646255&amp;cm_mc_sid_52640000=69577461523601646258" target="_blank" rel="noopener">documentation and variety</a> of services are huge and includes (among other things) image identification services.</p>
<h4>Identify images with Watson</h4>
<p>This service mainly offers two possibilities: identifying the faces in an image (returning the position, the probable gender of the subject and the probable age range) and the classification (i.e. the recognition of possible tags that can be associated with the image).</p>
<div class="keyconcept"><strong>The key concept of this type of process is: Probability</strong><br />
The result is a probability, not a certainty. It&#8217;s up to your app to accept or reject the result and how to use it. For example, you can set a threshold and automatically accept the results and send the user the uncertain result to confirm or refuse.</div>
<p>Watson&#8217;s <a href="https://www.ibm.com/developerworks/community/blogs/5things/entry/5_things_to_know_about_Watson_Natural_Language_Classifier?lang=en">Natural Language Classifier</a>, is a service that &#8220;applies cognitive computing techniques to return best matching predefined classes for short text inputs, such as a sentence or phrase&#8221;. It is really large (and the definitions are localized in many languages); moreover you can create your own classifiers specific to projects. The Lite user can create only one classifier at a time that is replaceable but not updatable. Another limit is the number and total size of the images that you can use to address your classifier.</p>
<p>Watson&#8217;s documentation is complete and easy to use. After creating the service in your account, you can start using them with the terminal or through the web page relative to the selected service.</p>
<h3>How to use Watson with Xojo</h3>
<p>The services use a REST API so you&#8217;ll use <a href="http://developer.xojo.com/xojo-net-httpsocket">Xojo.Net.HTTPSocket</a> as the base class to create the object that will consume these services. To learn more about using Xojo with a REST API, you should read up on that before continuing: <a href="https://blog.xojo.com/2015/10/01/cats-up-using-httpsocket-with-the-cat-rest-api/" target="_blank" rel="noopener">Cats Up: Using the HTTPSocket with the Cat REST API,</a> <a href="https://blog.xojo.com/2018/02/06/pdf-file-generation-there-is-an-api-for-that/" target="_blank" rel="noopener">PDF File Generation? There is an API for that</a> and <a href="https://www.youtube.com/playlist?list=PLPoq910Q9jXiH5A32myqHwd1WLuUnBTuO">Web Services Video Playlist</a>.</p>
<p>In this example, the base class is called &#8220;WatsonAPI&#8221;. This class will deal with the communication with the API (sending and initial interpretation of the answer) and will have some common features (such as zipping several images so they can be sent all at once). Moreover, since the interaction with the service is asynchronous, the class will have to manage the serialization of the different requests and take care to return the result to the correct call.</p>
<p>Next, you&#8217;ll define a delegate who will have as an argument the answer (positive, negative or error) that will have as its signature a <a href="http://developer.xojo.com/xojo-core-dictionary">Xojo.Core.Dictionary</a>:</p>
<pre>WatsonReplyFunction(reply as Xojo.Core.Dictionary)</pre>
<p>Now you&#8217;ll define two private properties: id and callback. You&#8217;ll use id to distinguish the various call, and callback will be the function to call when there&#8217;s a the result.</p>
<pre>Private Property id as Text
Private Property callback as WatsonReplyFunction</pre>
<p>The constructor (protected because the subclasses will call it) can be of this kind:</p>
<pre>Protected Sub Constructor( cb as WatsonAPI.WatsonReplyFunction)
  // Register the callback
  callback=cb
  Super.Constructor
  register Me
End Sub</pre>
<p><em>Register</em> is a private shared function that assigns the identifier to the object and saves the pair id, object in a shared dictionary. There&#8217;s also a <em>deRegister </em>function that will delete the object whose identifier is passed.</p>
<p>As noted before, you&#8217;ll use a dictionary to represent the API result because it&#8217;s the format used for positive or negative API replies. Moreover, we can use the same format for network error replies. The dictionary will contain at least 3 values: <em>success</em> as boolean for a positive or negative reply, <em>status</em> as integer for the reply http status and <em>result</em> as text or dictionary to represent the current reply. Since it&#8217;s a dictionary, we can easly add more information as needed. Subclasses or consumer classes can transform this data structure in a more specific way (class, record or whatever).</p>
<p>Now you will implement the major events:</p>
<pre>Sub Error(err as RuntimeException) Handles Error
  //All replies will have the same structure
  //In the event of an error, the returned dictionary must be structured as correct one
  Dim d As New Xojo.Core.Dictionary
  d.Value("success")=False
  d.Value("status")=0
  d.Value("result")=err.Reason
  //Delete the object from the dictionary
  deRegister(Me)
  //return the reply
  callback.Invoke(d)
End Sub


Sub PageReceived(URL as Text, HTTPStatus as Integer, Content as Xojo.Core.MemoryBlock&gt;) Handles PageReceived
  #Pragma Unused url

  //evaluate the reply
  Dim d As Xojo.Core.Dictionary
  Dim t As Text
  Try
    t=Xojo.Core.TextEncoding.UTF8.ConvertDataToText(Content)
  Catch
    t=""
  End Try
  If Not t.Empty Then
    Try
      d=Xojo.Data.ParseJSON(t)
    Catch
      d=Nil
    End Try
  End If
  Dim reply As New Xojo.Core.Dictionary
  reply.Value("success")=HTTPStatus=200 And d&lt;&gt;Nil
  reply.Value("status")=HTTPStatus
  If d=Nil Then
    reply.Value("result")=t
  Else
    reply.Value("result")=d
  End If
  //Delete the object from the dictionary
  deRegister(Me)
  //return the reply
  callback.Invoke(reply)
End Sub</pre>
<p>Now you can create a subclass to classify the images: WatsonVisualRecognition as subclass of WastonAPI.</p>
<p>For the image classification you can use one or more of the classifiers and/or the default one or even those in beta (currently Food and Explicit). So let&#8217;s define the constants related to these classifiers:</p>
<pre>Public Const IBMDefault as Text =default
Public Const IBMExplicit as Text = explicit
Public Const IBMFood As Text = food</pre>
<p>&#8230; and the ones related to the services:</p>
<pre>//The current version of the service
Private Const version As Text = 2016-05-20

//The address actually depends on the user settings
Private Const kBaseUrl As Text = https://gateway.watsonplatform.net/visual-recognition/api/v3/

//The key to use the service
Private Const keyVision As Text = •••••••</pre>
<p>You can now define a public shared method for analyzing an image on the web:</p>
<pre>Public Shared Sub classifyImage(cb As WastonAPI.WatsonReplyFunction, imageUrl As Text, threshold As Single=0.5, paramArray classifiers As Text)
  //The method requires a method to be called to return the results,
  // the address of the image to be analyzed
  // the minimum value to be considered for recognition
  // a list of classifiers to use

  //Let's create the instance linking it to the callback
  Dim w As New WatsonVisualRecognition(cb)

  //threshold is the minimum acceptable value for classification
  //  must be between 0 and 1
  If threshold&lt;0.0 Then threshold=0.0
  If threshold&gt;1.0 Then threshold=1.0

  //For classifiers I can use both the ones provided and mine
  //none means the default one
  Dim useIBM As Boolean
  Dim usePersonal As Boolean
  Dim usedClassifiers() As Text
  For i As Integer=0 To classifiers.Ubound
    Select Case classifiers(i)
    Case IBMDefault
      useIBM=True
    Case IBMExplicit, IBMFood
      useIBM=True
      //These classifiers are in English only 
      w.RequestHeader("Accept-Language")="en"
    Else
      usePersonal=True
    End Select
    If usedClassifiers.IndexOf(classifiers(i))=-11 Then usedClassifiers.Append  classifiers(i)
  Next
  Dim classifierIds As Text=Text.Join(usedClassifiers, ",")

  //Set the kind of the classifiers used
  Dim usedOwners() As Text
  If useIBM Then usedOwners.Append "IBM"
  If usePersonal Then usedOwners.Append "me"
  Dim owners As Text=Text.Join(usedOwners, ",")

  //Create the URL to be called
  Dim url As Text=kBaseUrl+"classify"

  //I create the list of arguments
  Dim args() As Text
  args.Append "api_key="+keyVision
  args.Append "version="+version
  args.Append "url="+imageUrl
  If Not owners.Empty Then args.Append "owners="+owners
  If Not classifierIds.Empty Then args.Append "classifier_ids="+classifierIds
  If threshold&gt;0 Then args.Append "threshold="+threshold.ToText
  Dim parameters As Text=Text.&gt;Join(args, "&amp;")

  w.Send "GET", url+If(parameters.Empty, "", "?"+parameters)
End Sub</pre>
<p>Finally, you can request the classification of an image. For example, put a button in a Window and in the Action event put the following code:</p>
<pre>WatsonVisualRecognition.classifyImage(WeakAddressOf analyzeResponse, "https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/fruitbowl.jpg", .3)</pre>
<p>Where <em>analyzeResponse</em> is the method that will read the results translating the Dictionary into something useful like actions for a database, a textual list or a simple text message.</p>
<p>Starting from this simple method, it is possible to create all the others, adding a bit of utility functions to the WatsonAPI base class.</p>
<p>As an example, it is possible to obtain the basic information about the people in this image and display it as an overlay:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-4295" src="https://blog.xojo.com/wp-content/uploads/2018/05/faces.png" alt="" width="1433" height="953" /></p>
<p>Or update a database of images with classifications to then find the images of a specific type:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-4296" src="https://blog.xojo.com/wp-content/uploads/2018/05/food.png" alt="" width="2446" height="1054" /></p>
<h3><img />Create your own classifiers</h3>
<p>Starting from this object it is easy to create an application to generate, update, and verify a classifier that is specific to this solution. While you can do it with the provided web interface, you can create a Xojo app that can return the feedback in a much easier and manageable way; and you can add some methods to automate the process of automatically discarding bad images and adding new ones in order to refine your classifier better.</p>
<h3>Conclusions</h3>
<p>Watson&#8217;s API services allow you to add a bit of artificial intelligence to your Xojo projects. The simplicity of the classes required to do this are clear proof of Xojo&#8217;s versatility.</p>
<p>It&#8217;s important to keep in mind that this service is not instantaneous. This is due in large part to network traffic; generally for sending the data and receiving the answer.</p>
<p>A really interesting option if you develop for MacOS would be to download your classifier in CoreML format and use it offline with <a href="https://www.mbsplugins.eu/CoreMLOpenModel.shtml">MBS Core ML plugin</a>.</p>
<p><em>Antonio Rinaldi is a professional engineer, Xojo developer for almost twenty years, Xojo evangelist for Italy since 2014, consultant and teacher. He develops extensions for Xojo iOS that you can find in the Xojo Store, and manages <a href="http://www.xojoitaliablog.com">XojoItaliaBlog.com</a>. Musician, composer, lover of good food, traveler and constantly curious, he is always looking for new ideas to expand his knowledge.</em></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Change Window Opacity Using a Linux Gtk Declare</title>
		<link>https://blog.xojo.com/2018/04/17/change-window-opacity-using-a-linux-gtk-declare/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 17 Apr 2018 10:00:58 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Declares]]></category>
		<category><![CDATA[GTK+ 2]]></category>
		<category><![CDATA[GTK+ 3]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4119</guid>

					<description><![CDATA[You can call into Linux APIs to use methods and properties that are not built into the framework by using the Declare command.]]></description>
										<content:encoded><![CDATA[<p>You can call into Linux APIs to use methods and properties that are not built into the framework by using the Declare command. To create a Declare statement you first need to track down the API you want to use using Linux documentation.</p>
<p><span id="more-4119"></span></p>
<p>The Linux API is largely based on the C/C++ programming language and makes heavy use of structures.</p>
<p>As a simple example, the <a href="https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-opacity">gtk_widget_set_opacity method in libgtk-3</a> can be used to change the window opacity so that it appears more transparent. This is what the method declaration looks like in the Gnome docs:</p>
<pre>void
gtk_widget_set_opacity (GtkWidget *widget,
 double opacity);</pre>
<p>This tells you it is a method (sub) because the &#8220;void&#8221; at the beginning indicates it does not return a value. The first parameter is a pointer to a GtkWidget, which in this case is the handle to the Xojo window. The opacity is a Double in the range of 0 to 1.</p>
<p>So the above method call translates to a Declare that looks like this:</p>
<pre>Declare Sub gtk_widget_set_opacity Lib "libgtk-3" (handle As Integer, opacity As Double)</pre>
<p>To set the window to 75% opacity you can call it like this:</p>
<pre>gtk_widget_set_opacity(Self.Handle, 0.75)</pre>
<p>Because this method is called for a window, you can put it in a Xojo Extension Method to make it easier to call. To do this, create a global method on a module like this:</p>
<pre>Public Sub Opacity(Extends w As Window, value As Double)
  #If TargetLinux Then
    Declare Sub gtk_widget_set_opacity Lib "libgtk-3" (handle As Integer, opacity As Double)
     gtk_widget_set_opacity(w, value)
  #EndIf
End Sub</pre>
<p>Note the use of the &#8220;#If TargetLinux&#8221; line. This prevents this code from being compiled into Windows or macOS builds of your app where the code could possible crash your app.</p>
<p>This now allows you to have code like this on a window&#8217;s Open event to center the window:</p>
<pre>Self.Opacity(0.75)</pre>
<p>To learn more in the Xojo Documentation:</p>
<ul>
<li><a href="https://documentation.xojo.com/topics/declares/calling_native_linux_apis.html">Calling Native Linux APIs</a></li>
</ul>


<p>If there are Linux-related or other topics, regarding Xojo Programming or general technology, you are interested in reading about on the Xojo Blog about please <a href="https://www.xojo.com/company/contact.php">let us know!</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PDF File Generation? There is an API for that!</title>
		<link>https://blog.xojo.com/2018/02/06/pdf-file-generation-there-is-an-api-for-that/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Tue, 06 Feb 2018 15:40:25 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[PDF]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=3874</guid>

					<description><![CDATA[Need to export to PDF from Xojo? There are lots of answers pointing to a bunch of resources, including excelent plug-ins from third parties. But there is also a remote API for that! Your Xojo app will need to have access to Internet … and, of course, you'll need to do just a bit of coding.]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve heard it several times: how can I export to PDF from Xojo? Sure, there are lots of answers pointing to a bunch of resources, including excellent <a href="https://www.xojo.com/store/#addons">plug-ins from third parties</a>. But can you accomplish the same thing using an already available API? Yes, there is a remote API for that! The requirement is that your Xojo app will need to have access to Internet … and, of course, you&#8217;ll need to do just a bit of coding.</p>
<p><span id="more-3874"></span></p>
<p>So I have a challenge for you, you can <a href="https://github.com/aprendexojo/HTTPDocConverter">download the already canned Xojo class</a> ready to use … or you can continue reading and discover how easy is to use Xojo to generate your PDF files!</p>
<p>The service we are going to use is the <b>OpenSource</b> software <a href="https://docverter.com/">Docverter</a>, able to convert any plain, <b>HTML</b>, <b>Markdown</b> or LaTeX file to <b>PDF</b>, <b>Docx</b>, <b>RTF</b> or <b>ePub</b> using a simple HTTP API. In my tests it worked like a charm from the HTML + CSS returned from <b>Markdown Parser</b> class of my own.</p>
<p>In fact it is possible to use this service stright from a Shell class instance, but I&#8217;ve found it more portable and <b>multiplatform</b> to wrap it in a Class so you can simply drop it in your project, passing the file or files you want, and specifying the conversion you want to get back; as simple as that!</p>
<p>For that API wrapper we are going to create a new class derived from <a href="http://developer.xojo.com/httpsocket"><b>HTTPSocket</b></a>. Let&#8217;s name it <code>HTTPDocConverter</code> and put as the next step these <b>String</b> constants that will ease its use:</p>
<ul>
<li><code>kDOCX As String = "docx"; scope: public</code>.</li>
<li><code>kePUB As String = "ePub"; scope: public</code>.</li>
<li><code>kMOBI As String = "mobi"; scope: public</code>.</li>
<li><code>kRTF As String = "rtf"; scope: public</code>.</li>
<li><code>kRemoteAPI As String = "http://c.docverter.com/convert"; scope: private</code>.</li>
</ul>
<p>I think that is a good habit to get accustomed to constants wherever Strings or other frozen values are involved in order to minimize possible minor bugs in the code.</p>
<p>Now it is time to implement the class Constructor passing along three parameters that will simplify its use:</p>
<ul>
<li><code>convertDataTo As String</code>. This is the text that identifies the format we want our document converted to and that is why we defined the Constants in the previous step.</li>
<li><code>inputFile As folderItem</code>. A valid FolderItem file pointing to the file we want to use as the source for the conversion process.</li>
<li><code>notification as callback</code>. This is new Delegate Type we will define in the next step, and that will be used by the class to, well, notify of the process completion. This way, your code and UI will not be locked.</li>
</ul>
<p>So our class <b>Constructor</b> will have the following signature:</p>
<p><code>Constructor( convertDataTo As String, inputFile As FolderItem, notification as callback )</code></p>
<p>Once we add the Constructor method, the Xojo IDE will put the right class initialization here, and we will complete the code with the following sentences:</p>
<pre>Super.Constructor
registeredCallback = notification
encodeRequest( inputFile, convertDataTo )</pre>
<p>Time to add to the class a new <b>Delegate</b> Type (Insert &gt; Delegate), using the following signature in the Inspector Panel:</p>
<ul>
<li><b>Delegate Name</b>: callback</li>
<li><b>Parameters</b>: content As String, documentType As String</li>
<li><b>Scope</b>: Private.</li>
</ul>
<p>That is: our class will accept as a <code>callback</code> Delegate any method that accepts two strings. In fact our class will return the already converted data into the argument <code>content</code>, and also the document type used for the conversion into the <code>documentType</code> argument.</p>
<p>With our Delegate already set, it&#8217;s time to add the <code>registeredCallback</code> Property to the class, and that will be responsible to point to the Delegated method passed to the class instance throught the Constructor:</p>
<ul>
<li><b>Name</b>: registeredCallback</li>
<li><b>Type</b>: callback</li>
<li><b>Scope</b>: Private</li>
</ul>
<p>In fact, let&#8217;s add two more Properties:</p>
<ul>
<li><b>Name</b>: convertedToType. This one will contain the conversion format.</li>
<li><b>Type</b>: String</li>
<li><b>Scope</b>: Private</li>
</ul>
<p>&nbsp;</p>
<ul>
<li><b>Name</b>: receivedData. This property will contain the converted data received from the remote service.</li>
<li><b>Type</b>: String</li>
<li><b>Scope</b>: Private</li>
</ul>
<h2>Encoding the Post Request … the right way</h2>
<p>With all our properties set, it is time to add the Method <code>encodeRequest</code>. Here is where we will take care of constructing our <b>Post</b> Header request including the data for the source file we have to send to the remote URL, along all the required stuff. Create the Method with the following signature:</p>
<ul>
<li><b>Method Name</b>: encodeRequest</li>
<li><b>Parameters</b>: inputFile As Folderitem, convertdataTo as String</li>
</ul>
<p>And write the following snippet of code in the resulting Code Editor:</p>
<pre>Dim formData As New Dictionary
formData.Value("input_files[]") = inputFile
formData.value("from") = "html"
formData.value("to") = convertDataTo
convertedToType = convertDataTo
Dim boundary As String = ""
Boundary = "--" + Right(EncodeHex(MD5(Str(Microseconds))), 24) + "-reQLimIT"
Static CRLF As String = EndOfLine.Windows
Dim data As New MemoryBlock(0)
Dim out As New BinaryStream(data)
For Each key As String In FormData.Keys
  out.Write("--" + Boundary + CRLF)
  If VarType(FormData.Value(Key)) = Variant.TypeString Then
    out.Write("Content-Disposition: form-data; name=""" + key + """" + CRLF + CRLF)
    out.Write(FormData.Value(key) + CRLF)
  Elseif FormData.Value(Key) IsA FolderItem Then
    Dim file As FolderItem = FormData.Value(key)
    out.Write("Content-Disposition: form-data; name=""" + key + """" + "; filename="""+inputFile.Name+""""+ CRLF)
    out.Write("Content-Type: text/html" + CRLF + CRLF)
    Dim bs As BinaryStream = BinaryStream.Open(File)
    out.Write(bs.Read(bs.Length) + CRLF)
    bs.Close
  End If
Next
out.Write("--" + Boundary + "--" + CRLF)
out.Close
Super.SetRequestContent(data, "multipart/form-data; boundary=" + Boundary)</pre>
<h2>Calling the remote API</h2>
<p>Now that the hard part is complete, we are going to add the Method <code>getConvertedFile</code>, in charge of call the remote API:</p>
<ul>
<li><b>Method Name</b>: getConvertedFile</li>
<li><b>Scope</b>: Public</li>
</ul>
<p>And write this simple line of code in the Code Editor:</p>
<p><code>Super.post( kRemoteAPI )</code></p>
<p>This single line fires all the magic behind the scenes, now in order to get our response we need to add the Event <code>PageReceived</code> to our class, writing the following code in the resulting Code Editor:</p>
<pre>If registeredCallback &lt;&gt; Nil Then
  registeredCallback.Invoke content, convertedToType
End If</pre>
<p>If you want, you can also add the <code>Error</code> Event, so you can raise or inform about any error during the process.</p>
<h2>Testing our class!</h2>
<p>In order to test the class, and convert some documents along the way, add a new Method to the project Window (let&#8217;s assume its a Xojo Desktop Project). This is the one we will use as Delegate for the callback once we receive the converted data:</p>
<ul>
<li><b>Method Name</b>: conversionCompleted</li>
<li><b>Parameters</b>: convertedData As String, documentType as String</li>
<li><b>Scope</b>: Public</li>
</ul>
<p>And write the following code in the resulting Code Editor for the Method:</p>
<pre>Dim f As FolderItem = GetSaveFolderItem("", "ConvertedFile." + documentType)
If f &lt;&gt; Nil Then
  Dim tof As TextOutputStream = TextOutputStream.Create(f)
  If tof &lt;&gt; Nil Then
    tof.Write convertedData
    tof.Flush
    tof.Close
  End If
End If</pre>
<p>Add now the <b>Open</b> Event to the same Window and write the following code, this is the one in charge of creating our class instance and firing the conversion process. In this example converting the source file to a PDF file (you only need to change the file format constant to get other kind of documents as result):</p>
<pre>Dim f As FolderItem = GetOpenFolderItem("")
If f &lt;&gt; Nil Then
  Dim post As New HTTPDocConverter(HTTPDocConverter.kPDF,f, AddressOf conversioncompleted)
  post.getConvertedFile
End If</pre>
<h2>Creating PDF Files without Internet connection</h2>
<p>What if you need to generate PDF files without having an active Internet connection or because you handle confidential information? Well, in these cases I&#8217;m sure you&#8217;ll find of interest the <a href="https://wkhtmltopdf.org/"><strong>wkhtmltopdf</strong></a> tool/library.</p>
<p>Add it to your product bundle/folder or directory during the compilation process and you&#8217;re set!</p>
<p>In this case, you have to invoke it from a <a href="http://documentation.xojo.com/api/os/shell.html">Shell</a> instance passing HTML as the source file and getting the PDF as result. The downside is that the distributable product will be weighter (47 Megabytes)! Not a big problem these days, anyway.</p>
<h2>The Last Word</h2>
<p>As you have seen, with a couple of methods and Events we were able to create a multiplatform Class that works in 32-bit and 64-bit targets for Desktop, Console, web and Raspberry Pi deployments. I&#8217;ve been able to create PDF, DOCX, RTF and even MOBI files in no time!</p>
<p><em>Javier Rodri­guez has been the Xojo Spanish Evangelist since 2008, he’s also a Developer, Consultant and Trainer who has be using Xojo since 1998. He manages <a href="http://www.aprendexojo.com">AprendeXojo.com</a> and is the developer behind the GuancheMOS plug-in for Xojo Developers, Markdown Parser for Xojo and the Snippery app, among others</em></p>
<p>*<a href="https://www.aprendexojo.com/2018/02/creacion-archivos-pdf-una-app-i/">Read this post in Spanish</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WinAPILib on GitHub</title>
		<link>https://blog.xojo.com/2017/12/20/winapilib-on-github/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 20 Dec 2017 18:27:35 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Declares]]></category>
		<category><![CDATA[Open-Source]]></category>
		<category><![CDATA[WinAPILib]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=3561</guid>

					<description><![CDATA[I've started a new open-source project called WinAPILib that is now available on GitHub. This project is the start of an attempt to collect useful Windows Declares (from WFS and elsewhere) and make sure they are updated to work with 64-bit and newer versions of Windows.]]></description>
										<content:encoded><![CDATA[<p>Many years ago, the Window Functionality Suite (WFS) library was created by Aaron Ballman. This library was a collection of Win32 Declares (and a few other things) for accessing Windows-specific functionality that was not directly provided by the Xojo framework.</p>
<p><a href="https://github.com/arbp/wfs">WFS is still available on GitHub</a>, but it has languished over the years. For example, it has lots of legacy code in it for older versions of Windows that is no longer needed since Xojo only supports Windows 7 and later. WFS is also not really compatible with 64-bit projects since the Declares mostly assume 32-bit or bust.</p>
<p>To that end, I&#8217;ve started a new open-source project called <a href="https://github.com/paullefebvre/winapilib">WinAPILib</a> that is now available on GitHub.</p>
<p><span id="more-3561"></span></p>
<p>This project is the start of an attempt to collect useful Windows Declares (from WFS and elsewhere) and make sure they are updated to work with 64-bit and newer versions of Windows.</p>
<p>Why is it called WinAPILib? First, Microsoft no longer uses the term Win32 for their desktop framework since the API also works with 64-bit apps. It would be confusing to say you are using the Win32 framework for 64-bit apps, so Microsoft has switched to <a href="https://technet.microsoft.com/en-us/library/bb496995.aspx">mostly using &#8220;Windows API&#8221;</a>:</p>
<blockquote><p><em>The Windows API was formerly called the Win32 API. The name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows. The name Windows API is used in this volume except when comparing 32-bit Windows programming with 64-bit Windows programming. They are then referred to as Win32 and Win64 APIs, respectively.</em></p></blockquote>
<p>This is informally just shortend to &#8220;WinAPI&#8221;. Combined with the popular macOS Declare project on GitHub called <a href="https://github.com/macoslib/macoslib">macoslib</a>, I figured WinAPILib would be a consistent, familiar name.</p>
<p>I&#8217;ve started small with WinAPILib. Right now it just has a few classes for some system declares and other things. More will be added over time by me and hopefully by others sending pull requests up to GitHub.</p>
<p>To get WinAPILib, go to the <a href="https://github.com/paullefebvre/winapilib">GitHub page</a> and click the green &#8220;Clone or download&#8221; button. Use the clone URL with your favorite GitHub client (I use <a href="https://www.sourcetreeapp.com">SourceTree</a>) or just download the Zip if you&#8217;re Git-shy.</p>
<p><a href="https://github.com/paullefebvre/winapilib">WinAPILib on GitHub</a></p>
<p>For some tips on writing Windows Declares, visit <a href="http://developer.xojo.com/calling-native-windows-apis">Calling Native Windows APIs</a> in the User Guide.</p>
<p>I hope you find this helpful and please share your useful Windows Declares!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>ipify for Xojo</title>
		<link>https://blog.xojo.com/2017/09/26/ipify-for-xojo/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Tue, 26 Sep 2017 18:40:12 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[AprendeXojo]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=3407</guid>

					<description><![CDATA[pify is a very useful web service (an API) that promises to always be available to attend requests, letting us know the public (or external) IP address we are using to connect to Internet. Nevertheless, I found ipify to be the simplest and easiest to use, plus it is highly available due to being hosted by Heroku. That means, for example, that if half the Internet is down…you still can be confident to reach the ipify service in order to get the information.]]></description>
										<content:encoded><![CDATA[
<p><a href="https://www.ipify.org"><b>ipify</b></a> is a very useful web service (an API) that promises to always be available to attend requests, letting us know the public (or external) IP address we are using to connect to Internet. We can get this small piece of information as pure Text or in JSON or XML formats.</p>



<p><strong>This post was <a href="https://blog.xojo.com/2021/09/03/update-ipify-for-xojo/">updated in 2021</a> to using Xojo&#8217;s API 2.0.</strong></p>



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



<p>There are plenty of times when your Xojo apps might need to know what the public or external IP address in use is, and for that there are a lot of web sites or services that you can use from Xojo. Nevertheless, I found <strong>ipify</strong> to be the simplest and easiest to use, plus it is highly available due to being hosted by <a href="http://heroku.com">Heroku</a>. That means, for example, that if half the Internet is down…you still can be confident to reach the ipify service in order to get the information.</p>



<p>Using ipify from a Xojo desktop apps is as simple as using this code:</p>



<pre class="wp-block-preformatted">Dim request as New HTTPSSocket
Dim s as String = request.get("https://api.ipify.org",10)</pre>



<p>But sometimes we need additional information, for example knowing if the IP address has changed over time, or simply checking periodically for IP address changes. And that is something that you can find in the OpenSource project <strong>ip</strong><b>ify for Xojo</b> available in <a href="https://github.com/aprendexojo/IPify">this repository from GitHub</a>.</p>



<p><b>ipify for Xojo</b> is designed as a <a href="https://blog.xojo.com/2016/06/08/design-patterns-in-xojo-singleton/">Singleton class</a>, what means that you even don&#8217;t need to instatiate it in order to get the current IP address, know if the IP has changed over time, or even instruct the class to periodically check for the IP address, notifying the registered object every time with the current IP address in use and if it is the same or has changed from the last checking.</p>



<p><a href="https://github.com/aprendexojo/IPify">Download IPify for Xojo from GitHub</a></p>



<p><em>Javier Rodri­guez has been&nbsp;the Xojo Spanish&nbsp;Evangelist since 2008, he’s also a Developer, Consultant and Trainer who&nbsp;has be using&nbsp;Xojo since 1998. He manages&nbsp;<a href="http://www.aprendexojo.com">AprendeXojo.com</a> and is the developer behind the GuancheMOS plug-in for Xojo Developers and the Snippery app, among others.</em></p>



<p>*<a href="http://www.aprendexojo.com/2017/09/ipify-para-xojo/">Read this post in Spanish</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>FileMaker Developers Enhance &#038; Expand App Development With Xojo</title>
		<link>https://blog.xojo.com/2017/09/07/filemaker-developers-enhance-expand-app-development-with-xojo/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 07 Sep 2017 10:18:06 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Mobile]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=3269</guid>

					<description><![CDATA[If the deprecations and changes to the FileMaker platform have you searching for alternatives, Xojo is a solid place to start. FileMaker developers use Xojo for a variety of reasons, including lower cost, more powerful apps and native iOS apps.]]></description>
										<content:encoded><![CDATA[<p>If the deprecations and changes to the FileMaker platform have you searching for alternatives, Xojo is a solid place to start. FileMaker developers use Xojo for a <a href="http://timdietrich.me/blog/going-with-xojo/">variety of reasons,</a> including lower cost, more powerful apps and <a href="http://xojo.com/filemaker/">native iOS apps.</a></p>
<p>Xojo is a powerful, full-featured development tool and as far as professional development tools go, Xojo is amazingly easy to use. For people with programming experience or those that want to learn, Xojo is a great choice for creating powerful apps to meet any business need &#8211; from cross-platform desktop apps, web apps, mobile and iOT apps.</p>
<p><span id="more-3269"></span></p>
<p><strong>Free, On-Demad Webinars</strong></p>
<p>First, we did a couple webinars with FileMaker experts. The first webinar shows you how to create a Xojo iOS app that communicates with a FileMaker database:</p>
<ul>
<li><a href="http://developer.xojo.com/webinar-ios-filemaker">Develop iOS Apps that Integrate with FileMaker</a></li>
</ul>
<p>To learn what FileMaker developers were concerned about and how Xojo could help, we did a Question &amp; Answer webinar with FileMaker developers considering Xojo:</p>
<ul>
<li><a href="http://developer.xojo.com/webinar-filemaker-qa">Q&amp;A Xojo for FileMaker Developers</a></li>
</ul>
<p>Aloe is a new open source module that enhances Xojo&#8217;s Web framework. With Aloe, you can develop powerful, secure, and scalable websites, apps, and APIs. This demo shows you how to use Aloe and Xojo to quickly and easily create a website whose content is dynamically generated using data that&#8217;s stored in FileMaker databases:</p>
<ul>
<li><a href="http://developer.xojo.com/webinar-fm-aloe">FileMaker Web Publishing With Xojo and Aloe</a></li>
</ul>
<p><strong>Projects</strong></p>
<p>In conjunction with this, we released to GitHub a project called Xojo.FM which maps many commonly used FileMaker functions to make using Xojo a bit more familiar to you:</p>
<ul>
<li><a href="https://github.com/xojo/FM">Xojo.FM</a></li>
</ul>
<p><a href="http://timdietrich.me/fmluna/">Tim Dietrich</a>, an experienced FileMaker and Xojo developer, introduces FMLuna and the opportunities that it presents to both Xojo and FileMaker developers. See some of FMLuna&#8217;s features in action as Tim builds a basic FileMaker API:</p>
<ul>
<li><a href="http://developer.xojo.com/webinar-fmluna">Integrate with FileMaker Databases using FMLuna</a></li>
</ul>
<p>After you have checked out all those resources and you&#8217;re ready to begin development, visit the <a href="http://developer.xojo.com/migrating-from-filemaker">Migrating from FileMake</a>r page in the Xojo Dev Center for tips on how to best migrate your FileMaker apps. You&#8217;ll quickly see how simple it can be to jump from FileMaker to Xojo, grow you client base and open up new opportunities in the mobile market.</p>
<p>Xojo is free for development and testing and has a 90-day return policy. Give it a try to see how you can start making better, more powerful apps.<br />
<!-- end HubSpot Call-to-Action Code --></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Tip: Pass Values Between Windows with an API</title>
		<link>https://blog.xojo.com/2017/04/27/pass-values-with-an-api/</link>
		
		<dc:creator><![CDATA[Norman Palardy]]></dc:creator>
		<pubDate>Thu, 27 Apr 2017 15:36:22 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[API]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=2577</guid>

					<description><![CDATA[It may not be obvious how to avoid having to reach inside another window (or dialog etc.) to get and set values. We have all have done this, but it really is something to avoid. Here's a small app to demo how to make an API to avoid reaching in.]]></description>
										<content:encoded><![CDATA[<p>A question on the Xojo Forum got me thinking that it may not be obvious how to avoid having to reach inside another window (or dialog etc.) to access its controls to get and set values. I&#8217;m sure we all have done this at one time or another but it really is something you should avoid. Here&#8217;s a small app to demo how to make an API instead:</p>
<p><span id="more-2577"></span></p>
<ol>
<li>Create a new desktop app</li>
<li>Add a new window and set its frame type to &#8220;movable modal&#8221; name it &#8220;myDialog&#8221;</li>
<li>Add two Buttons one with the caption &#8220;cancel&#8221; and one with &#8220;close&#8221;</li>
<li>Add a property &#8220;cancelled as boolean&#8221; and make sure its scope is public</li>
<li>Add the action event to the cancel button and add this code:</li>
</ol>
<pre>cancelled = true
self.close</pre>
<ol>
<li>Add a textfield name &#8220;userText&#8221; (so the user can enter something and we can send it back to the caller just to illustrate)</li>
<li>Add another property &#8220;userEnteredText as string&#8221;</li>
<li>In the &#8220;close&#8221; button add this code to its action event:</li>
</ol>
<pre>userEnteredText = userText.text
self.close</pre>
<p>Lastly, turn OFF implicit instance for the myDialog window.</p>
<p>With this technique Cancelled and userEnteredText are the &#8220;API&#8221; portion of this dialog that the rest of your app uses and cares about. In a more complex example you might return many values or a class instance but the principles are not radically different.</p>
<p>To use this in your code:</p>
<ol>
<li>On Window1 add a button and a text field &#8211; name the text field &#8220;fromDialog&#8221;</li>
<li>Add the action event to the button</li>
<li>In the action event put this code:</li>
</ol>
<pre>       dim dlg as new myDialog

       dlg.ShowModal

       if not dlg.Cancelled then
              fromDialog.text = dlg.userEnteredText
       end if</pre>
<p>Run the project to try it out.</p>
<p>You&#8217;ve now successfully made an API so whatever is using this dialog doesn&#8217;t need to know <em>how</em> things work, such as how the dialog presents and stores information. All you need to know is that you create one, tell it to &#8220;run&#8221; (the ShowModal call) and when it&#8217;s done you can ask it for &#8220;did the user cancel&#8221; and if they didn&#8217;t you can ask the dialog for &#8220;what did that user enter?&#8221; and get a reply.</p>
<p>Beyond that you don&#8217;t need to know the names of controls or anything else that dialog doesn&#8217;t want you to know about. Next time you need to do something along these lines now you know how to &#8220;make an API&#8221; you can use and save yourself a lot of headaches down the road.</p>
<p>For another way to make an input window like this, check out the example that is included with Xojo: Examples/Desktop/Windows/InputWindow.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>What is Xojo?</title>
		<link>https://blog.xojo.com/2017/02/01/what-is-xojo/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 01 Feb 2017 22:47:32 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Xojo IDE]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<category><![CDATA[Xojo Resources]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=2247</guid>

					<description><![CDATA[2017&#8217;s first &#8220;What is Xojo?&#8221; webinar was well received and there were lots of questions. Rather than include the questions in the video, I&#8217;ve included a&#8230;]]></description>
										<content:encoded><![CDATA[<p>2017&#8217;s first &#8220;What is Xojo?&#8221; webinar was well received and there were lots of questions. Rather than include the questions in the video, I&#8217;ve included a selection of those questions and detailed answers.</p>
<p>If you missed it, the recording of the presentation is available in the <a href="http://developer.xojo.com/webinar-what-is-xojo">Dev Center: What is Xojo?</a></p>
<p><strong>Q: I would use Microsoft SQL Server Express with Xojo Lite. Is this possible?</strong></p>
<p>A: You can certainly use <a href="http://developer.xojo.com/userguide/microsoft-sql-server">Microsoft SQL Server with Xojo</a>, but you will need to upgrade to a <a href="https://www.xojo.com/store/">Desktop, Web or Xojo Pro license</a>. Contact <a href="mailto:hello@xojo.com">customer support to get a quote</a>.</p>
<p><strong>Q: Will Xojo be supporting build apps for Android?</strong></p>
<p>A: Yes! We announced plans for Xojo to be able to create Android apps at the <a href="https://blog.xojo.com/2016/10/11/xdc-2016-recap/">Xojo Developer Conference in October 2016</a>. We will post milestones as we reach them on the <a href="https://blog.xojo.com">Xojo blog</a>.</p>
<p><strong>Q: Is it possible to deploy an iOS app to my own iPad?</strong></p>
<p>A: Yes, absolutely. If you don&#8217;t have an Apple Developer account, you can follow these steps to get your <a href="http://developer.xojo.com/userguide/ios-free-provisioning-profile">free Provisioning Profile from Apple</a>. If you do have an Apple Developer account, the steps are much easier: <a href="http://developer.xojo.com/userguide/device-deployment">Deploying to Device</a>.</p>
<p><strong>Q: Is there a way to show the Library and Inspector at same time?</strong></p>
<p>A: Yes! Xojo has a preference to change the Library and Inspector to <a href="http://developer.xojo.com/userguide/preferences">display as floating palettes</a>. When you do this you can have both open at the same time and can even position them on a second display.</p>
<p><strong>Q: Can iOS apps make use of low-level APIs?</strong></p>
<p>A: You can use the <a href="http://developer.xojo.com/declare">Declare command</a> to directly access iOS APIs. Some <a href="http://developer.xojo.com/ios-declare-example-projects">examples are also included with Xojo</a>. The <a href="https://github.com/kingj5/iOSKit">open-source iOSKit library</a> provides access to many additional iOS features as well.</p>
<p><strong>Q: How do you connect to database(s)?</strong></p>
<p>A: Xojo has built-in support for <a href="http://developer.xojo.com/userguide/sqlite">SQLite</a>, <a href="http://developer.xojo.com/userguide/mysql">MySQL</a>, <a href="http://developer.xojo.com/userguide/postgresql">PostgreSQL</a>, <a href="http://developer.xojo.com/userguide/microsoft-sql-server">Microsoft SQL Server</a> and <a href="http://developer.xojo.com/userguide/oracle">Oracle</a>. In addition you can use <a href="http://developer.xojo.com/userguide/odbc">ODBC</a> to connect to any other database (as long as you have a driver).</p>
<p><strong>Q: How easy is it to access the hardware features of apple devices, such as the GPS or its movements?</strong></p>
<p>A: Xojo has a built-in class for accessing location/GPS information: <a href="http://developer.xojo.com/ioslocation">iOSLocation</a>. The <a href="http://developer.xojo.com/iosmotion">iOSMotion</a> class gives you access to information about device movement from the accelerometer and gyroscope.</p>
<p><strong>Q: How do you create apps that work on both iPhone and iPad, switch screens as appropriate?</strong></p>
<p>A: You can specify different views that are used for iPhone and iPads by setting the <a href="http://developer.xojo.com/userguide/ios-screens">Screens</a>. Also, the <a href="http://developer.xojo.com/userguide/ios-split-screen">Split Screen topic</a> in the User Guide shows how iPad apps can have two views displayed at once. There are a few example projects that show this as well:</p>
<ul>
<li>Examples/iOS/Apps/XojoNotes</li>
<li>Examples/iOS/Navigation/SplitViewExample</li>
</ul>
<p><strong>Q: Where can I find Xojo training materials?</strong></p>
<p>A: You can access our vast library of online learning materials at the <a href="http://developer.xojo.com">Xojo Dev Center</a>. There you will find <a href="http://developer.xojo.com/quickstart-overvew">Quick Starts</a>, <a href="http://developer.xojo.com/tutorials-overview">Tutorials</a>, <a href="http://developer.xojo.com/userguide">User Guide</a>, <a href="http://developer.xojo.com/reference-guide">Reference Guide</a>, <a href="http://developer.xojo.com/videos">Videos</a> and much more. From our Resources page you can access our free textbook, <a href="https://xojo.com/learn/"><i>Introduction </i><i>to Prog<wbr />ramming with Xojo</i></a>, and our <a href="https://xojo.com/learn/">Teacher&#8217;s Guide</a>. Join us for free webinars and virtual events, or <a href="https://www.youtube.com/user/goxojo">watch on-demand webinars and video tutorials</a> covering all kinds of topics. If you are interested in training, <a href="https://www.xojo.com/store/#conference">Xojo offers training</a> and there are other options in our <a href="https://www.xojo.com/store/#addons">Add-On Store.</a></p>
<p><strong>Q: How would I transition a desktop Xojo app to a web service + custom web UI?</strong></p>
<p>A: You can move your desktop app&#8217;s business logic to a web app that functions as a web service. More information about that is in the <a href="http://developer.xojo.com/userguide/web-services">Web Services topic</a>, which has links to many videos on this topic. Another option to help with this is the <a href="https://github.com/timdietrich/luna">Luna open-source framework</a>. Once you have your web service set up, you can use the <a href="http://developer.xojo.com/xojo-net-httpsocket">HTTPSocket</a> in desktop, web or iOS apps to connect and use the web service.</p>
<p><strong>Q: As a Filemaker developer, can Xojo display/play photos,video, mp3 files?</strong></p>
<p>A: Yes, Xojo has built-in controls to display pictures, play video and mp3 files. Some of them include: ImageWell, WebImageView, iOSImageView, MoviePlayer, WebMoviePlayer. Also there is a web project that shows how to play audio using HTML5: Examples/Web/Controls/AudioPlayer.</p>
<p><strong>Q: How do I convert my FileMaker Apps (desktop and mobile apps) to Xojo?</strong></p>
<p>A: You&#8217;ll find some ideas at the <a href="http://developer.xojo.com/migrating-from-filemaker">Migrating from FileMaker topic</a> at the Dev Center.</p>
<p><strong>Q: Where can I find examples for developing Xojo plugins?</strong></p>
<p>A: Included in your Xojo download (in the Extras folder) is the PluginsSDK, which has documentation and examples on how to create your own plugins.</p>
<p><strong>Q: Can you say a bit about reports?</strong></p>
<p>A: Xojo desktop projects can use the <a href="http://developer.xojo.com/userguide/report-layout-editor">Report Layout Editor</a> to design reports that can be printed or displayed on the screen. There are also <a href="http://documentation.xojo.com/index.php/Third_Party_Products#Reporting">several 3rd-party reporting products</a> available.</p>
<p><strong>Q: Info about Raspberry Pi and for Apple TV?</strong></p>
<p>A: Xojo can create desktop, web and console apps that run on Raspberry Pi 2 and 3. You can find more information, with some example hardware projects here: <a href="http://developer.xojo.com/pibook/about">Raspberry Pi</a>. Xojo cannot directly create Apple TV apps, but you can use a Xojo web app as a web service to send content to Apple TV TVML apps using the open-source <a href="http://timdietrich.me/viewpoint/">Viewpoint project</a> shown by Tim Dietrich in the most recent <a href="http://www.vxug.org/meetings">Virtual Xojo User Group meeting</a>.</p>
<p><strong>Q: What happens with my Xojo Apps when the user updates their Operating System? Will I have to make an update for the Apps?</strong></p>
<p>A: Your Xojo apps are generally not affected by OS updates. Of course, you&#8217;ll want to use the latest version of Xojo to ensure you have the most recent support for the latest operating systems.</p>
<p><strong>Q: How active is the referral forum for the Pro users, specifically from the freelance developer perspective?</strong></p>
<p>A: This varies greatly, but currently there are about 2 posts per week on average with about 28 items currently listed.</p>
<h2>Thanks!</h2>
<p>Thanks to all the attendees for the great questions! Be sure to give <a href="http://www.xojo.com/download">Xojo a try today</a>. It&#8217;s free! You&#8217;ll soon be making apps faster than you ever thought possible. Additional &#8220;What is Xojo?&#8221; webinars are scheduled for <a href="http://www.xojo.com/support/webinar.php">February and March</a>. Be sure to join so you can ask your own questions. For more casual conversations, join our Lunch with Xojo hangouts in <a href="http://www.xojo.com/support/webinar.php">February and March</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
