How to save pictures in a database is without doubt one of the more frequent questions I’m asked about. I hear this from Xojo newcomers,…
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…
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.
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.
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.
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.
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!
In programming, iterators are the mechanisms that allow us to walk all the members of a collection without needing to know in advance how many of them compose such a collection; and for that we can find in Xojo the commands
For Each… Next. What are the main differences in comparison to the conventional
The first difference is that with
For Each… Next we can’t assume that we are iterating the members of the collection in order, as it is the case when using the variable of the conventional
For… Next as the Index in order to access a known member of the collection. The second difference is that the iterator will be invalid when the iterated elements are modified, or when we modify the amount of elements in the collection during the iteration process.
By default in Xojo, there are a couple of collections that are iterable: the already mentioned Arrays and also Dictionaries and FolderItem.Children. Wouldn’t it be great to extend this feature so we can add this behaviour to our own classes making them more flexible? The key to making this happen is using the two Class Interfaces already included in Xojo: Iterator and Iterable.
Some days ago (or long, long ago, depending when do you read these lines) I received an email from a developer that was porting code from his old VisualBasic domain to the native, multi-platform Xojo. He asked me how can to get the difference between two dates? I’m pretty sure that most of you will have the answer, but I told him he’ll need Xojo.Core.Date and Xojo.Core.DateInterval. If you want to know how easy it is or how to get the same result for all your code based on the old date class, then I invite you to continue reading…