Skip to content

Tag: Design Patterns

Updated Tutorial: Active Words

This post was originally published in 2018 and has been updated to use Xojo API 2.0.

Follow this tutorial to create active, aka clickable, words in the text of a TextArea control in your Xojo projects. Learn to use the Object-oriented Delegate design pattern to dynamically change how your app reacts when the user clicks on those active words. Best of all, this project is cross-platform, so you can use it for macOS, Windows and Linux!

Comments closed

Singletons and the Web

The singleton design pattern has its place in the desktop environment where there will be only one user running the application, and when that user quits the app the singleton is destroyed. This doesn’t fit the requirements of a multi-user environment such as the web where many users will be accessing the application at once. I recently came across this issue when porting a desktop app to the web which required me to design a singleton class that is session sensitive. Here’s a walk through of how I achieved my goal. Please note that scopes are particularly important when creating this class.

Comments closed

Tutorial: Active Words

Follow this tutorial to learn how to create active (clickable) words in a text of a TextArea control using the OOP Delegate design pattern, which allows you to dynamically change how your app will react when the user clicks on any of these active words. Best of all, this is cross-platform, so you can use it for macOS, Windows and Linux deployments!

Comments closed

An Insider’s Top 10 Code-Free Tips To Being A Skilled Programmer

At Xojo we’re a company of programmers who work with programmers and after 21 years or so, we like to think we know our stuff. In honor of International Programmer’s Day today, we’d like to offer our experience in the form of a listicle 😉

Whether you’re new to programming or an experienced developer, there are some things you’ll just never find in a reference manual. We’re passionate about writing good code and these are our 10 tips to be a better programmer.

Comments closed

Design Patterns in Xojo: Observer, Part II

In previous blog entries we saw how easy it is to implement the Design Pattern Singleton and how we can find the Observer Design Pattern already implemented on several Xojo features by default, greatly simplifying our code and interaction between the objects. Now, as promised, it is time to put it all in practice, creating our own Notification Center: a class that will allow us to share the same unique instance for the entire App (Singleton), and that can use any object in order to register itself for receiving notifications by the observed Control, for one or more message (the notifications themselves).

Comments closed

Design Patterns in Xojo: Observer, Part 1

In a previous post we saw how to implement the Singleton Design Pattern in our Xojo apps. Now, it is time to look at another useful Design Pattern you can use in your apps: the Observer Design Pattern. This one solves the kind of question “How can the ‘x’ controls be automatically notified every time there are changes on ‘y’?” Sound interesting? Let’s see how!

Faro.jpg

In fact, this is the first of a two part series regarding the Observer Design Pattern. This one will focus on how easy is to implement using the interfaces already available in Xojo for UI controls like the PushButton, the BevelButton, and also for the Timer class. In Part 2, we will see how to implement the Observer Design Pattern from scratch, using our own Classes and Interfaces, so it will be easier to understand the mechanisms behind this Pattern and how to use it.

Comments closed

Design Patterns in Xojo: Singleton

One of the best things that Xojo offers to programming newcomers is that they can simply jump-in and start to write code. In a matter of a few hours they’ll have a functional app! Nothing new here. (Or for not-so-newcomers, a fast way of creating a functional prototype from a idea).

CandyMachine.pngBut as these users advance in their Xojo skills, they probably will care about coding better and to embrace the OOP way of doing things. After all, Xojo is a modern programming language with Classes, Inheritance, Interfaces and a bunch of the usual OOP paradigms that have much to offer: reusability, better maintainability and a lot of flexibility.

Comments closed