Article Preview
Buy Now
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):
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.