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 20.3 ('XDC Anywhere')
Instant purchase and download via GumRoad!

COLUMN

Great Shots With Continuity Camera

Use your iOS device to take a picture for your Mac

Issue: 20.3 (May/June 2022)
Author: Stefanie Juchmes
Author Bio: Stefanie studied computer science at the university in Bonn. She came in touch with Xojo due to the work of her brother-in-law and got a junior developer position in early 2019 at Monkeybread Software.
Article Description: No description available.
Article Length (in bytes): 9,271
Starting Page Number: 78
Article Number: 20309
Resource File(s):

Download Icon project20309.zip Updated: 2022-05-05 14:12:15

Related Link(s): None

Excerpt of article text...

Pictures are worth a thousand words. We can import them directly from our computer, but what if I want to take a picture with my iPhone to use instantly in my application on my Mac? Of course, I could use my web cam to take the picture in an awkward way, or I can use the Continuity Camera from the MBS Xojo plugins.

With this function I can take a picture, draw a sketch, or scan a document with my iOS Device. I get back an image or PDF document, which I can directly use in my application. Let me show you how to implement this functionality with a small example.

In this example the GUI of the Main window has a canvas and three pushbuttons labeled Import Photo, Import Document, and Import Sketch. We call the buttons ImportPicButton, ImportDocButton, and ImportSketchButton (see Figure 1).

We start writing the program in the Open event of the app. First we have to specify what should happen when data comes in later via the Continuity Camera. For this, we define a method that should be called gotData in this case.

We set this method with the shared method SetDelegate. The parameter passing looks a bit different from the other methods. We write an AddressOf and then the method name. The plugin then knows that it should call this method on incoming data.

We also have to define in which area we want to use the Continuity Camera functions. For this, we call one of the Install methods. We currently have three different parts for which we can install a receiver. With the shared method InstallForCanvas we install a receiver for Xojo canvas controls. With InstallForListbox for listboxes and with InstallForWindow for Xojo windows. We choose the last one, because we want to use the functions in the whole window.

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