Article Preview
Buy Now
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):
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 acanvas
and three pushbuttons labeledImport Photo
,Import Document
, andImport Sketch
. We call the buttonsImportPicButton
,ImportDocButton
, andImportSketchButton
(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 calledgotData
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 anAddressOf
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 methodInstallForCanvas
we install a receiver for Xojocanvas
controls. WithInstallForListbox
for listboxes and withInstallForWindow
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.