Skip to content

Tag: API

Tip: Pass Values Between Windows with an API

A question on the Xojo Forum got me thinking that it may not be obvious how to avoid having to reach inside another window (or dialog etc.) to access its controls to get and set values. I’m sure we all have done this at one time or another but it really is something you should avoid. Here’s a small app to demo how to make an API instead:

Comments closed

What is Xojo?

2017’s first “What is Xojo?” webinar was well received and there were lots of questions. Rather than include the questions in the video, I’ve included a…

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 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 closed

How to Recursively Delete a Folder

While Xojo doesn’t currently provide a direct way of recursively deleting a folder, there are various options that will allow you to do this:

1. Recursively iterate through all the folders, deleting each one. You can read about that at our Developer Site, this is the best cross-platform way.
2. Use the Shell to recursively delete a folder (i.e. “del /s” on Windows, or “rm -rf” on OS X and Linux)

Windows specific ways:
3. SHFileOperation (an older API)
4. IFileOperation (the more modern API that Windows recommends over option #3)

I’ve decided to look at option #4, since this allows more customized options, like the ability to show a progress dialog. However, it is also the slightly more complicated option since it deals with COM & Delegates. The example illustrates this:

Comments closed

Write a Slackbot in Less Than 20 Lines of Code

What is Slackbot?

Slack has an API called “slash commands” that lets a user type a slash (/) followed by a command name in order to perform a special action. For example, Slack has many built-in slash commands, one example is /help. Here’s how you can easily add your own slash commands using a Xojo web app and the HandleSpecialURL (or HandleURL) method.

Your slash command makes an HTTP request to your Xojo web service app. The web services does its thing and then returns the result back to Slack to display.

Comments closed

Generating Xojo Code From Paw

At Xojo, we work with a lot of HTTP REST APIs. So many in fact that I’ve spent time creating custom test harnesses to make sure that whatever I was currently coding would be compatible as well as being a test suite just in case the API changed in some subtle way (whether it be a bug fix or an API refactor gone awry). The problem with the custom test harnesses is that they’re not very portable and you end up having to create a new one for each API that you interface with.

Comments closed