<?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>Frameworks &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/frameworks/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>Converting Web Projects to Web Framework 2.0</title>
		<link>https://blog.xojo.com/2020/08/27/converting-web-projects-to-web-framework-2-0/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Thu, 27 Aug 2020 11:11:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[Xojo API 2.0]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=7288</guid>

					<description><![CDATA[With the release of Xojo 2020r1 comes the new 2.0 version of our web framework. While the way in which you build web applications hasn't fundamentally changed, this new version is a from-the-ground-up rewrite and utilizes API 2.0 for greatly improved consistency. This means that the conversion process is going to be time-consuming, but will be well worth the effort as web applications built upon Web Framework 2.0 will be more robust, handle more users, be more responsive and have a far more modern look and feel.]]></description>
										<content:encoded><![CDATA[
<p>With the release of Xojo 2020r1 comes the new 2.0 version of our web framework. While the way in which you build web applications hasn&#8217;t fundamentally changed, this new version is a from-the-ground-up rewrite and utilizes API 2.0 for greatly improved consistency. The conversion process will be well worth the effort as web applications built upon Web Framework 2.0 will be more robust, handle more users, be more responsive and have a far more modern look and feel. For example, compare this layout from our Eddie&#8217;s Electronic&#8217;s demo app made with Web Framework 1.0 to the same layout updated to Web Framework 2.0:</p>



<figure class="wp-block-image size-large is-resized"><img fetchpriority="high" decoding="async" src="https://blog.xojo.com/wp-content/uploads/2020/08/Screen-Shot-2020-08-22-at-3.51.42-PM-1024x771.png" alt="" class="wp-image-7362" width="668" height="503" srcset="https://blog.xojo.com/wp-content/uploads/2020/08/Screen-Shot-2020-08-22-at-3.51.42-PM-1024x771.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/08/Screen-Shot-2020-08-22-at-3.51.42-PM-300x226.png 300w, https://blog.xojo.com/wp-content/uploads/2020/08/Screen-Shot-2020-08-22-at-3.51.42-PM-768x578.png 768w, https://blog.xojo.com/wp-content/uploads/2020/08/Screen-Shot-2020-08-22-at-3.51.42-PM-1536x1156.png 1536w, https://blog.xojo.com/wp-content/uploads/2020/08/Screen-Shot-2020-08-22-at-3.51.42-PM-2048x1542.png 2048w" sizes="(max-width: 668px) 100vw, 668px" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="771" src="https://blog.xojo.com/wp-content/uploads/2020/08/Eddies-Web-2.0-1024x771.png" alt="" class="wp-image-7365" srcset="https://blog.xojo.com/wp-content/uploads/2020/08/Eddies-Web-2.0-1024x771.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/08/Eddies-Web-2.0-300x226.png 300w, https://blog.xojo.com/wp-content/uploads/2020/08/Eddies-Web-2.0-768x578.png 768w, https://blog.xojo.com/wp-content/uploads/2020/08/Eddies-Web-2.0-1536x1156.png 1536w, https://blog.xojo.com/wp-content/uploads/2020/08/Eddies-Web-2.0-2048x1542.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">User Comments about Conversion</h2>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>After initial testing I quickly recognized the great performance gain Xojo Web 2.0 brings to our application. Transitioning to Web 2.0 was easier than we had expected. The backend code could be taken over almost completely without changes and the user interface was redesigned based on the new controls. The performance gain, especially with many concurrent sessions, is huge and allows a fluent user experience, with a very modern look and feel.</p><cite>Andreas Reichmann of inoxision GmbH</cite></blockquote>



<h2 class="wp-block-heading">Should You Convert Your Project</h2>



<p>There are two reasons that it might not make sense to convert a project at this time. The first would be if this project is both quite large and a short-term solution. If you don&#8217;t see it being in use in 5 years, it might make more sense to continue to maintain it in 2019r3. The second reason would be if your project currently relies on some function of Web Framework 1.0 that does not exist in Web Framework 2.0. Primarily this would be mouse events for Label, Canvas, MapViewer and ImageViewer. If your app depends on mouse events for these controls, wait for a future release.</p>



<h2 class="wp-block-heading">How Much Work Will It Be?</h2>



<p>I personally converted the Eddie&#8217;s Electronic&#8217;s demo web app from Web Framework 1.0 to 2.0. The end result was a project with 9 layouts and just over 400 compiler errors. I was able to fix the errors, update the layouts (modernizing the main layout a bit in the process), and updated the non-web framework code to API 2.0 as well. The Eddie&#8217;s project file is 11.6MB and the entire process took about a day to complete. </p>



<h2 class="wp-block-heading">Custom Controls</h2>



<p>If you have any WebSDK-based custom controls on your layouts, you should remove them first as they will not convert. A new WebSDK is coming soon and the authors of those controls will need to update them to work with Web Framework 2.0.</p>



<h2 class="wp-block-heading">Work with a Backup</h2>



<p>First and foremost, make sure that you have a backup of your project before you start the conversion process. You will want to be able to maintain your existing Web Framework 1.0 projects while you go through this conversion process. It may be short, it may be long, depending on how big your project is and what it uses.</p>



<h2 class="wp-block-heading">The Overall Process of Conversion</h2>



<p>The best order in which to do a conversion is the following:</p>



<ol class="wp-block-list"><li>Convert Container Controls</li><li>Convert Web Framework Code</li><li>Convert Layouts</li><li>Convert API 1.0 code to API 2.0</li></ol>



<p>Let&#8217;s look at each of these steps in order.</p>



<h2 class="wp-block-heading">Don&#8217;t Panic</h2>



<p>When you initially open your project in Xojo 2020r1 (or later), you&#8217;re likely to see this dialog box:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="514" src="https://blog.xojo.com/wp-content/uploads/2020/08/Warning-Dialog-1024x514.png" alt="" class="wp-image-7290" srcset="https://blog.xojo.com/wp-content/uploads/2020/08/Warning-Dialog-1024x514.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/08/Warning-Dialog-300x151.png 300w, https://blog.xojo.com/wp-content/uploads/2020/08/Warning-Dialog-768x385.png 768w, https://blog.xojo.com/wp-content/uploads/2020/08/Warning-Dialog.png 1064w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>This is simply telling you that you&#8217;re using a control, event or property that no longer exists in Web Framework 2.0. Once you save your project, these incompatible items will be removed. Fear not, however, as you are working with a copy of your project so you can always refer back to your original Web Framework 1.0 project if the need arises.</p>



<h2 class="wp-block-heading">Converting Container Controls</h2>



<p>If your project utilizes Container controls, you&#8217;ll want to open it in Xojo 2020r1, immediately save it and then reopen it again. This will convert your Container controls properly allowing them to render correctly in the Layout Editor.</p>



<h2 class="wp-block-heading">Converting Events</h2>



<p>While many event names have changed, only a few have changed dramatically. Most have changed to make it more clear when they occur. For example, WebPage.Open is now <em>Opening</em> to reflect the fact that the page is actually in the process of opening and is not open yet. WebPage.Close on the other hand has been renamed <em>Closed</em>, because at the point at which the event fires, the page has already closed.</p>



<p>All of the code in events is automatically moved over to the new events when you open your project in 2020r1. However, you will likely have some code in events that cannot be auto-converted because a similar event does not exist. You will need to move this code manually. If there&#8217;s not an obvious new event, save this code somewhere until you get through the rest of the process and can decide where it should go. Then you can delete the unconvertible event.</p>



<p>In the case of Eddie&#8217;s Electronics, the project had 107 events, 7 of them could not be auto-converted.</p>



<h2 class="wp-block-heading">Converting Web Framework Code</h2>



<p>Once you have handled any events that can&#8217;t be auto-converted, the next step is to fix the compiler errors that are the result of changes in APIs between Web Framework 1.0 and 2.0. Web Framework 2.0 uses API 2.0 exclusively.</p>



<p>API 2.0 was designed to be extremely consistent. At first it may seem slightly foreign because you are accustomed to the original framework. Most find they get used to the new APIs fairly quickly and appreciate the consistency as it makes it far easier to find the API you&#8217;re looking for and thus faster for development.</p>



<p>Unfortunately, for the web framework it was not practical to keep both the old and the new APIs, so this means you&#8217;ll need to make some code changes before your web project will compile. The easiest thing to do is click the Run button and let the compiler figure out what it doesn&#8217;t understand. It will give you a list of errors most of which can be fixed by simply replacing an old API with a new one.</p>



<p>The most common change will be that the property that holds the primary value of a control is (in most cases) called Value. TextField1.Text for example, becomes TextField1.Value. These are fairly quick to change. The only code you must update is code that is associated with the web framework. While code not specific to the web framework might generate warnings that it should be updated to API 2.0, that&#8217;s not absolutely required to get your project converted and running. Depending on the size of your project, you may choose to do that conversion work at a later date.</p>



<p>Referring to the internal project I mentioned earlier, after dealing with 7 events that could not be auto-converted, clicking Run again results in just over 400 compiler errors. Now that may seem like a daunting task but it&#8217;s not as bad as it sounds. Almost half of those errors come from things that can be fixed with a simple search/replace. For example:</p>



<figure class="wp-block-table is-style-regular"><table><tbody><tr><td><em>Old Method/Property</em></td><td><em>New Method/Property</em></td><td class="has-text-align-center" data-align="center"><em>Count</em></td></tr><tr><td>Text</td><td>Value</td><td class="has-text-align-center" data-align="center">77</td></tr><tr><td>ListIndex</td><td>SelectedRowIndex</td><td class="has-text-align-center" data-align="center">30</td></tr><tr><td>LastIndex</td><td>LastAddedRowIndex</td><td class="has-text-align-center" data-align="center">5</td></tr><tr><td>DeleteAllRows</td><td>RemoveAllRows</td><td class="has-text-align-center" data-align="center">8</td></tr><tr><td>Cell</td><td>CellValueAt</td><td class="has-text-align-center" data-align="center">12</td></tr><tr><td>MsgBox</td><td>MessageBox</td><td class="has-text-align-center" data-align="center">12</td></tr><tr><td>RowTag</td><td>RowTagAt</td><td class="has-text-align-center" data-align="center">8</td></tr><tr><td>ForeColor</td><td>DrawingColor</td><td class="has-text-align-center" data-align="center">24</td></tr><tr><td>DrawRect</td><td>DrawRectangle</td><td class="has-text-align-center" data-align="center">6</td></tr><tr><td>FillRect</td><td>FillRectangle</td><td class="has-text-align-center" data-align="center">6</td></tr><tr><td></td><td><em>Total</em></td><td class="has-text-align-center" data-align="center">191</td></tr></tbody></table></figure>



<p>There are many others as well that can be converted via/search and replace. </p>



<pre class="wp-block-preformatted"><strong>Note on Search/Replace</strong>: When replacing class members, always start with a period and for methods end with an open parenthesis to reduce the chance you're going to replace something that matches but isn't a class member or is the wrong class member.

For example: .Cell(</pre>



<h2 class="wp-block-heading">Converting Layouts</h2>



<p>Most controls in Web Framework 2.0 are taller than their 1.0 counterparts. This means you&#8217;ll need to resize them and then in many cases, reposition them. For the controls that have a standard height such as Label, TextField, Button, PopupMenu, Checkbox, SegmentedButton, it is recommended that you initially resize them to their new standard height of 38 first. You can do this all at once for a single layout. Just shift-click on several controls then change their Height property collectively to 38.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="336" src="https://blog.xojo.com/wp-content/uploads/2020/08/Old-Eddies-Address-fields-1024x336.png" alt="" class="wp-image-7301" srcset="https://blog.xojo.com/wp-content/uploads/2020/08/Old-Eddies-Address-fields-1024x336.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/08/Old-Eddies-Address-fields-300x98.png 300w, https://blog.xojo.com/wp-content/uploads/2020/08/Old-Eddies-Address-fields-768x252.png 768w, https://blog.xojo.com/wp-content/uploads/2020/08/Old-Eddies-Address-fields.png 1372w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>Example Controls in 2019r3</figcaption></figure>



<p>Now that you have all the controls at the proper height, you can begin repositioning them. However, before you do that, you may want to resize the layout itself to create additional room for the new, taller versions of your controls. Before you do that, look at ListBox, ImageViewer, TextArea and MapViewer controls to see if their locking properties are set in such as way that they will resize when you resize the page. If they are, turn those off for now so you can easily create more room. </p>



<p>Now you&#8217;re ready to make your layout taller to accommodate the taller controls. The most popular controls (Label, TextField, Button, Checkbox, Popupmenu and others) are 42% taller. To understand how much taller to make your layout, measure the height of the area with the controls that have become taller (a Rectangle works great as a measuring tool) and then add 42%. For example, in the internal project example we&#8217;ve been using, the area of the CustomerDetailsPage layout that includes the name and address fields is 158 pixels tall in the original version. 158 * 1.42 = 224 pixels. The difference is 66. Thus, making the entire layout 66 pixels taller created enough room for the various controls at their new heights. </p>



<p>If you follow these guidelines, you&#8217;ll find that that webpages, containers and web dialogs can be updated very quickly. The example took 5 minutes to update.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="463" src="https://blog.xojo.com/wp-content/uploads/2020/08/New-Eddies-Address-Fields-1024x463.png" alt="" class="wp-image-7303" srcset="https://blog.xojo.com/wp-content/uploads/2020/08/New-Eddies-Address-Fields-1024x463.png 1024w, https://blog.xojo.com/wp-content/uploads/2020/08/New-Eddies-Address-Fields-300x136.png 300w, https://blog.xojo.com/wp-content/uploads/2020/08/New-Eddies-Address-Fields-768x347.png 768w, https://blog.xojo.com/wp-content/uploads/2020/08/New-Eddies-Address-Fields.png 1372w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>Example controls in 2020r1</figcaption></figure>



<p>Here&#8217;s a video showing the process:</p>



<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Adjusting Web Controls When Converting to Web Framework 2.0" width="500" height="281" src="https://www.youtube.com/embed/JyX57G_V3CU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p>In Summary:</p>



<ol class="wp-block-list"><li>Turn off LockTop for any controls below the controls being resized and turn on LockBottom for those same controls so that when you make the layout bigger, those controls will move downward.</li><li>Measure the area these controls currently require, multiple that by 1.42 then subtract the original height. This will give you the number of pixels you should add to the height of the layout in the Inspector to make room for the taller controls.</li><li>Select all Labels, TextFields, Buttons, CheckBoxes, PopupMenus and SegmentedButtons. In the Inspector, set their height to 38.</li><li>Starting with the newly resized controls closest to the bottom of the layout, move them downward then work your way towards the top.</li><li>Turn back on any locking properties you turned off in step 1.</li></ol>



<pre class="wp-block-preformatted"><strong>Note about Toolbars</strong>: While a new visual editor is in the works, it's not available for 2020r1. Toolbars are supported in the framework so you can create them in code. See <a href="http://documentation.xojo.com/api/user_interface/web/webtoolbar.html">WebToolbar</a> in the language reference for an example.</pre>



<pre class="wp-block-preformatted"><strong>Note about Separators</strong>: The separator control no longer exists. When your project is imported, separators are converted to Rectangles and made thin to do the same job.</pre>



<pre class="wp-block-preformatted"><strong>Note about WebAnimator</strong>: This class no longer exists. However, See the <a href="http://documentation.xojo.com/api/user_interface/web/webstyle.html">WebStyle</a> class for details on how to add animated transitions.</pre>



<pre class="wp-block-preformatted"><strong>Note about WebStyles</strong>: Because Web Framework 2.0 relies heavily upon themes rather than styling individual controls, there is no visual web style editor. You can, however, use the WebStyle class to style individual controls. You can also create your own Bootstrap theme which will be applied across all controls on all layouts.</pre>



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



<p>At this point you are ready to test your initial project conversion. Click Run and test all of your functionality. You may still need to make some additional changes to get these just right.</p>



<h2 class="wp-block-heading">Bonus Step: Converting Remaining Code to API 2.0</h2>



<p>Now that your app is converted, you may want to consider converting the remaining code to API 2.0 since that is the API we will be focusing our attention on going forward. It&#8217;s also the API that is shared with the desktop and will be shared with our mobile support soon.</p>



<p>Now, you are probably asking yourself, &#8220;What a minute, didn&#8217;t I just convert my code to API 2.0 when I fixed all of those compiler errors?&#8221; You did but that was just for the Web Framework itself. Your app likely also uses parts of the console framework which is the part that handle things like reading/writing files, network connectivity, database connectivity, and more. This code doesn&#8217;t have to be immediately converted to API 2.0 but you should plan to do it at some point.</p>



<p>When you decide to do so, choose Project &gt; Analysis Warnings. When the dialog appears, make sure that the first two checkboxes are checked. Those are the ones that will inform you of deprecation warnings. Now choose Project &gt; Analyze Project. The Warnings and Error panel will provide you with a list of places where you are using a class, method or property that has been replaced and will provide the replacement. At that point you just need to go error by error making the indicated changes. API 2.0 and API 1.0 share a lot of the same implementation under the hood so it may be a while before you really need to make this switch. You could also decide to do it slowly or just do it when you need to like when you encounter a bug in something from API 1.0 that is fixed in the API 2.0 version for example.</p>



<p>You will find that these conversions are easy to do and many can be handled with search and replace. I especially enjoyed converting database prepared statements as most went from four or five lines of code down to just one.</p>



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



<p>The bigger your project is, the more work it will be to convert. Fortunately, this is a one-time process for each project. The process suggested above will save you time during your project conversion. </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Yes Facebook, you can be Native AND Cross-Platform</title>
		<link>https://blog.xojo.com/2020/03/03/yes-facebook-you-can-be-native-and-cross-platform/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Tue, 03 Mar 2020 20:46:08 +0000</pubDate>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[LLVM]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<category><![CDATA[Native App Development]]></category>
		<category><![CDATA[Rapid Application Development]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=6677</guid>

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



<p><strong>So yes, you can create native applications that are also cross-platform.</strong> You just have to choose the right tool.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Loading 3rd Party Frameworks in Xojo iOS</title>
		<link>https://blog.xojo.com/2019/01/17/loading-3rd-party-frameworks-in-xojo-ios/</link>
		
		<dc:creator><![CDATA[Greg O'Lone]]></dc:creator>
		<pubDate>Thu, 17 Jan 2019 10:00:57 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Declares]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Third Party]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=5319</guid>

					<description><![CDATA[If you're familiar with Declares in iOS, loading a 3rd Party framework requires just a couple of extra lines of code in Xojo and a CopyFilesStep. In this example build and run SimulatorStatusMagic in the Simulator in order to always show a default date and time values when you do a debug run. ]]></description>
										<content:encoded><![CDATA[<p>Did you know that it&#8217;s possible to load and use 3rd Party Frameworks in your Xojo iOS projects? There&#8217;s quite a number of good projects out there, many of which are on sites like <a href="https://github.com">GitHub</a> and freely available for use in your projects. If you&#8217;re familiar with Declares in iOS, loading a 3rd Party framework requires just a couple of extra lines of code and a CopyFilesStep.</p>
<p>Last year at XDC 2018, <a href="https://github.com/jkleroy">Jérémie Leroy</a> talked about making sure your screenshots mimicked the Apple method so that the date was always Jun 9th, the time was always 9:41 AM, the battery always shows as full and the WiFi strength always shows full. It got me thinking that it might be handy to be able to make the simulator <em>always</em> show those values when you do a debug run so that you don&#8217;t need to think about it when you are ready to start taking screenshots and movies of your app. One way to do that is to build &amp; run project like <a href="https://github.com/shinydevelopment/SimulatorStatusMagic">SimulatorStatusMagic</a> on the simulator before running your project, but it would be more useful if it was <em>automatic</em>.</p>
<p><span id="more-5319"></span></p>
<h3>Build the Framework</h3>
<p>First of all, go to the SimulatorStatusMagic Github page and clone or download the project. Just like Xojo iOS development, you&#8217;ll need <a href="https://developer.apple.com/xcode/">Xcode</a> for this step. After you&#8217;ve downloaded the project, double-click on the SimulatorStatusMagic.xcodeproj file to open it in Xcode. When the project opens, change the target to SimulatorStatusMagiciOS and build it by either pressing CMD-B or pressing the Play button. Once the build is complete, go to the project navigator, scroll down to the bottom and open the Products group to reveal the built parts of this project. The only item we&#8217;re concerned with here is the file named SimulatorStatusMagiciOS.framework. Right-click on it and select Show in Finder.</p>
<h3>Build the Project</h3>
<p>Let&#8217;s start off by making sure the framework will be available to your project at runtime.</p>
<ol>
<li>Create a folder on your drive named SimulatorStatusMagic and copy the framework file that you just built into it.</li>
<li>Launch Xojo and create a new iOS project. Save the project into that folder as well.</li>
<li>To make sure the framework will be available to your project when debugging, go to the iOS target in the Xojo navigator, right-click and select Build Step &gt; Copy Files. Make sure the step is between the Build step and the Sign step.</li>
<li>Drag the SimulatorStatusMagiciOS.framework file from the Finder into the Copy Files Step.</li>
<li>In the Xojo inspector, set Applies To to &#8220;Debug&#8221; and Destination to &#8220;App Parent Folder&#8221;.</li>
</ol>
<p>Now let&#8217;s make it so you can access the framework! We&#8217;re going to add this code in the App.Open event so that the status bar gets set up before you do anything else.</p>
<p>Getting the framework to load is fairly straightforward:</p>
<pre>#If DebugBuild
  Declare Function dlopen Lib "/usr/lib/libSystem.dylib" (name As CString, flags As Int32) As Ptr
  Call dlopen("@executable_path/SimulatorStatusMagiciOS.framework/SimulatorStatusMagiciOS", 1 Or 8)
#EndIf</pre>
<p>That magic string &#8220;@executable_path&#8221; gets translated into &#8220;wherever the current application currently is&#8221; at runtime. Now this just loads the framework. We still need to hook up the methods and properties. <em>Note: If you&#8217;re working with a framework that &#8220;activates itself&#8221; like the one that comes with <a href="https://revealapp.com">Reveal</a> (an excellent tool for tracking down iOS layout issues), this is as far as you would need to go.</em></p>
<p>To figure out what we need to do next, we need to look at the documentation and header files that come with SimulatorStatusMagic. Go back to Xcode and look at the navigator. What we&#8217;re looking for is a header file (with a .h extension) which has the definitions of each of the methods and properties which are available in this framework. The only file that meets this criteria (and the one that all the others seem to point to) is named SDStatusBarManager.h. There&#8217;s a bit of functionality available here, but the framework is set up to use the Apple recommended settings by default, so all we&#8217;re going to do here is call the enableOverrides method to activate it.</p>
<p>Go back to Xojo and update App.Open event:</p>
<pre>#If DebugBuild
  Declare Function dlopen Lib "/usr/lib/libSystem.dylib" (name As CString, flags As Int32) As Ptr
  Call dlopen("@executable_path/SimulatorStatusMagiciOS.framework/SimulatorStatusMagiciOS", 1 Or 8)

  // Start by creating a pointer to the SDStatusBarManager class itself
  Declare Function NSClassFromString Lib "Foundation" (clsName As CFStringRef) As Ptr
  Dim smclass As Ptr = NSClassFromString("SDStatusBarManager")

  // Next, we need a pointer to the shared instance of the SDStatusBarManager class
  Declare Function sharedInstance Lib "Foundation" Selector "sharedInstance" (clsref As Ptr) As Ptr
  Dim smclassShared as Ptr = sharedInstance(smclass)

  // Last, turn on the overrides
  // NOTE: We're specifically NOT using the actual lib name here. 
  // This is just to satisfy the Xojo linker. The correct framework will be used at runtime.
  Declare Sub enableOverrides Lib "Foundation" Selector "enableOverrides" (obj As Ptr)
  enableOverrides(smclassShared)
#EndIf</pre>
<p>Now if you run the project, when it opens the status bar automatically changes to the recommended defaults!</p>
<p>Please Note: These changes persist until the simulator device that you are running on is completely erased. If you need to disable it, you can do that with the disableOverrides method.</p>
<p>After posting this article, it was brought to my attention that I&#8217;d forgotten to show you how to sign the frameworks so you can build for the app store. To do that, you&#8217;ll need to add a script build step to your project, just after the Copy Files step you added above. The step can probably be set to Applies To: Release. The code should look like this:</p>
<pre>// Replace the text in the signingIdentity property with your own
Dim signingIdentity As String = "iPhone Distribution: Your Company (XXXXXXXXXX)"
Dim code As Integer
Dim cmd As String
Dim result As String
Dim builtApp As String

builtApp = CurrentBuildLocation + "/" + ReplaceAll(CurrentBuildAppName, " ", "\ ")

// Get a list of all frameworks, one per line
cmd = "ls -d1 " + builtApp + "/*.framework"
result = Trim(DoShellCommand(cmd, 30, code))

// If there was no error (like none being there), sign each one
If code = 0 Then
  Dim frameworks() As String = split(result, chr(13))
  For i As Integer = 0 To UBound(frameworks)
    frameworks(i) = ReplaceAll(frameworks(i), " ", "\ ")
    cmd = "/usr/bin/codesign -fs """ + signingIdentity + """ " + frameworks(i)

    Result = DoShellCommand(cmd, 30, code)

    // If the sign fails, print the error and stop the build
    If code &lt;&gt; 0 Then
      print Result
      cancelBuild
    End If
  Next i
End If</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
