Skip to content

Tag: AprendeXojo

Updated: Make Your Own Classes Iterables

In programming, iterators are the mechanisms that allow us to run through all the items of a collection without needing to know in advance how many of them compose that collection. To do this, we can use the commands For Each… Next in Xojo. What are the main differences when comparing For Each… Next with the conventional For… Next? See how the For Each… Next loop iterates every item associated with the object. It’s a more concise, stylish and Object-Oriented (OOP) way of doing things when compared with the classic For… Next loop.

Comments closed

Canvas: How to Create Custom UI Controls

Xojo includes a good amount of UI controls available from the Library for Desktop, Web, iOS and Raspberry Pi targets. These are the pieces that allow you to layout the user interface of your apps: properties, methods and events that, when combined, define the specific behavior of the project at hand.

Sometimes, subclassing the available controls is the answer to add specific behaviors you need. But what happen when none of the controls offer what you need, whether visually or functionally? The answer is the Canvas class (for Desktop projects), WebCanvas class (for Web projects) and iOSCanvas class for iPhone and iPad devices. But how do you create your own UI controls from scratch? Read on to learn…

Comments closed

Recursion: Emptying a Folder

Do you need code to delete the files and folders from the selected folder? In that case, there is a technique I propose to you and that is based on recursion. That is, the ability of a function to call itself repeatedly until the task is complete; in this case, the function will call itself every time it detects a new folder/directory inside the designated original folder/directory.

Comments closed

Tutorial: Saving WebCanvas Images to Disk

The WebCanvas control is used for drawing graphics in web apps. It takes advantage of the HTML5 Canvas making it fast and powerful. Sometimes is can be useful to be able to save the graphics drawn in the WebCanvas to an image file, but unfortunately there is no built-in Xojo method to do this.

However, by using a little JavaScript you can easily add this capability to Xojo.

Comments closed

Software Distribution Simplified with GuancheMOS

In an ideal world there is a person responsible for every step in software development, from coding, UI design, distribution, documentation, marketing and support. All of this can seem really overwhelming for independent developers and small businesses. But if you break it down and take it one piece at a time, it’s manageable by even the smallest team of one. Right now, let’s look at software distribution.

For software, distribution usually means generating and validating unique serial numbers for each of your products and users. Serial numbers (or license keys) help you manage your users, unlock a free trial or demo version for full use and, of course, minimize illegal use of your apps.

Comments closed

Prepare Your Classes to Work in Simulated or Real Modes

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’m not talking about Unit Testing here, though I highly recommend the excellent session on that topic from XDC 2018.

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.

So let’s establish a mechanism that allows us tell our apps when to run in a “simulated” mode vs. a “real” mode for all or some of the components that we need to test along the development cycle.

Comments closed

How to Add User Interface Controls at Runtime

Admit it – this is one of those questions that, sooner or later, arise to every Xojo newcomer: How can I add new UI controls to the Window at runtime? And if you are considering this too, then the good news is that the answer is more simple than you probably expect… sitting right there on the Inspector under the Attributes tab. Yes, this is all about the Control Set!

Comments closed