Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/Spotlight/Query


Required plugins for this example: MBS MacOSX Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/Spotlight/Query

This example is the version from Fri, 14th May 2015.

Project "Query.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Query Inherits TextField
ControlInstance Query Inherits TextField
End Control
Control SearchButton Inherits PushButton
ControlInstance SearchButton Inherits PushButton
EventHandler Sub Action() if q<>nil then q.stop q=nil end if List.DeleteAllRows q=new MyQuery(query.text) if q.Handle=0 then dim t as string = ReplaceAll(query.text,"""","") q=new MyQuery("* == """+t+"""wcd || kMDItemTextContent = """+t+"""c") end if if q.Handle=0 then MsgBox "Failed to create query" else q.SetMaxCount 100 if q.Execute(q.kMDQueryWantsUpdates) then 'ok q.EnableUpdates else MsgBox "Failed to run query" end if end if End EventHandler
End Control
Control UpdateTimer Inherits Timer
ControlInstance UpdateTimer Inherits Timer
EventHandler Sub Action() MainWindow.List.DeleteAllRows dim items() as MDItemMBS = q.Results for each it as MDItemMBS in items MainWindow.List.AddRow "Add: "+it.DisplayName next Title = str(UBound(items)+1)+" items" End EventHandler
End Control
EventHandler Sub Close() if q<>nil then q.stop q=nil end if End EventHandler
Property q As MyQuery
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyQuery Inherits MDQueryMBS
EventHandler Sub Finish() MainWindow.UpdateTimer.Mode = 1 End EventHandler
EventHandler Sub Progress(AddedItems() as MDItemMBS, ChangedItems() as MDItemMBS, RemovedItems() as MDItemMBS) MainWindow.UpdateTimer.Mode = 1 End EventHandler
EventHandler Sub Update(AddedItems() as MDItemMBS, ChangedItems() as MDItemMBS, RemovedItems() as MDItemMBS) MainWindow.UpdateTimer.Mode = 1 End EventHandler
End Class
End Project

See also:

The items on this page are in the following plugins: MBS MacOSX Plugin.


The biggest plugin in space...