SpotlightQuery.Synchronous
From Xojo Documentation
Property (As Boolean )
This property is only available on the macOS platform. For cross-platform compatibility, use #If...#Endif with the Target... specifiers to make sure you will not attempt to use this property on an incompatible platform. |
aSpotlightQuery.Synchronous = newBooleanValue
or
BooleanValue = aSpotlightQuery.Synchronous
Supported for all project types and targets.
or
BooleanValue = aSpotlightQuery.Synchronous
Supported for all project types and targets.
If True, the Run method will be synchronous. If it is synchronous, then the events will not fire.
Example
This example enables the Synchronous property.
Var query As New SpotlightQuery("kMDItemContentTypeTree == 'public.audio'")
query.Synchronous = True
query.Run
For i As Integer = 0 To query.Count - 1
ListBox1.AddRow(query.Item(i).File.DisplayName)
ListBox1.CellValueAt(ListBox1.LastAddedRowIndex, 1) = query.Item(i).File.NativePath
Next
Exception e As SpotlightException
MessageBox("A Spotlight error occurred.")
query.Synchronous = True
query.Run
For i As Integer = 0 To query.Count - 1
ListBox1.AddRow(query.Item(i).File.DisplayName)
ListBox1.CellValueAt(ListBox1.LastAddedRowIndex, 1) = query.Item(i).File.NativePath
Next
Exception e As SpotlightException
MessageBox("A Spotlight error occurred.")