Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 17 in printed book and digital formats -- plus a one-year subscription (beginning with 18.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 17.4 ('100th Issue')
Instant purchase and download via GumRoad!

COLUMN

Computing Properties

Working with computed properties

Issue: 17.4 (July/August 2019)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 11,169
Starting Page Number: 58
Article Number: 17408
Resource File(s):

Download Icon project174008.zip Updated: 2019-06-30 18:21:53

Related Link(s): None

Excerpt of article text...

One feature of Xojo that beginners often overlook is computed properties. These are really cool and useful, so if you haven't used them, you need to check them out. Let's explore.

The idea behind a computed property is that it doesn't store a value the way a regular property does, but it calculates its value on the fly. In other words, it's a live result.

How is this useful? There are many uses. The most common is when you have a value that can change frequently. For instance, say you had a value that was based on the current time. Or maybe the value depends on the current value of a currency, a stock price, or an auction bid. Perhaps you want a value that includes a tax, where the tax rate might be different based on the user's location.

Whatever your need, those values can't be calculated in advance, since they might be different when they are actually used. By using a computed property, the current value is calculated right when it is used and is therefore accurate.

There's another use, too, which we'll get into later. First let's explore how to code a computed property.

Adding a Computed Property

...End of Excerpt. Please purchase the magazine to read the full article.