You can call into Linux 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 using Linux documentation.
Comments closedTag: Declares
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 closedMany 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 closedThe other day Geoff was working an iOS project and asked me if there was a way to hide the border on an iOS Text Field. It turns out that this is pretty easy. Here’s how.
Comments closedIn 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 Bit.ly. 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 closedI’m sure you’ve all seen the iOS Mail app, which displays the number of unread messages in a small red badge in the top right of the app icon. You can do this too with your Xojo app and the magic of the Declare command.
Comments closedWhen doing a lot of manipulation to a TextArea’s contents under Cocoa, performance can suffer due to the underlying NSTextView doing work on layout and glyph selection. This can be sped up by telling the text view that you’re going to begin editing. You can do this by using a few Cocoa Declares.
Comments closedUpdate Aug 2017: Starting with Xojo 2017 Release 2 your app icons are automatically included in 64-bit Windows apps without having to do the workarounds described in this post. Upgrade today! If you are still using older versions of Xojo, then these workarounds are still necessary.
Comments closedOur user community has been busy enhancing the capabilities of Xojo for iOS with Declares!
We have been quite pleased with the feedback we’ve received about Xojo iOS, but we are commonly asked when Xojo will support a specific iOS feature that it does not yet have. We will be adding new iOS features with each release, but you may not have to wait for us to add a feature. With a bit of knowledge about CocoaTouch and the use of the Declare command in Xojo, there are many things you can take advantage of today.
Comments closedSometimes you need a feature that is not available directly from the Xojo framework. Responding to this need is what Declares are designed for: to get access to system native APIs. On OS X, you typically look at the Cocoa APIs. On Windows, the Win32 APIs. Finally on Linux, the GTK APIs.
Comments closed