<?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>Xojo Framework &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/xojo-framework/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, 29 Apr 2024 16:31:12 +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>Xojo MVPs Pointing Xojo in the Right Direction</title>
		<link>https://blog.xojo.com/2024/04/29/xojo-mvps-pointing-xojo-in-the-right-direction/</link>
		
		<dc:creator><![CDATA[Xojo]]></dc:creator>
		<pubDate>Mon, 29 Apr 2024 16:31:11 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Xojo Forum]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<category><![CDATA[Xojo MVP]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=12569</guid>

					<description><![CDATA[It's been too long since we last recognized the enormous amount of valuable assistance that the Xojo MVPs provide to Xojo and the community. We are so grateful to have such an amazing group of dedicated, passionate Xojo experts with so much Xojo knowledge. You may occasionally see MVPs on the forum, but much of their help is behind-the-scenes and some of what they have helped us with just might surprise you.]]></description>
										<content:encoded><![CDATA[
<p>It&#8217;s been too long since we last recognized the enormous amount of valuable assistance that the <a href="https://www.xojo.com/mvp/">Xojo MVPs</a> provide to Xojo and the community. We are so grateful to have such an amazing group of dedicated, passionate Xojo experts with so much Xojo knowledge. You may occasionally see MVPs on the forum, but much of their help is behind-the-scenes and some of what they have helped us with just might surprise you.</p>



<p>Firstly, the MVPs work as your advocates, drawing attention to issues that they feel are important to the community. Their passion comes through in all interactions with the Xojo team, from justifiably reminding us of bugs we need to address or features that would be appreciated by many.</p>



<p>Since the MVPs all use Xojo in different ways, this helps to make sure we get a wide variety of feedback. Sometimes we get direct, specific suggestions such as the <a href="https://blog.xojo.com/2023/10/10/get-set/">Set class</a>, which (due to the provided code), we were able to add as a feature to Xojo relatively quickly. Some especially valuable MVP insights regarding stack checking helped us to pinpoint areas where we could make changes to the Xojo framework that resulted in dramatic performance improvements to Xojo itself along with all your projects. MVP tips and testing have also helped us nail down some issues that helped improve debugger stabilization. MVPs have even created a supplemental unit testing suite to help test the Android framework!</p>



<p>Speaking of testing, the MVPs certainly do more than their fair share of testing. They have helped with an enormous amount of testing for many parts of Xojo, most recently including PDF, Barcode, Charts and Android. When they find bugs, MVPs always create thorough, well-explained Issues, usually with sample projects, allowing us to fix things faster for everyone&#8217;s benefit. At times MVPs even review your own submitted Issues and may offer suggestions or advice for you to try.</p>



<p>In addition to testing and providing feedback on the product as you see it today, MVPs get to see stuff early, sometimes even before designs or implementations are finalized. This may be in the form of demos or test builds. Their tips, comments and suggestions can help provide direction to how we end up actually implementing a feature or change.</p>



<p>The Xojo documentation is also continuously improved by MVP feedback and suggestions. MVPs were first to see the new documentation site before it was unveiled to everyone and their keen eyes have helped us improve search, sample code and continue to polish things.</p>



<p>From inception to documentation, this group of dedicated Xojo experts has helped us shape Xojo. If you are pleased with what Xojo is today, you should thank a Xojo MVP.</p>



<p>To Anthony, Christian, Gavin, Jeremie, Kem, Martin and Wayne we at Xojo offer a heartfelt &#8220;Thank You!&#8221; and have made donations on your behalf to several open-source projects that also help make Xojo possible: <a href="https://foundation.llvm.org">LLVM Foundation</a>, <a href="https://getbootstrap.com">Bootstrap</a> and <a href="https://ubuntu.com">Ubuntu</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>2022: Welcome Back!?</title>
		<link>https://blog.xojo.com/2022/12/13/2022-welcome-back/</link>
		
		<dc:creator><![CDATA[Alyssa Foley]]></dc:creator>
		<pubDate>Tue, 13 Dec 2022 11:00:00 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XDC]]></category>
		<category><![CDATA[Xojo Cloud]]></category>
		<category><![CDATA[Code Assistants]]></category>
		<category><![CDATA[Code Editor]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[Xojo API 2.0]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=10967</guid>

					<description><![CDATA[Does anyone else feel like 2022 is the first year in many years where we have gotten back together, in-person, for big events, small get-togethers, travel and even the daily office grind? Whether that is the right thing to have done or not, it seems that is what many of us did in 2022. Though we all tried new things to stay connected over the past few years (Zoom-fatigue anyone?), there's nothing like seeing an old friend after years apart.]]></description>
										<content:encoded><![CDATA[
<p>Does anyone else feel like 2022 is the first year in many years where we have gotten back together, in-person, for big events, small get-togethers, travel and even the daily office grind? Whether that is the right thing to have done or not, it seems that is what many of us did in 2022. Though we all tried new things to stay connected over the past few years (Zoom-fatigue anyone?), there&#8217;s nothing like seeing an old friend after years apart.</p>



<p>Xojo&#8217;s team was all vaxxed-up and so happy to get together in Nashville for #XDC2022. Tennessee&#8217;s Music City was a delightful backdrop for the first in-person Xojo event since 2019. Check out the short highlights <a href="https://youtu.be/t8xpWVL5pEM">video</a> from Nashville and then join us for #XDC2023 in London, UK. You can <a href="http://xojo.com/xdc/london/index.html">register</a> here.</p>



<p>This year the Xojo team and community welcomed a new Xojo engineer, Ricardo Cruz. Ricardo has applied his expertise to advance and improve Xojo Web. To quote one of Xojo&#8217;s engineers, &#8220;Ricardo coming in has been awesome,&#8221; a sentiment echoed on the Forum and the community in Nashville. </p>



<p>Xojo Web has come so far this year. Control reliability has improved, IDE previews have improved and reconnections have really improved. The web framework can now more often reconnect back to the same web session if it still exists. This is one of the things Ricardo is really happy about, &#8220;You can switch to your email app in your mobile, copy something to the clipboard, come back to the web app and it is still there, ready to continue.&#8221; Under the hood, some dependencies received updates, like jQuery. As a user, you don&#8217;t have to do anything, just use the new Xojo version! Try to tell that to another web developer, that&#8217;s sci-fi outside of Xojo. Also, thanks to the community, the memory and CPU usage continues to be improved release after release. &#8220;Honestly from my perspective it is just fun to play with little projects in it because it has really matured,&#8221; says Xojo&#8217;s Director of Engineering, Travis Hill. </p>



<p>Speaking of technical achievements, this year we added two new targets to Xojo: Windows on ARM 64 and Linux on ARM 64. On Windows, you can natively deploy to ARM-based tablets and laptops that run Windows. On Linux, you can deploy to 64-bit Raspberry Pi which can address significantly more RAM than 32-bit versions. </p>



<p>We built the <a href="https://www.xojo.com/cloud/">Xojo Cloud</a> Control Panel with an updated version of Xojo, and thanks to some Web framework improvements the controls now stay more responsive under load. Plus we&#8217;ve added Xojo Cloud servers in Sydney, Australia for web developers in Australia and New Zealand. We also continued improving and testing our upcoming support for Android, which is now feature complete and awaiting some remaining bug fixes before we make it available to everyone.</p>



<p>In addition, we want to brag about a few technical improvements, including the numerous <a href="https://blog.xojo.com/tag/pdf/">PDF updates</a> implemented by Xojo Engineer and now PDF expert, Javier Menéndez. Also there is the option to generate&nbsp;Program Database <a href="https://blog.xojo.com/2022/07/25/what-the-pdb-is-this/">(PDB)</a>&nbsp;files on Windows and improved <a href="https://blog.xojo.com/2022/10/12/improving-multi-monitor-support-on-windows/">multi-monitor support</a> shepherded by Xojo Engineer William Yu. The list goes on: <a href="https://blog.xojo.com/2022/04/05/using-the-new-user-code-assistants-feature/">Code Assistants</a>, <a href="https://blog.xojo.com/2022/04/05/on-device-ios-debugging-in-xojo/">on-device debugging in iOS</a>, new <a href="https://documentation.xojo.com/">Xojo Documentation</a> site, adding <a href="https://blog.xojo.com/2022/01/07/desktop-adding-controls-at-runtime/">Controls at runtime</a>, loading speed faster for big projects, and the time team-Lefebvre built a <a href="https://blog.xojo.com/2022/03/03/a-web-app-to-calculate-combat-rolls-in-twilight-imperium/">web app</a> to Calculate Combat Rolls in Twilight Imperium&#8230;</p>



<p>Inside Xojo we improved a lot too. Besides welcoming Ricardo and his beard to the team, we migrated Xojo&#8217;s bug and feature reporting platform from the internally managed Feedback tool to the much loved <a href="https://tracker.xojo.com">Issues</a>. This has increased productivity, streamlined work flow, made it easier to search and find, comment, edit. The team couldn&#8217;t be happier!</p>



<p>This year also included Xojo&#8217;s first Bug Bash in a long time! During the Bug Bash, Xojo&#8217;s <a href="https://blog.xojo.com/2022/10/12/bountiful-bug-bashing/">Code Editor</a> got some much needed improvements resulting in noticeably faster updates. Plus updates to the Syntax Help Area thanks to Xojo Engineer and retro-computing expert, Paul Lefebvre. Besides the very real smashing of 100 bugs, the bash had the unintended consequence of giving the engineers an opportunity to work on things they don&#8217;t normally work on, giving engineers opportunities to collaborate and better solve things.</p>



<p>All in all, 2022 was a year of forward movement for Xojo. Which has us leaning into 2023 with a lot of excitement and expectation. Our team is committed to continuing to make Xojo the best cross-platform development tool and we thank you for being part of Xojo&#8217;s continued success!</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 fetchpriority="high" 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="(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 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="(max-width: 1024px) 100vw, 1024px" /></figure></div>



<div class="wp-block-image"><figure class="aligncenter size-large"><img 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="(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>Prepare Your Classes to Work in Simulated or Real Modes</title>
		<link>https://blog.xojo.com/2018/06/01/prepare-your-classes-to-work-in-simulated-or-real-modes/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Fri, 01 Jun 2018 10:00:58 +0000</pubDate>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[AprendeXojo]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4321</guid>

					<description><![CDATA[In many of our development projects, if not all, we are confronted with situations when we need to test the components before the final deployment of the project. It would be just as effective, and a lot less disruptive to those using your app, to test using  a mechanism that allows us tell our apps when to run in "simulated" mode or "real".]]></description>
										<content:encoded><![CDATA[<p>In many of our development projects, if not all, we are confronted with situations when we need to test our classes before the final deployment of a project. I&#8217;m not talking about <a href="https://github.com/xojo/XojoUnit">Unit Testing</a> here, though I highly recommend the excellent session on that topic from&nbsp;<a href="https://forum.xojo.com/47544-xdc-2018-session-videos-now-available">XDC 2018</a>.</p>
<p>For example, it would not be desirable to send hundreds of emails to all the entries in a database simply to test one of the workflow steps or to verify that emails are being delivered as expected. It would be a lot simpler, and less disruptive to those using your app, to test using a few email addresses that are under your control.</p>
<p>So let&#8217;s establish a mechanism that allows us tell our apps when to run in a &#8220;simulated&#8221; mode vs. a &#8220;real&#8221; mode for all or some of the components that we need to test along the development cycle.</p>
<p><span id="more-4321"></span></p>
<p>In fact, the way we can implement this is very simple and is based in the definition of a Boolean property in every class (let&#8217;s call it <code>Simulation</code>) that we can make visible under the <b>Inspector Panel</b> using the <b>Inspector Behavior</b> feature. Doing this, we can also change it when we drag and drop the class on the Window Layout tray in order to create an implicit instance.</p>
<p>In association with the property itself, we will implement every public method that will be called from the consumer (other component or code of the app) as usual, with the only difference that we will add two additional private methods for every public method we want to run in both modes: simulated and real. For example, let&#8217;s say we have a class that returns a <code>Dictionary</code> array with data from a database. We create a public method for the class, called <code>GetData</code>, but when we just need to test other components it provides some fake data instead of connecting and retrieving a bunch of real data from the remote database. In this case we could define the following methods for the class:</p>
<ul>
<li><code>GetData() As Dictionary()</code>. Public Method, part of the visible interface for the rest of the app.</li>
<li><code>GetRealData As Dictionary()</code>. Private Method, called if the <code>Simulation</code> property is set to <code>False</code>.</li>
<li><code>GetSimulationData As Dictionary()</code>. Private Method, called when the <code>Simulation</code> property is set to <code>True</code>.</li>
</ul>
<p>Then, the real code for our public method will be simply this:</p>
<p><code>Return if(Simulation = True and DebugBuild = True, GetSimulationData, GetRealData)</code></p>
<p>Simple, isn&#8217;t it? With this you will have the maximum flexibility to choose the functionality you want to test using real or simulated data: all, none, part of them … even when you deploy the compiled project it will work always with real data.</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, Markdown Parser for Xojo, HTMLColorizer for Xojo and the Snippery app, among others</em></p>
<p>*<a href="https://www.aprendexojo.com/2018/05/prepara-tus-clases-para-uso-en-modo-simulado-o-real/">Read this post in Spanish</a></p>
]]></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>Create Your Own ImageWell Based on Canvas</title>
		<link>https://blog.xojo.com/2018/05/07/create-your-own-imagewell-based-on-canvas/</link>
		
		<dc:creator><![CDATA[Javier Menendez]]></dc:creator>
		<pubDate>Mon, 07 May 2018 10:00:26 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4179</guid>

					<description><![CDATA[Whether you are using Xojo to create your very first application or if you are coming from other languages, like C# or VisualBasic, customized UI controls are probably one of those things you have in your to-do list. For multiplatform Desktop apps, you will find that the Canvas class offers everything you need.]]></description>
										<content:encoded><![CDATA[<p>Whether you are using Xojo to create your very first application or if you are coming from other languages, like <strong>C#</strong> or <strong>VisualBasic</strong>, customized UI controls are probably one of those things you have in your to-do list. For multiplatform Desktop apps, you will find that the <a href="http://developer.xojo.com/canvas"><b>Canvas</b></a> class offers everything you need. In order to show you how easy it can be, follow this tutorial to recreate the <a href="http://developer.xojo.com/imagewell"><b>ImageWell</b></a> UI class control, provided by default in the Xojo framework. Our customized ImageWell will be able to proportionally display any JPEG file dropped by the user on the control, centering it on the available surface.<span id="more-4179"></span></p>
<p>Along the way, we also will see how the Xojo IDE simplifies making subclass properties available from the Inspector Panel, so when using their instances we can set some attributes as the background color, pen size or border color in a more convenient way.</p>
<p><img loading="lazy" decoding="async" class="size-full wp-image-4182 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/04/MyImageWellFinal.png" alt="" width="712" height="534" />As usual, the first step to create a new subclass is adding a new class item to the Desktop project (Insert &gt; Class). With the new class item selected, change its name to something descriptive. For this example we will use <code>MyImageWell</code>. The most important thing here is setting <code>Canvas</code> as its <b>Super</b> attribute. That means that the subclass will be based on the <b>Canvas</b> class, inheriting all its properties, Events and Methods so they will also be available for the subclass.</p>
<p>One of these inherited Events is <b>Open</b>, and we will implement it using the Event Handler option (click the <strong>+</strong> button in the toolbar to access the dropdown menu) in order to inform the class that we want to accept the dropped JPEG files. This is done with the following line of code in the Open Event Handler:</p>
<p><code>Me.AcceptFileDrop("img/jpeg")</code></p>
<p>Obviously, we can extend this support to accept other Xojo compatible graphical formats. For that, we would add a new <a href="http://developer.xojo.com/userguide/using-file-type-sets"><b>File Type Set</b></a> to the project, using it as the filter in the previous line of code.</p>
<p>Once we inform the class that we accept this feature, the next step is implementing the <b>DropObject</b> Event Handler that fires once this action is detected inside the limits of the control. The code we need to write for this Event Handler will test that the <code>obj</code> parameter passed along contains a valid <b>FolderItem</b> and, in that case, we will load such file as a new <b>Picture</b> object, assigning it to a property of the same Type. The code for the event is:</p>
<pre>If obj.FolderItemAvailable Then
  image = Picture.Open(obj.FolderItem)
  Invalidate
End If</pre>
<p>Don&#8217;t forget to add the <code>Image</code> computed property to the Class using Insert &gt; Computed Property while the <code>MyImageWell</code> item is still selected, and using these values:</p>
<ul>
<li><b>Name</b>: Image</li>
<li><b>Type</b>: Picture</li>
<li><b>Scope</b>: Public</li>
</ul>
<p>As you can see, the amount of code we need to load the file as a Picture object and to assign it to the class property is minimal! Why do we use the <b>Invalidate</b> method call afterwards? Well, this is responsible for informing the operating system to redraw the instance when it has a chance. And when this happens it will fire the third and last Event we need to implement: <b>Paint. </b>Here is where we can instruct any Canvas based control how to draw itself through the graphical context represented by the <strong><code>g</code></strong> parameter passed along the Event.</p>
<h2>Painting the control</h2>
<p>Once we&#8217;ve added the <b>Paint</b> Event to the class and before writing the code responible of painting the dropped image inside its limits, we need to add three additional computed properties. We will use them to set some attributes like the color we want to use to paint the control background, the border color and even the width of the border:</p>
<ul>
<li><code>BackGroundColor As Color = &amp;cdddddd</code></li>
<li><code>BorderColor As Color = &amp;c000000</code></li>
<li><code>PenSize as Integer = 2</code></li>
</ul>
<p>Add to the Setter method on every computed property the sentence me.invalidate; so every time we assign a new value to them… the control will be redrawn using the new value (background color, border color, pen size or even a new assigned picture).</p>
<p>The last step is writing the code responsible for drawing the control itself: filling the background with the set color, then drawing proportionally (and centered) the loaded picture pointed by the <code>Image</code> property, and finally drawing the border with the width and color specified. All of this is what we can do using the following snippet of code:</p>
<pre>// We fill the control background using the set color
g.DrawingColor = BackgroundColor
g.FillRectangle(0,0,g.Width,g.Height)

// If we have a valid image object, then we draw it centered and scaled (if necessary)
If image &lt;&gt; Nil Then 
  Var Height, Width As Integer
  Var sourcey, sourcex As Integer = 0 
  If image.Height &gt; image.Width Then
    Height = Me.Height
    Width = (Me.Height * image.Width) / image.Height
    sourcey = (Me.Width - Width) / 2
  Else
    Width = Me.Width
    Height = (Me.Width * image.Height) / image.Width
    sourcex = (Me.Height - Height) / 2
  End If

  // This is the line that actually draws a picture inside the graphic context of our instance
  g.DrawPicture(image,sourcey,sourcex,Width,Height,0,0,image.Width,image.Height)
End If

// We draw the control border
g.PenSize = me.PenSize
g.DrawingColor = BorderColor

g.DrawRectangle(0,0,Me.Width,Me.Height)</pre>
<p>As you can see, the code needed for this is also very simple!</p>
<h2>Make the properties visible from the Inspector Panel</h2>
<p>While we are on it, we can use the <b>Inspector Behavior</b> feature to make our specific properties visible through the Inspector Panel. This way, when we add new instances from the subclass to the layout of any window, we will be able to easily set their values directly from the Inspector Panel. With the <code>MyImageWell</code> item still selected in the Project Browser, use the contextual menu to select the <b>Inspector Behavior</b> option to access the following Window:</p>
<p><img loading="lazy" decoding="async" class="size-full wp-image-4180 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/04/InspectorBehavior.jpg" alt="" width="721" height="459" /></p>
<p>Here you will see all the Class properties, those common to all <b>Canvas</b> derived subclasses and also the ones added for us and that are specific to our class. You can find these properties listed under the <b>Behavior</b> section. To make them visible in the Inspector Panel we just need to check their associated checkboxes; and even modify their default values editing the associated cell if we want to.</p>
<p><img loading="lazy" decoding="async" class="size-full wp-image-4181 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/04/InspectorPanelOwnClass.png" alt="" width="322" height="257" /></p>
<p>Now, we just need to drag and drop the <code>MyImageWell</code> item from the Project Browser into any Window Design Layout in order to add new instances! Once we run the example project, we will see how the controls react to displaying any JPEG picture dropped on it.</p>
<p>If you want, you can investigate deeper into the methods provided by the <a href="http://developer.xojo.com/graphics"><b>Graphics</b></a> class in order to make the control more glittery or more sophisticated.</p>
<p>You can watch <a href="https://www.youtube.com/watch?v=val_Bcgw_4U">this video</a> (en español) to see this in action:</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/2018/04/crea-tu-propio-imagewell-con-canvas/">Read this post in Spanish</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Flash a Window Using a WinAPI Declare</title>
		<link>https://blog.xojo.com/2018/05/01/flash-a-window-using-a-winapi-declare/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Tue, 01 May 2018 10:00:28 +0000</pubDate>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Declares]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4116</guid>

					<description><![CDATA[You can call into Win32 APIs (aka WinAPI) 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 Microsoft's documentation: Microsoft Developer Documentation.]]></description>
										<content:encoded><![CDATA[<p>You can call into Win32 APIs (aka WinAPI) 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 Microsoft&#8217;s documentation: <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/hh920508(v=vs.85).aspx">Microsoft Developer Documentation</a>.</p>
<p><span id="more-4116"></span></p>
<p>The Win32 API is largely based on the C/C++ programming language and makes heavy use of structures.</p>
<p>As a simple example, you can call a simple function to flash the window to get the user&#8217;s attention. Refer to the <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms679346%28v=vs.85%29.aspx?f=255&amp;MSPPError=-2147217396">FlashWindow doc page</a> in the Microsoft Win32 docs, where you can see the declaration for this method. It looks like this:</p>
<pre>BOOL WINAPI FlashWindow(
 _In_ HWND hWnd,
 _In_ BOOL bInvert
);</pre>
<p>This tells you that this method is a function (the BOOL at the beginning indicates it returns a Boolean) and that it takes two parameters. The HWND parameter is the handle to the window, which you get from Xojo as Window.Handle (it is an Integer). The BOOL parameter is a Boolean. At the bottom of the doc page there is a section that tells you the library that contains this function, which is &#8220;User32.lib&#8221;. With this this information you can create the Declare statement to this function, which looks like this:</p>
<pre>Declare Function FlashWindow Lib "User32" (handle As Integer, invert As Boolean) As Boolean</pre>
<p>You can call this function by passing in a window handle, so if you had the above Declare on a button&#8217;s Action event handler you could flash the window with this code:</p>
<pre>Call FlashWindow(MyWindow.Handle, True)</pre>
<p>Since the return value is not needed, the Call statement is used to avoid having to declare a variable to store the result.</p>
<p>If you wanted to make this more easily accessible you could use the Extends method feature to make this available for any window. To do this, create a global method on a module with this code:</p>
<pre>Public Sub Flash(Extends w As Window)
  #If TargetWindows Then
    Declare Function FlashWindow Lib "User32" (handle As Integer, invert As Boolean) As Boolean
    Call FlashWindow(w.Handle, True)
  #EndIf
End Sub</pre>
<p>You could then call this method with this code:</p>
<pre>Self.Flash</pre>
<p>For more information:</p>
<ul>
<li><a href="http://developer.xojo.com/calling-native-windows-apis">Calling Native Windows APIs</a></li>
<li><a href="https://blog.xojo.com/2017/12/20/winapilib-on-github/">WinAPI Library</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Center a Window Using a macOS Declare</title>
		<link>https://blog.xojo.com/2018/04/30/center-a-window-using-a-macos-declare/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Mon, 30 Apr 2018 10:00:22 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Declares]]></category>
		<category><![CDATA[macOS]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4113</guid>

					<description><![CDATA[You can call into Cocoa APIs to use methods and properties that are not built into the Xojo framework by using the Declare command. To create a Declare statement you first need to track down the API you want to use using Apple's documentation: Apple Developer Documentation.]]></description>
										<content:encoded><![CDATA[<p>You can call into Cocoa APIs to use methods and properties that are not built into the Xojo framework by using the <a href="http://developer.xojo.com/declare">Declare command</a>. To create a Declare statement you first need to track down the API you want to use using Apple&#8217;s documentation: <a href="https://developer.apple.com/documentation/">Apple Developer Documentation</a>.</p>
<p><span id="more-4113"></span></p>
<p>Most of the time you will reference the Foundation and AppKit libraries, but there are many other libraries as well. Xojo Declares use the Objective-C names so be sure to refer to those in the documentation rather than the Swift naming.</p>
<p>When you call Cocoa methods, you supply the method name using the Selector part of the Declare command. The selector name has to end in a &#8220;:&#8221; if there are any parameters that are passed, an oddity of how Objective-C works. Unlike with Xojo methods, the case of the name also has to match exactly. For the Xojo Declare, the first parameter is always required and must be a reference to the class containing the method you are calling.</p>
<p>To start with a simple example, consider that you may to center a window on the screen. You can obviously do this by manually adjusting the window&#8217;s Top and Left properties by taking into account the window size and the screen size, but Cocoa has a simple center function that can be used on a window.</p>
<p>On macOS, a Xojo window is actually a native NSWindow. When you view Apple&#8217;s docs for NSWindow you&#8217;ll see there is a center method. This method is very simple as it does not take any parameters. Looking at the doc page you should note that this function is in the AppKit library. Now you can create a Declare command to map to the center method:</p>
<pre>Declare Sub centerWindow Lib "AppKit" Selector "center" (windowHandle As Integer)</pre>
<p>Remember, even though the center method does not take any parameters, you still have to add a parameter to the Declare so you can pass in the reference to the calling class, which in this case is the window to center.</p>
<p>You can call this method like this (such as from a button&#8217;s Action event handler):</p>
<pre>centerWindow(Self.Handle)</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 Center(Extends w As Window)
  #If TargetMacOS Then
    Declare Sub centerWindow Lib "AppKit" Selector "center" (windowHandle As Integer)
    centerWindow(w.Handle)
  #EndIf
End Sub</pre>
<p>Note the use of the &#8220;#If TargetMacOS&#8221; line. This prevents this code from being compiled into Windows or Linux builds of your app where the code could possibly 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.Center</pre>
<p>To learn more about macOS Declares:</p>
<ul>
<li><a href="http://developer.xojo.com/calling-native-macos-apis">Calling Native macOS APIs</a></li>
<li><a href="http://developer.xojo.com/mac-declare-samples">Mac Declare Samples</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>XDC 2018 Keynote Recap</title>
		<link>https://blog.xojo.com/2018/04/25/xdc-2018-keynote-recap-draft/</link>
		
		<dc:creator><![CDATA[Alyssa Foley]]></dc:creator>
		<pubDate>Wed, 25 Apr 2018 16:00:46 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[XDC]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Introspection]]></category>
		<category><![CDATA[Keynote]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4197</guid>

					<description><![CDATA[Geoff just wrapped up the Keynote at this year&#8217;s XDC here in beautiful Denver, Colorado. The stately ballroom at the Magnolia Hotel was packed. After&#8230;]]></description>
										<content:encoded><![CDATA[<p>Geoff just wrapped up the Keynote at this year&#8217;s XDC here in beautiful Denver, Colorado. The stately ballroom at the Magnolia Hotel was packed.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-4242" src="https://blog.xojo.com/wp-content/uploads/2018/04/keynote-2018.jpg" alt="" width="591" height="331"></p>
<p>After a brief intro and some bragging about how this XDC sold out faster than any XDC before, how 25% of attendees are first-timers and how Xojo is represented by users from 12 different countries &#8211; shoutout to <a href="http://developer.xojo.com/francais">Stephane Pinel</a> Xojo&#8217;s French Evangelist and and <a href="http://developer.xojo.com/spanish">Javier Menendez</a> our Spanish Evangelist who is attending for the first time (don&#8217;t think he&#8217;s a newbie though, he&#8217;s been with Xojo for 10 years), Geoff discussed the Xojo Community. Our forum has grown over 20% since the last XDC, with 18,000 members and over 43,000 conversations.</p>
<h3>Xojo Cloud</h3>
<p>People use Xojo Cloud because zero-configuration is an obvious advantage &#8211; we install more than 100 software updates per year which is 100+ actions that protect your app and your data that you don&#8217;t have to manage or install yourself. But it&#8217;s the industrial strength security that adds the most value. Xojo Cloud servers have been scanned over 1 billion times with zero known breaches to date. While no one can make servers 100% secure, Xojo Cloud certainly has proved itself to provide best-of-class security which is absolutely critical in today’s always-on, always-connected world. Check out <a href="https://www.xojo.com/cloud/">Xojo Cloud</a>&#8216;s bigger and better servers &#8211; now with <a href="https://blog.xojo.com/2018/04/18/xojo-cloud-server-stats/">monitoring and stats</a> build into the Xojo IDE.</p>
<p><img loading="lazy" decoding="async" class="wp-image-4205 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/04/XojoCloudStats-1.png" alt="" width="670" height="423"></p>
<h3>Platform Landscape</h3>
<div class="page" title="Page 59">
<div class="section">
<div class="layoutArea">
<div class="column">
<p>When we started back in 1998, the desktop was really the only platform that mattered for applications. But it&#8217;s over 20 years later and mobile has certainly become an important platform. It&#8217;s interesting to note that through 2017 and now into 2018, mobile is treading downward slightly and desktop is trending upward.</p>
<p><img loading="lazy" decoding="async" class=" wp-image-4211 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/04/desktop-vs-mobile.png" alt="" width="631" height="471"></p>
<div class="page" title="Page 61">
<div class="section">
<div class="layoutArea">
<div class="column">
<p>Illustrating that whether you focus on mobile or desktop, cross-platform development is more important now than ever before. As always, Xojo abstracts you from all of this and highlights the importance of a cross-platform tool.</p>
<h3>Foundational Improvements to Xojo</h3>
<p>Since the last conference we&#8217;ve fixed 815 bugs, made 151 changes, added 64 new features to Xojo, this is all aside from our main focus of modernizing the foundation upon which your apps and Xojo itself is built. A lot of this foundational work we&#8217;ve covered as it happened: <a href="https://blog.xojo.com/2017/04/12/windows-graphics-direct2ddirectwrite-direction/">Direct 2D and DirectWrite</a> for hardware-accelerated, modern graphics on Windows. Upgrading to <a href="https://blog.xojo.com/2018/04/17/change-window-opacity-using-a-linux-gtk-declare/">GTK3</a> to provide <a href="https://blog.xojo.com/2016/04/05/xojo-retinahidpi-the-journey-of-a-thousand-pixels/">HiDPI</a> on Linux. And, of course, you can now build <a href="http://developer.xojo.com/64-bit-guidelines">64-bit</a> applications which is increasingly becoming the accepted standard. For 64-bit builds and for Raspberry Pi, the compiler now <a href="https://blog.xojo.com/2018/01/31/compilers-106-optimizer/">optimizes your code for speed</a>. For apps that do a lot of calculations, this can provide a huge improvement. Xojo user Thomas Moore recently reached out to let us know how the optimized compiler sped up the app he&#8217;s working on for NASA&#8217;s LISA project.</p>
</div>
<h3>Xojo Compiler Optimizations Speed up Calculations for NASA</h3>
<div class="page" title="Page 73">
<div class="section">
<div class="layoutArea">
<div class="column">
<p>Thomas Moore is a long time Xojo user and a Professor pf Physics at Cal Poly Pomona. He’s written an app in Xojo to help with his research for the proposed LISA mission in which NASA will launch 3 satellites to form a triangle 3 million miles on each side, letting us better detect gravitational waves. Thomas&#8217; app will be analyzing the massive (seriously massive) amount of gravitational wave data downloaded from these satellites. Once he was able to compile his app for 64-bit and gain the benefit of the optimizing compiler, he saw an immediate gain of 7X. The compiler optimizations provided a speed increase nearly equal to what he had gained over 10 years of advances in computer technology.</p>
<h3>LLVM</h3>
<p>The ability for Xojo to optimize your code is the direct result of our move to LLVM as our compiler backend. As it’s improved in the future with more optimizations, we will update and you’ll get them automatically.</p>
<h3>64-bit IDE</h3>
<div class="page" title="Page 81">
<div class="section">
<div class="layoutArea">
<div class="column">
<p>Since the Xojo IDE is written in Xojo, we&#8217;ve been building it as a 64-bit app since 2017r3. It&nbsp;was no small task since the Xojo IDE is quite a large project. For the overwhelming majority of you, <a href="https://blog.xojo.com/2017/07/18/big-transitions-little-effort-one-apps-update-to-64-bit/">building a 64-bit</a> version of your apps required nothing more than switching a setting and rebuilding. Given that macOS now warns users when they launch 32 bit apps, it’s even better that Xojo is now 64 bit. These changes are all about modernizing the foundation upon which your apps are built. This not only means you don’t have to worry about it, but it also makes many of our future plans for Xojo possible.</p>
<div class="page" title="Page 83">
<div class="section">
<div class="layoutArea">
<div class="column">
<h3>The Future</h3>
<p>Much like building a house, there is extensive foundational work to be done up front. We are often working on new features across several releases. Despite our best efforts, there are a few things we’d hoped to have ready by now such as Interops and Plugins.</p>
<p>Interops make it much easier to call into the system when something you need isn’t provided by the Xojo framework. We are making great progress on Interops for Android which is likely the first platform upon which they will be supported. In fact, the Android framework is being built in Xojo using Interops. We’ve been working very hard for some time now to provide support for Android. There’s a lot to talk about and Travis will be covering it in detail in his session later today and we&#8217;ll post more on our blog as we reach milestones.*</p>
<p>As for Plugins, we had hoped by now to have the ability to write plugins for Xojo in Xojo by now. Unfortunately, other things have taken priority. However, plugins are important to us and we continue to work on that.</p>
<p>In addition, there are some user experience changes we were planning to make project navigation faster and more efficient. We have been overhauling the underpinnings required to make all of that possible. Just like building that house, the hard part comes first and then it gets a lot easier towards the end. In order to make it easier to build desktop-like web apps we&#8217;re upgrading the web framework to Web Framework 2.0. This will include significant modernizations and optimizations, more robust applications, greater speed between client and server, overhauling of 5 controls and 10 new controls, an improved look and feel and will be 99% compatible with existing projects. If you’re currently building web apps or planning to, this is going to be a huge step forward, Greg will cover this in more detail in his session.*</p>
<h3>Xojo API 2.0</h3>
<div class="page" title="Page 124">
<div class="section">
<div class="layoutArea">
<div class="column">
<p>As we went down the path to the new Xojo Framework we realized there were a lot inconsistencies. Methods, properties and events that did the same or similar things across different classes often had dissimilar names. We discovered several other types of inconsistencies in the naming as well. So we&#8217;ve turned our direction to give you the best of both worlds.</p>
<p><img loading="lazy" decoding="async" class=" wp-image-4212 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/04/best-of-both-worlds.png" alt="" width="710" height="531"></p>
<p>This keeps the Xojo language simple and it eliminates the need for us to put all the APIs into namespaces, removing that bit of complexity as well. This also makes the transition easier for us because we can roll out the new APIs over time rather than being required to have an entire functional set of new APIs all at once. API 2.0 will provide you with more consistent APIs across classes with improved functionality while keeping Xojo easy to learn and use as well as making your transition easy as well.</p>
<h3>XDC 2019</h3>
<p>That&#8217;s right, we&#8217;re announcing XDC 2019 in beautiful Miami, Florida! We will be at the Miami Marriott Biscayne Bay which is right on the water. You&#8217;ll get great views from the hotel, a beautiful park and a 3 mile straight shot across the bay to South Beach! Reminder that we sold out this year quite quickly (faster than ever before) so make sure you register early to not only reserve your spot but save $200 as well!</p>
<p><img loading="lazy" decoding="async" class="wp-image-4213 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2018/04/xdc-2019.png" alt="" width="643" height="481"></p>
<p>We&#8217;ll be keeping you updated on more from Denver on <a href="https://twitter.com/xojo">Twitter</a> and sharing live videos on <a href="https://www.facebook.com/goxojo/">Facebook</a> over the next 3 days! Thanks for sharing and using #XDC2018, we hope to see you next year at XDC 2019 in beautiful Miami, Florida.</p>
<p>*Videos of XDC sessions and the Keynote will be available for purchase next month. You can &nbsp;purchase previous <a href="https://www.xojo.com/store/#conference">XDC session videos</a>&nbsp;from 2015 and 2016 at a 20% discount this week only!</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Get Better Dates with the New Xojo Framework</title>
		<link>https://blog.xojo.com/2017/11/04/get-better-dates-with-the-new-xojo-framework/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Sat, 04 Nov 2017 10:00:33 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Date Class]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=3337</guid>

					<description><![CDATA[If you've written code for long enough, you've probably had bugs where you failed to consider some of the differences between two dates. This example deals only with time zones but the Date and DateInterval classes also handle leap years for you as well. The changes to date and time handling in the New Xojo framework are just a few examples of why we have created it and why it's worth your time to start using it.]]></description>
										<content:encoded><![CDATA[<p><a href="https://imgs.xkcd.com/comics/supervillain_plan.png"><img loading="lazy" decoding="async" class="aligncenter" src="https://imgs.xkcd.com/comics/supervillain_plan.png" alt="" width="372" height="492" /></a></p>
<p>Time zones can cause confusion even for super villains. But the Xojo framework has got you covered, whether you are out to do good or evil.</p>
<p><span id="more-3337"></span></p>
<p>If you&#8217;ve written code for long enough, you&#8217;ve probably had bugs where you failed to consider some of the differences between two dates.</p>
<p>Consider the following <em>Classic Xojo framework</em> example that adds 3 hours to a specific date:</p>
<pre>Dim d As New Date(2017, 11, 5)
d.Hour = d.Hour + 3
MsgBox(Str(d))</pre>
<p>Easy enough, right? Unfortunately, while code like this will provide the correct result most of the time, it won&#8217;t this time because on November 5th, 2017 here in the United States, Daylight Savings ends. As a result, the value return will be off by an hour.</p>
<p><em>API 2.0</em> solves this problem by introducing the DateTime and DateInterval classes which is used to add or subtract time and takes into account time zones:</p>
<pre>Var d As New DateTime(2017, 11, 5, 0, 0, 0, 0, TimeZone.Current)
Var di As New DateInterval(0, 0, 0, 3)
d = d + di
MessageBox(d.ToString)</pre>
<p>This example creates a new date and provides the current time zone then creates a DateInterval and assigns it 3 hours. The DateInterval is then added to the date and the result displayed. This code will always be correct because time zones are being considered. This one is pretty straightforward because it&#8217;s only dealing with US Daylight Savings Time but imagine if one date was tied to someone in the US and another to someone in Europe. Not only do you have different time zones but Daylight Savings Time starts and stops on different dates between the US and Europe. The new DateTime and DateInterval classes in API 2.0 handle all of that complexity for you. Because the new DateTime class understands time zones, using TimeZone.Current for example, means you don&#8217;t even have to think about it at all. Your calculations will just work no matter where the user is in the world.</p>
<p>The API 2.0 solution requires one extra line of code. However, that one extra line gets you code that will always produce the correct result. The Date class in the Classic Xojo framework will be right most of the time but when it&#8217;s wrong, you may wrack your brain for a while trying to figure out why. That extra line of code is worth every keystroke.</p>
<p>This example deals only with time zones but the DateTime and DateInterval classes also handle leap years for you as well. That&#8217;s another example where it would be very easy to miss the fact that a leap year occurred and get the wrong result.</p>
<p>The changes to date and time handling in API 2.0 are just a few examples of why we have created it and why it&#8217;s worth your time to start using it.</p>
<p>Note: This post was updated for API 2.0 on June 15th, 2020.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Daring to Defy Software Extinction: A Limited History of Development Tools</title>
		<link>https://blog.xojo.com/2017/06/21/daring-to-defy-software-extinction-a-limited-history/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Wed, 21 Jun 2017 14:00:41 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Beginner Tips]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=2952</guid>

					<description><![CDATA[For 20 years Xojo has survived and thrived as a Development Tool. We have outlasted many of the tools that were our competitors back in the 1990's. Download Xojo today and see why we have stood the test of time.]]></description>
										<content:encoded><![CDATA[<p>In 1998 Steve Jobs was the interim CEO of Apple and trying to keep his unprofitable company from sinking into bankruptcy. Just the previous year, when asked what he would do if he were in charge of Apple, Dell CEO Michael Dell said, &#8220;I&#8217;d shut it down and give the money back to the shareholders.&#8221;</p>
<p>The Mac had single digit marketshare. Creating a development tool, independently of Apple or any company that makes a platform such a tool would support, was considered a fool&#8217;s errand. There were plenty of tools available from large companies. Apple made MPW (the Macintosh Programmer&#8217;s Workshop). Symantec created THINK C. Metrowerks developed CodeWarrior.  IBM&#8217;s VisualAge. Macromedia Flash. If you needed to create a cross-platform desktop app, you&#8217;d be told to look no further than SUN Microsystems Java: THE cross-platform language. We were all promised that Java was going to run on everything from our computers to our cars to our can openers. Java was the safe and popular choice. Developers made up only about 5% of computer users anyway. Honestly, who would be crazy enough to launch a new development tool in a  market crowded by giants?</p>
<p>We were.</p>
<p><span id="more-2952"></span></p>
<p>On July 4th of that same year, in a 10&#8242; x 10&#8242; booth at MacWorld Expo, the four of us that made up the fledgling company that is now Xojo, shipped version 1.0 of a new development tool that did one thing and one thing only: made it easy for regular people to create apps for the Mac.  It was not the most auspicious start but it didn&#8217;t matter to us. <strong>We believed in what we were doing.</strong> We believed that we were creating something that would enable ordinary people to do extraordinary things.</p>
<p>That our highest revenue days each week were Saturday and Sunday told us that our initial users were mostly hobbyists. Over the next year it shifted to the weekdays, telling us that people were building solutions for their jobs. Eventually commercial applications began to appear. Once we had a decent-sized user base, some prospective users, who were planning to make serious investments of their time, started asking the inevitable question of software extinction, &#8220;What happens if you guys go out of business?&#8221;<a href="http://blog.xojo.com/wp-content/uploads/2017/06/Ltd-History-of-Dev-Tools-Info-Graphic.pdf" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="aligncenter wp-image-3003 size-full" src="https://blog.xojo.com/wp-content/uploads/2017/06/Ltd-History-of-Dev-Tools-Info-Graphic.png" alt="" width="800" height="2000" /></a></p>
<p>As much as I didn&#8217;t like hearing it, at the time it was a very legitimate question without a great answer. They would point to all the other development tools and propose that it would be safer to choose of them. Of course it would take much longer with one of those tools and if we didn&#8217;t go out of business that &#8220;safe&#8221; choice of theirs would end up being a very expensive insurance policy.</p>
<p><strong>While it can be argued that the question of software extinction is always a relevant one, we have been providing and improving Xojo for almost 19 years.</strong> And in that time it&#8217;s gone from a development tool that built only Mac applications for System 7 running on a 68000 or PowerPC processor, to supporting an entirely new MacOS, multiple versions of Windows and Linux, console apps, web apps, iOS, Raspberry Pi and of course both X86 and ARM processors.  The framework has been through many updates to modernize its underlying systems while users have been mostly abstracted from these changes. We are rolling out a new framework that is mostly like the old one but makes some important modernizations to prevent common problems users face, including making it far more consistent and utilizing more OS-level functionality so that apps automatically use the latest libraries for functions such as HTTP, SSL and more. This Xojo framework is designed to allow you to migrate parts of your app as you need to do so. It&#8217;s an incremental process rather than a monumental one.</p>
<p><strong>Part of the success of Xojo is not just its continued existence and evolution, but that those of us who had the original vision to bring it to life are still continuing to nurture it, help it grow and keep it modern.</strong> Though more have joined us along the way, there&#8217;s tremendous value in the consistency of vision.</p>
<p>What about those other development tools that were such good bets back in 1998?</p>
<ul>
<li>Visual Basic 6 is dead and has been replaced by Visual Basic.NET which is so different that many VB6 users began calling it &#8220;Visual Fred&#8221; as a way of mocking it.</li>
<li>Macintosh Programmer&#8217;s Workshop is long dead.</li>
<li>Symantec&#8217;s THINK C is dead.</li>
<li>Metrowerks CodeWarrior was purchased by Motorola and is now focused exclusively on the embedded systems market.</li>
<li>Borland Delphi is still around but was sold to another company and has become very expensive.</li>
<li>IBM has discontinued VisualAge</li>
<li>Java is of course still around but few use it for desktop applications after it proved to not be a good solution but a far better one for server-side applications. However, it&#8217;s no longer in the hands of original visionaries that brought it to market as SUN Microsystems was purchased by Oracle in 2009.</li>
<li>Flash has been acquired by Adobe and while it is still in use, it&#8217;s clearly on its way out</li>
</ul>
<p>If back in 1998 you chose to write your app in Xojo (then REALbasic), you have been able to continue to improve it and keep it running &#8211; not just on the latest version of the desktop OS you care about but several new operating systems and platforms as well. 19 years after that MacWorld Expo, we are still here and still providing the vision of what Xojo will be in the future. <strong>We continue to improve and modernize Xojo so that you can do what you do best: focus on what makes your application unique.</strong></p>
<p>While the question of what you should do if you find your development tool of choice extinct or perhaps not properly cared for will always be a relevant one, we have shown that not only has Xojo stood the test of time, but that we have done so far better than most of our competitors who are an order of magnitude or more larger than we are.</p>
<p>No one can guarantee a product will be around forever. Even open source projects survive only as long as there are enough interested parties willing to donate their time and energy to continued development.  One of our engineers once said that, &#8220;Source Forge is littered with the corpses of open source projects.&#8221; Having said that, I can tell you that the people who bring Xojo to you are extraordinarily dedicated and talented. Our annual turnover rate (the rate at which people come and go at Xojo, Inc.) is only 5% which puts us amongst the best of the best in this area. This is not a happy accident, but very much by design. We have learned over the years to hire mostly users. In fact, nearly every member of the team began as a user. Those that didn&#8217;t, have been on the team for an average of 12.5 years. In an industry that sees people come and go through companies like a revolving door, the fact that people tend to stay at Xojo is a fact of which I am immensely proud.</p>
<p>It is our continued privilege to bring Xojo to you, to be a little part of your dreams, your aspirations, and to have you as a member of the Xojo community. Our next <a href="https://www.xojo.com/xdc/">reunion</a> will be April 25th-27th, 2018 in Denver, Colorado. We hope to see you there.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Xojo.Net.HTTPSocket Speed on Windows</title>
		<link>https://blog.xojo.com/2017/03/09/xojo-net-httpsocket-speed-on-windows/</link>
		
		<dc:creator><![CDATA[Greg O'Lone]]></dc:creator>
		<pubDate>Thu, 09 Mar 2017 06:46:11 +0000</pubDate>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[HTTPSocket]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=2233</guid>

					<description><![CDATA[There&#8217;s been a bit of discussion about how the new Xojo.Net.HTTPSocket is slow for some users on Windows, which we&#8217;ve been trying to isolate to&#8230;]]></description>
										<content:encoded><![CDATA[<p>There&#8217;s been a bit of discussion about how the new <a href="http://developer.xojo.com/xojo-net-httpsocket">Xojo.Net.HTTPSocket</a> is slow for some users on Windows, which we&#8217;ve been trying to isolate to get fixed.</p>
<p>After a bit of experimentation this January we were able to isolate one huge cause of this annoying behavior. Unfortunately it has to do with a misconfigured IPv6 DNS server configuration and whether or not yours is correct may be up to your service provider.</p>
<h3>Whose bug is this?</h3>
<p>According to the spec, IPv6 DNS servers are <em>supposed to</em> return immediately if they can&#8217;t fulfill the request. Unfortunately this is almost the exact opposite of what an IPv4 DNS server does, in that it <em>may</em> forward your request to the next server to see if it knows where your request should go. Unfortunately we found that only about two-thirds of the ones we tested were correctly configured.</p>
<p>On macOS and Linux, DNS requests are sent concurrently, that is, two requests are sent at the same time, one each for IPv4 and IPv6. The one that returns first is used. On Windows, the requests are unfortunately sent sequentially, IPv6 <em>and then IPv4</em>. What this means is that IPv6 requests just hang there, waiting for a response that will either never come or will wait until the underlying socket reaches its timeout. When that fails, the IPv4 request is sent and fulfilled and your socket request goes through.</p>
<h3>What To Do</h3>
<p>Here are a few things you can do to test this theory. While you can&#8217;t really ask all of your users to do this, it will tell you if this is where the problem lies.</p>
<ol>
<li>Turn off IPv6.
<ol>
<li>Click <strong>Start</strong> and then <strong>Settings.</strong></li>
<li>Search for <strong>Network Connections</strong>.</li>
<li>Click <strong>View network connections</strong>.</li>
<li>Right-click on the active connection and select <strong>Properties</strong>.</li>
<li>On the <strong>Networking</strong> tab, clear the <strong>Internet Protocol Version 6 (TCP/IPv6)</strong> check box, and then click <strong>OK</strong>.</li>
</ol>
</li>
<li>Change the DNS entries for IPv6 from the defaults to point to <a href="https://developers.google.com/speed/public-dns/">Google Public DNS</a> or <a href="http://opendns.com">OpenDNS</a>.</li>
<li>Make a Hosts file entry. If your installer runs as an administrator, you can make an entry in the hosts file to force the computer to use IPv4. <em><em><em>This is not a long term solution as the world moves to IPv6.</em></em></em>The hosts file on Windows 7/8/10 is located at:
<pre>C:\Windows\System32\drivers\etc</pre>
<p>and you should add an entry which looks like this:</p>
<pre>Server IP Address&lt;TAB&gt;domain name</pre>
</li>
<li>If it&#8217;s a domain that you control, make sure you only use IPv4 DNS entries and that your server is only listening on the IPv4 interface.</li>
</ol>
<p>All in all, it&#8217;s a frustrating problem. While there&#8217;s no easy solution, the good news is that because there are no IPv4 addresses left to be distributed, the world <em>is</em> moving to IPv6. The more demand there is, the more likely that the incorrect DNS servers will get fixed because they&#8217;ll cause problems for other sites as well.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Web Framework Changes in 2016r2</title>
		<link>https://blog.xojo.com/2016/07/20/web-framework-changes-in-2016r2/</link>
		
		<dc:creator><![CDATA[Greg O'Lone]]></dc:creator>
		<pubDate>Wed, 20 Jul 2016 07:03:46 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[HiDPi]]></category>
		<category><![CDATA[Retina]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">http://blog.xojo.com/?p=1085</guid>

					<description><![CDATA[The web framework got some love in Xojo 2016r2&#8230; General Changes First, the Web Framework now has support for Retina/HiDPI in supported browsers. All controls&#8230;]]></description>
										<content:encoded><![CDATA[<p>The web framework got some love in Xojo 2016r2&#8230;</p>
<h2>General Changes</h2>
<p>First, the Web Framework now has support for Retina/HiDPI in supported browsers. All controls have been updated with new graphics to allow your Web Apps to look great on any screen. All you have to do is just flip the &#8220;Supports Retina/HiDPI&#8221; switch and start using Image objects instead of Pictures and you&#8217;re off and running!</p>
<p><em>NOTE: Regardless of whether you check the &#8220;Supports Retina/HiDPI&#8221; switch, the web framework now stores all of your image assets in the Resources directory next to your app and they are only loaded momentarily when a browser requests one. This means that your app should use a lot less memory overall.</em></p>
<p><strong>Controls</strong></p>
<p>WebCanvas: HiDPI/Retina drawing out of the box! No code change required!</p>
<p>WebPicture: Just start using Images instead of Pictures and flip the Retina/HiDPI switch and the web framework will automatically send the correct resolution image to the browser.</p>
<p>WebImageView: Because it&#8217;s backed with a WebPicture, it just works!</p>
<p>WebToolbar: Toolbar icons now support Images as well.</p>
<p><strong>Events</strong></p>
<p>WebSession.ScaleFactorChanged: Fires whenever the ScaleFactor of the current session&#8217;s browser changes.</p>
<p><strong>Properties</strong></p>
<p>WebSession.ScaleFactor (Read-Only): Reflects the current ScaleFactor of the browser.</p>
<h2>WebSDK</h2>
<p>The WebSDK has been given a ScaleFactorChanged event so your control is notified when a change occurs instead of your control needing to periodically check the ScaleFactor property on the Session object.</p>
<p>WebControlWrapper.ScaleFactorChanged: Fires whenever the ScaleFactor of the current session&#8217;s browser changes.</p>
<p>Also for WebSDK, we are now enforcing unique Javascript Namespaces throughout a project at compile time. This means you&#8217;ll be able to tell ahead of time if your controls are missing a namespace or if you&#8217;ve inadvertently used the same exact namespace more than once!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Easily Sorting Arrays of Classes</title>
		<link>https://blog.xojo.com/2016/03/09/easily-sorting-arrays-of-classes/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 09 Mar 2016 00:00:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2016/03/09/easily-sorting-arrays-of-classes/</guid>

					<description><![CDATA[Learn how to use a new Xojo feature to create your own custom comparison method to easily sort arrays of classes.]]></description>
										<content:encoded><![CDATA[<p>Sometimes you&#8217;re going to need a data structure that is an array of classes and you&#8217;re going to want to sort them. The standard array <a href="http://developer.xojo.com/arrays$Sort">Sort</a> method can only sort simple types (Text, Integer, etc), so what do you do?</p>
<p>The traditional technique has been to use <a href="http://developer.xojo.com/arrays$SortWith">SortWith</a>. You create a separate array of a simple type, populate it and then sort the temporary array using SortWith to sort the class array.</p>
<p>But there is an even <a href="http://developer.xojo.com/arrays$SortDelegate">slicker way to sort</a> that was added in 2015 Release 3. You can now create your own custom comparison method and use that to sort the class. This custom method returns 0 if the values to compare are equal, a positive if the first value is greater than the second, and a negative value if the first value is less than the second.</p>
<p><span id="more-271"></span></p>
<p>This code can sort an array of DateTime:</p>
<pre>Function DateCompare(value1 As DateTime, value2 As DateTime) As Integer
 // This assumes the array is populated with non-Nil dates
 If value1.SecondsFrom1970 &gt; value2.SecondsFrom1970 Then Return 1
 If value1.SecondsFrom1970 &lt; value2.SecondsFrom1970 Then Return -1
 Return 0
End Function

myDates.Sort(AddressOf DateCompare)</pre>
<p>To learn more about class array sorting, refer to these doc topics:</p>
<ul>
<li><a href="http://developer.xojo.com/arrays$SortDelegate">Array Sort Method</a> in Reference Guide</li>
<li><a href="http://developer.xojo.com/arrays$SortWith">Array SortWith</a> Method in Reference Guide</li>
<li><a href="http://developer.xojo.com/userguide/advanced-oop-features$Sorting%20Arrays">Sorting Class Arrays</a> in User Guide</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>My Favorite New Xojo Framework Features</title>
		<link>https://blog.xojo.com/2015/08/26/my-favorite-new-xojo-framework-features/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 26 Aug 2015 00:00:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2015/08/26/my-favorite-new-xojo-framework-features/</guid>

					<description><![CDATA[Here are some of my favorite features of the Xojo framework.]]></description>
										<content:encoded><![CDATA[<p>The first classes in the new Xojo Framework have been available for all project types since Xojo 2015 Release 2. Here are some of my favorite features.<br>
<span id="more-304"></span></p>
<h2>Text</h2>
<p>The new Text data type is a substitute for String and has the benefit of making encodings easier to work with. Essentially if you use Text, you don&#8217;t have to worry about the encoding. When you get data from an outside source (a file, a database or even a String), you specify the encoding so it can be stored as Text. Once it is in Text, you don&#8217;t worry about the encoding. When you need to send the Text to a file, DB or elsewhere, you convert it to data using whatever encoding is appropriate- usually UTF8.</p>
<p>You can easily use Text with your existing projects as a Text value converts back to a String automatically. For example, you can set a button Caption using a Text variable:</p>
<pre>Dim t As Text = "Hello"
MyButton.Caption = t // converts automatically to String</pre>
<p>If you have a String (such as a property of a UI control) you can easily convert it to Text by calling&nbsp;the ToText method. For example, you store the Caption of a button as Text:</p>
<pre>Dim t As Text = MyButton.Caption.ToText</pre>
<h2>Dictionary</h2>
<p>I prefer <a href="http://developer.xojo.com/xojo-core-dictionary">Xojo.Core.Dictionary</a> because it is has an easy-to-use iterator, making it crazy-simply to loop through the items in&nbsp;the Dictionary:</p>
<pre>Dim myDictionary As New Xojo.Core.Dictionary
myDictionary.Value("Name") = "Bob Roberts"
myDictionary.Value("City") = "Boston"
For Each entry As Xojo.Core.DictionaryEntry In myDictionary
  Dim key As Text = entry.Key
  Dim value As Text = entry.Value
Next</pre>
<p>Xojo.Core.Dictionary can also be case-sensitive which is not even an option&nbsp;with the classic Dicitonary class! You just have to subclass (or use AddHandler) and implement the CompareKeys event handler:</p>
<pre>Dim leftText As Text = lhs
Dim rightText As Text = rhs
Return leftText.Compare(rightText, Text.CompareCaseSensitive)</pre>
<h2>JSON</h2>
<p>In the new framework, <a href="/2015/04/16/newframeworkjson/">JSON is handled by two methods</a> (<a href="http://developer.xojo.com/xojo-data$ParseJSON">Xojo.Data.ParseJSON</a> and <a href="http://developer.xojo.com/xojo-data$GenerateJSON">Xojo.Data.GenerateJSON</a>), typically with Xojo.Core.Dictionary. Creating JSON text from a Dictionary is one line of code:</p>
<pre>Dim jsonText As Text = Xojo.Data.GenerateJSON(myDictionary)</pre>
<p>And converting JSON text to a Dictionary is also one line of code:</p>
<pre>Dim jsonDict As Xojo.Core.Dictionary = Xojo.Data.ParseJSON(jsonText)</pre>
<p>Both of these methods are much faster than using JSONItem in the classic framework.</p>
<h2>HTTPSocket</h2>
<p><a href="http://developer.xojo.com/xojo-net-httpsocket">Xojo.Net.HTTPSocket</a> uses HTTP 1.1. This is a big advantage over the classic HTTPSocket which only supports HTTP 1.0 making it not always compatible with some sites.</p>
<p>I recently did a <a href="http://developer.xojo.com/webinar-httpsocket">webinar that shows how to use HTTPSocket with a variety of web services</a>.</p>
<h2>TextInputStream/TextOutputStream</h2>
<p>Lastly, I often work with Text files which means I have to deal with encodings. The <a href="http://developer.xojo.com/xojo-io-textinputstream">TextInputStream</a> and <a href="http://developer.xojo.com/xojo-io-textoutputstream">TextOutputStream</a> make it easy to deal with encodings because the encoding is part of the method calls.</p>
<p>You can even use these classes with classic FolderItems by first converting them to Xojo.IO.FolderItem. For example, this prompts the user for a file and then opens it using a TextInputStream:</p>
<pre>Dim f As FolderItem = GetOpenFolderItem("")
If f &lt;&gt; Nil Then
  Dim openFile As New Xojo.IO.FolderItem(f.NativePath.ToText)
  Dim input As Xojo.IO.TextInputStream
  input = Xojo.IO.TextInputStream.Open(openFile, Xojo.Core.TextEncoding.UTF8)
End If</pre>
<p>If you have not already, try these new Xojo Framework classes in your projects. You&#8217;ll appreciate it!</p>
<p><!-- end HubSpot Call-to-Action Code --></p>


<p>Update (June 2020):</p>



<p>Since this was posted, there have been many updates to Xojo. In particular you should check out these equivalent API 2.0 features:</p>



<ul class="wp-block-list"><li><a href="https://documentation.xojo.com/api/language/dictionary.html">Dictionary</a> now also has an iterator.</li><li><a href="https://documentation.xojo.com/api/text/json/generatejson.html">GenerateJSON</a> and <a href="https://documentation.xojo.com/api/text/json/parsejson.html">ParseJSON</a>.</li><li><a href="https://documentation.xojo.com/api/networking/urlconnection.html">URLConnection</a></li></ul>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Xojo Framework: Working with JSON</title>
		<link>https://blog.xojo.com/2015/04/16/xojo-framework-working-with-json/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 16 Apr 2015 00:00:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2015/04/16/xojo-framework-working-with-json/</guid>

					<description><![CDATA[Much of the new Xojo framework is available for all project types staring with Xojo 2015r2. The Data namespace includes two methods for dealing with JSON data: GenerateJSON and ParseJSON. This is how they are used in comparison to JSONItem in the old "Classic" framework.]]></description>
										<content:encoded><![CDATA[<p>Much of the new Xojo framework is available for all project types staring with Xojo 2015r2. The Data namespace includes two methods for dealing with JSON data: <a href="http://developer.xojo.com/xojo-data$GenerateJSON">GenerateJSON</a> and <a href="http://developer.xojo.com/xojo-data$ParseJSON">ParseJSON</a>. This is how they are used in comparison to JSONItem in the old &#8220;Classic&#8221; framework.</p>
<p><span id="more-204"></span></p>
<p>In the Classic framework the JSONItem class is used to create, load and output JSON data. With the new &#8220;Xojo&#8221; framework, you simply use a Dictionary, which you can easily populate from JSON data or output to JSON data.</p>
<p>For example, here is some JSON data to use as an example:</p>
<pre>{ "Seagulls":
  { "players":
    { "Bob":{ "position":"1B" },
      "Tom":{ "position":"2B" } }
},
  "Pigeons":
  { "players":
    { "Bill":{ "position":"1B" },
      "Tim":{ "position":"2B" } }
},
  "Crows":
  { "players":
    { "Ben":{ "position":"1B" },
      "Ty":{ "position":"2B" } } }
}</pre>
<p>With the above JSON data pasted into a TextArea, you can load it with just a single line of code:</p>
<pre>Dim league As Dictionary = Xojo.Data.ParseJSON(JSONArea.Text.ToText)</pre>
<p>This is similar to the classic framework, which would look like this:</p>
<pre>Dim league As New JSONItem(JSONArea.Text)</pre>
<p>Looping through the JSON data is also similar. In the Xojo framework, you just iterate through the Dictionary with each JSON section as its own Dictionary:</p>
<pre>Dim teamName, playerName As TextDim team, players, player As Dictionary

For Each t As DictionaryEntry In league
  teamName = t.Key
  team = t.Value
  OutputArea.AppendText(teamName)
  OutputArea.AppendText(EndOfLine)
  players = team.Value("players")
  For Each p As DictionaryEntry In players
    playerName = p.Key
    player = players.Value(playerName)
    OutputArea.AppendText(" " + playerName + " ")
    For Each a As DictionaryEntry In player
      OutputArea.AppendText(a.Value + " ")
    Next
    OutputArea.AppendText(EndOfLine)
  Next
Next</pre>
<p>In the Classic framework, you iterate through the count of items in the JSONItem:</p>
<pre>Dim teamName, playerName As StringDim team, players, player As JSONItem

For i As Integer = 0 To league.Count-1
  teamName = league.Name(i)
  team = league.Value(teamName)
  OutputArea.AppendText(teamName)
  OutputArea.AppendText(EndOfLine)
  players = team.Value("players")
  For p As Integer = 0 To players.Count-1
    playerName = players.Name(p)
    player = players.Value(playerName)
    OutputArea.AppendText(" " + playerName + " ")
    For a As Integer = 0 To player.Count-1
      OutputArea.AppendText(player.Value(player.Name(a)) + " ")
    Next
    OutputArea.AppendText(EndOfLine)
  Next
Next</pre>
<p><span style="line-height: 1.62;">An example project for the above code is <a href="http://files.xojo.com/BlogExamples/JSONTest.xojo_binary_project">here</a>.</span></p>
<p><span style="line-height: 1.62;">To create JSON from a Dictionary, you use the the GenerateJSON method:</span></p>
<pre>Dim d As New Xojo.Core.Dictionary
d.Value("Name") = "Bilbo Baggins"
Dim json As Text = Xojo.Data.GenerateJSON(d)</pre>
<p><span style="line-height: 1.62;">Grab Xojo 2015r2 and start using GenerateJSON and ParseJSON the Xojo framework today!</span></p>
<p>Update (June 2020):</p>
<p>Since this was written, <a href="https://documentation.xojo.com/api/text/json/generatejson.html">GenerateJSON</a> and <a href="https://documentation.xojo.com/api/text/json/parsejson.html">ParseJSON</a> were also added as part of API 2.0.</p>
<p><span style="line-height: 1.62;"><!--HubSpot Call-to-Action Code --> <span id="hs-cta-wrapper-4d3c143a-87c8-4155-9c51-dca01de31cbf" class="hs-cta-wrapper"> <span id="hs-cta-4d3c143a-87c8-4155-9c51-dca01de31cbf" class="hs-cta-node hs-cta-4d3c143a-87c8-4155-9c51-dca01de31cbf"><br />
<!-- [if lte IE 8]>


<div id="hs-cta-ie-element"></div>


<![endif]--> <a href="http://developer.xojo.com/webinar-json" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" id="hs-cta-img-4d3c143a-87c8-4155-9c51-dca01de31cbf" class="hs-cta-img aligncenter" style="border-width: 0px;" src="https://blog.xojo.com/wp-content/uploads/2015/04/4d3c143a-87c8-4155-9c51-dca01de31cbf.png" alt="Watch Video" width="641" height="107" /></a></span></span><br />
<!-- end HubSpot Call-to-Action Code --> </span></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The New Xojo Framework: Ch-ch-ch-ch-changes</title>
		<link>https://blog.xojo.com/2015/04/14/the-new-xojo-framework-ch-ch-ch-ch-changes/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Tue, 14 Apr 2015 00:00:00 +0000</pubDate>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2015/04/14/the-new-xojo-framework-ch-ch-ch-ch-changes/</guid>

					<description><![CDATA[The New Xojo Framework: Ch-ch-ch-ch-changes]]></description>
										<content:encoded><![CDATA[<p>In the ideal world when you do something, you do it right the first time. In the real world, we learn more each day and what seemed right yesterday, a month ago or a few years ago, may no longer be right today. Xojo has been around for a long time now and in all that time we have learned a thing or two. One of the things we have learned is how to deal with errors.</p>
<p><img decoding="async" class="mt-image-center" style="text-align: center; display: block; margin: 0px auto 20px; width: 320px;" title="Bowie_Changes.png" src="https://blog.xojo.com/wp-content/uploads/2015/04/Bowie_Changes.pngt1466486449161ampwidth320" sizes="(max-width: 320px) 100vw, 320px" alt="Bowie_Changes.png" width="320" data-constrained="true" /><em style="line-height: 1.62;">Ch-ch-ch-changes (turn and face the strain) &#8211; David Bowie</em></p>
<p><span id="more-202"></span></p>
<p>As you have read in previous <a href="http://www.xojo.com/blog/en/2014/12/using-the-ios-docs.php">blog</a> <a href="http://www.xojo.com/blog/en/2014/12/the-xojo-core-date-class.php">posts</a>, we are building a new framework to clean things up. We refer to the current framework as the &#8220;Classic&#8221; framework and the new one as the &#8220;Xojo&#8221; framework. The Xojo framework was introduced four months ago with our support for iOS and at that time was limited to iOS projects only. With today&#8217;s release of Xojo 2015r2, we have added a lot more functions to the Xojo framework, all of which are now supported for the desktop and web in addition to iOS.</p>
<p>Previously, there were different ways to deal with errors depending on what part of the Classic framework you were using. For example, if you passed a string to the Val function, it would return zero if the function started with a non-numeric character. Pass Val the string &#8220;123$&#8221; and you&#8217;ll get 123 but pass it &#8220;$123&#8221; and you&#8217;ll get 0. Use the Left function to get the 5 leftmost characters from a string that has only 4 characters, and it will return those 4 characters. These may seem like reasonable results to return given what was passed in. But there are downsides to them.</p>
<p>There are three problems with handling errors in this way. First, they are all different so you have to learn different ways to handle different errors. Second, they are behaviors rather than actual errors and third (and most important), they allow code to pass along a value that could be legitimate without the user knowing it&#8217;s an error at all. This can create hard to find bugs. For example, say you are importing sales data from a text file. One of the thousands of values you import has a dollar sign at the front. This results in a zero when passed to Val. If zero is a potentially legitimate value, this error could easily be over-looked.</p>
<p>In the new framework, this won&#8217;t happen. Instead of using Val to convert text to a number (integer), you use the FromText function. Your code looks like this:</p>
<pre>Sales = Integer.FromText(QuarterlySalesImportedValue)</pre>
<p>If QuarterlySalesImportedValue cannot be converted to a number (because it starts with a non-numeric character like a $), rather than return a zero, a BadDataException exception is thrown. While the Classic framework has many different ways to handle errors, the new Xojo framework uses exceptions exclusively for reporting errors, making it more consistent.</p>
<p>In the Classic framework, detecting an error like this means converting the text to an integer then back to text and to compare it with the original value to see if they are the same. If they are, great. If they aren&#8217;t, then there was a non-numeric character in there. In the Xojo framework, you don&#8217;t worry about it and check for an exception.</p>
<p>If you haven&#8217;t used exception handling in your code before, don&#8217;t panic. It&#8217;s really not a big deal. An exception means that something unusual has happened and in most cases the app (or at least the function of the app the user is using) can&#8217;t continue. To use an exception you wrap the block of code that might result in an error in a Try&#8230;Catch statement. If an exception occurs, the code will call the exception handler (the catch portion of the Try&#8230;Catch statement) and deal with the error. Here&#8217;s an example:</p>
<pre>Try
  'code to open the file and read the data here
  i =  Integer.FromText(ImportedQuarterlySalesData)
  'code to deal with the converted value here
Catch err As Xojo.Core.BadDataException
   Beep
   MsgBox "The import can't continue because the sales data is bad."
End Try</pre>
<p>In this example I&#8217;ve left out the code you&#8217;d write to open the file, read in the data and do something with it, but you get the idea. In the new Xojo framework, all the functions that deal with opening and reading files throw the same BadDataException if something goes wrong, a single Try&#8230;Catch can handle it all. And of course you could choose to make the error message more specific, telling the user what row the bad data came from and showing them the bad data itself so they can go fix the data file. Exceptions also potentially remove lots of IF statements that often litter code checking for error conditions.</p>
<p>When it comes to errors, luck favors the prepared. Write your code so that it anticipates errors properly and handles them rather than waiting for the user to report that your software doesn&#8217;t work. In the new Xojo framework we are making it easy for you to do this by consistently using exceptions to report errors. They don&#8217;t require more code than using IF statements and in many cases, require less code and make your code easier to read.</p>
<p>We&#8217;ve added a lot more functionality to the new framework in 2015r2 allowing you to write most of your non-GUI code using the new framework and share that across all project types. For example, we have:</p>
<ul>
<li><a style="line-height: 1.62;" title="HTTPSocket" href="http://developer.xojo.com/httpsocket" target="_blank" rel="noopener">HTTPSocket</a><a title="TCPSocket" href="http://developer.xojo.com/tcpsocket" target="_blank" rel="noopener"><span style="color: #000000; line-height: 1.62;"> (which supports HTTP 1.1 &#8211; yes, you&#8217;ve been asking for that for years)</span></a></li>
<li><a title="Folderitem" href="http://developer.xojo.com/folderitem" target="_blank" rel="noopener">FolderItem</a></li>
<li><a title="SpecialFolder" href="http://developer.xojo.com/specialfolder" target="_blank" rel="noopener">SpecialFolder</a></li>
<li><a title="BinaryStream" href="http://developer.xojo.com/binarystream" target="_blank" rel="noopener">BinaryStream</a></li>
<li><a title="TextInputStream" href="http://developer.xojo.com/textinputstream" target="_blank" rel="noopener">TextInputStream</a></li>
<li><a title="TextOutputStream" href="http://developer.xojo.com/textoutputstream" target="_blank" rel="noopener">TextOutputStream</a></li>
<li><a title="Crypto" href="http://developer.xojo.com/crypto" target="_blank" rel="noopener">Crypto</a></li>
<li><a title="Introspection" href="http://developer.xojo.com/introspection" target="_blank" rel="noopener">Introspection</a></li>
<li>All the <a title="Math Functions" href="http://developer.xojo.com/math" target="_blank" rel="noopener">math</a> functions (log, min, max, abs, etc.)</li>
<li><a title="JSON" href="http://developer.xojo.com/data" target="_blank" rel="noopener">JSON</a></li>
</ul>
<p>You&#8217;ll find that most of these classes work very similarly to those in the Classic framework. Click the items in the list above to review them. And these are just the new Xojo framework functions. We&#8217;ve added more to our iOS support as well.</p>
<p>When using the Xojo framework with your existing Classic code, you&#8217;ll need to use the new <a title="Using function" href="http://developer.xojo.com/using" target="_blank" rel="noopener">Using</a> command or include the namespace with each function. I think you&#8217;ll find Using to be a better option. You can also use it for an entire class, module or window by right-clicking on the project item then choosing Add To -&gt; Using Clause. Once the Xojo framework is complete, there will be a way to use it without bothering with Using at all.</p>
<p>We&#8217;ve made a lot of progress on the Xojo framework for 2015r2 which provides you with a more consistent and thus more productive experience. Yes, there will be a few new things to learn but there&#8217;s also a lot of great, new functionality as well. Over the years, we have had to write a lot of this functionality ourselves or use third party libraries. So much of what is needed is now built-in to the OS so in the Xojo framework, we can now call the OS functions directly. That means your Xojo apps pickup more functionality automatically without you (or us) having to do additional extra work. It also means that when bugs are fixed at the OS level, your apps automatically become more reliable without having to recompile them.<!-- end HubSpot Call-to-Action Code --></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The Xojo.Core.Date Class</title>
		<link>https://blog.xojo.com/2014/12/11/the-xojo-core-date-class/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 11 Dec 2014 00:00:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Date Class]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2014/12/11/the-xojo-core-date-class/</guid>

					<description><![CDATA[The Xojo.Core.Date Class]]></description>
										<content:encoded><![CDATA[<p>Ready to learn a bit about the Date class in the new Xojo framework?</p>
<p><span id="more-170"></span></p>
<p><span style="line-height: 1.62;">First, remember the old Date class remains available for desktop/web/console projects.</span></p>
<p>In this post I&#8217;m specifically talking abou the new <a href="http://xojo.helpdocsonline.com/date">Xojo.Core.Date</a> class. The big change is that Xojo.Core.Date is now <strong>immutable</strong>. With the old Date class, if you changed Date properties in the &#8220;wrong&#8221; order, such as set Day to 31 before setting Month to 9 then unexpected things start to happen. It also caused problems with things like FolderItem.ModificationDate (for example) because you might think you could actually change the modification date by directly changing its Date properties, but that doesn&#8217;t actually work.</p>
<p>So Xojo.Core.Date is immutable. You get a new Date by using one of the Constructors. If you need the current date, you use <strong>Date.Now</strong>. And with this we&#8217;ve added the companion <a href="http://xojo.helpdocsonline.com/dateinterval">DateInterval</a> and <a href="http://xojo.helpdocsonline.com/timezone">TimeZone</a> classes to make it easy to do math on Dates and to convert a date/time to a different time zone.</p>
<p>In particular, you can now do arithmetic on Dates. For example, if you want to get the Date that is two months earlier than now, you can create a DateInterval and subtract it from the Date:</p>
<pre>Dim twoMonths As New DateInterval
twoMonths.Month = 2 // 2 month interval

// Get date two months before today
Dim past As Date = Date.Now - twoMonths</pre>
<p>Or if you want to know the the interval until Jan 1, 2030:</p>
<pre>Dim d2 As New Date(2030, 1, 1, TimeZone.Current)
Dim interval As DateIntervalinterval = d2 - Date.Now</pre>
<p>Need to convert the current date/time to GMT? Try this:</p>
<pre>Dim GMTZone As New TimeZone("GMT")
Dim GMTDate As New Date(Date.Now.SecondsFrom1970, GMTZone)</pre>
<p><span style="line-height: 1.62;">You can use <a href="http://xojo.helpdocsonline.com/date">Xojo.Core.Date</a> in all project types (Desktop, Web, Console and iOS).</span></p>
<p>Update (June 2020):</p>
<p>Since this was written, the <a href="https://documentation.xojo.com/api/deprecated/date.htmlTime">DateTime</a> class was added as part of API 2.0.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
