24.10.2014 Views

TMS iCL DEVELOPERS GUIDE - TMS Software

TMS iCL DEVELOPERS GUIDE - TMS Software

TMS iCL DEVELOPERS GUIDE - TMS Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>TMS</strong> SOFTWARE<br />

<strong>TMS</strong> <strong>iCL</strong><br />

<strong>DEVELOPERS</strong> <strong>GUIDE</strong><br />

updated from iCloud.<br />

OnDocumentsLoaded<br />

OnDocumentsRefreshed<br />

OnInitialized<br />

OnDocumentDataChanged<br />

Event called when the documents are loaded,<br />

after calling LoadDocuments.<br />

Event called when the documents are refreshed.<br />

Event called when iCloud is initialized.<br />

Event called when an iCloud document data has<br />

changed.<br />

Initialization<br />

When dropping a component on the form, it will try to connect to the iCloud document storage<br />

container specified by the ContainerIdentifier property. If you have no intention to create multiple<br />

containers (such as the difference between a paid and a trial application), leave the<br />

ContainerIdentifier empty, so the default container is accessed. As this process is asynchronous, an<br />

event is triggered when the component is done initializing.<br />

After initialization succeeds, the documents can be loaded. If the initialization fails, you can try to<br />

reconnect by calling <strong>TMS</strong>FMXNativeiCloudDocument1.SwitchContainer;<br />

procedure TForm1.<strong>TMS</strong>FMXNativeiCloudDocument1Initialized(Sender: TObject;<br />

ASuccess: Boolean);<br />

begin<br />

if ASuccess then<br />

<strong>TMS</strong>FMXNativeiCloudDocument1.LoadDocuments;<br />

end;<br />

When the documents are loaded, the OnDocumentsLoaded event is called, and the listbox can be<br />

filled with the names of the documents.<br />

procedure TForm1.<strong>TMS</strong>FMXNativeiCloudDocument1DocumentsLoaded(Sender:<br />

TObject);<br />

var<br />

doc: T<strong>TMS</strong>FMXNativeiCloudDocumentItem;<br />

I: Integer;<br />

begin<br />

ListBox1.BeginUpdate;<br />

ListBox1.Clear;<br />

for I := 0 to <strong>TMS</strong>FMXNativeiCloudDocument1.DocumentCount - 1 do<br />

begin<br />

doc := <strong>TMS</strong>FMXNativeiCloudDocument1.DocumentByIndex[I];<br />

// ListBox1.Items.Add(doc.DisplayName);<br />

ListBox1.Items.Add(doc.FileSystemName);<br />

end;<br />

150

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!