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 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.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 15.2 ('Xojo Power Tricks')
Instant purchase and download via GumRoad!

FEATURE

Inside Xojo

Exploring Delegates, WebFile, and WebPicture

Issue: 15.2 (March/April 2017)
Author: Christian Schmitz
Author Bio: Christian Schmitz is the creator of the Monkeybread Software Xojo Plugins.
Article Description: No description available.
Article Length (in bytes): 24,653
Starting Page Number: 27
Article Number: 15204
Related Link(s): None

Excerpt of article text...

There are often features of Xojo that we forget about or don't fully use. Today we'll explore a few of these more deeply. In particular, we'll explore delegates, WebFile, and WebPicture.

Delegates

How to pass function pointers

With REALbasic 2007 Release 4 the new delegate feature was introduced to the language. You can declare delegate data types, use them for properties, assign methods, and invoke them. This is excellent for callbacks or to keep a list of functions around for calling by name or index. And, of course, for declares, it is very handy to pass Xojo functions to be called from a C library.

Delegates decouple the interface of the code from its implementation. This is comparable to events or interfaces in Xojo. Somewhere you declare the interface to a method, somewhere else you have a method which you assign, and somewhere else you call it. With the decoupling, you can treat methods as variables and pass them around. You can even store them in a dictionary!

Defining a delegate

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