Skip to content

Tag: Declare

Set Focus to a Field Using an iOS Declare

You can call into Cocoa Touch APIs to use methods and properties that are not built into the framework by using the Declare command. To create a Declare statement you first need to track down the API you want to use in Apple’s documentation: Apple Developer Documentation. Most of the time you will reference the Foundation and UIKit libraries, but there are many other libraries as well. Xojo Declares use the Objective-C names so be sure to refer to those in the documentation rather than the Swift naming.

Comments closed

WinAPILib on GitHub

Many years ago, the Window Functionality Suite (WFS) library was created by Aaron Ballman. This library was a collection of Win32 Declares (and a few other things) for accessing Windows-specific functionality that was not directly provided by the Xojo framework.

WFS is still available on GitHub, but it has languished over the years. For example, it has lots of legacy code in it for older versions of Windows that is no longer needed since Xojo only supports Windows 7 and later. WFS is also not really compatible with 64-bit projects since the Declares mostly assume 32-bit or bust.

To that end, I’ve started a new open-source project called WinAPILib that is now available on GitHub.

Comments closed

iOS Tutorial: Shorten that URL!

In this Xojo tutorial we will see how simple it is to make an iOS App that shortens an entered URL using the public API of We will use our own subclass inherited from Xojo.Net.HTTPSocket, and the Declare statement in order to use some functions and methods found on the native Cocoa Touch API. In fact, the use of Declare is mandatory because with the new Xojo Framewok we don’t yet have access to the EncodeURLComponent function available with the old framework. This one is a big help in substituting any ilegal character with his hexadecimal value for the final URL’s composition.

Comments closed