Platforms to show: All Mac Windows Linux Cross-Platform
/MacClassic/Catalog Search/Find stuff from today
Required plugins for this example: MBS MacClassic Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacClassic/Catalog Search/Find stuff from today
This example is the version from Sun, 17th Mar 2012.
Project "Find stuff from today.xojo_binary_project"
Class mainwindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control volumename Inherits Label
ControlInstance volumename Inherits Label
End Control
Control bar Inherits ProgressBar
ControlInstance bar Inherits ProgressBar
End Control
EventHandler Sub Open()
w=new workthread
w.run // use .start if you don't want threading.
End EventHandler
Property w As workthread
End Class
MenuBar Menü
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "Ablage"
MenuItem FileQuit = "Beenden"
MenuItem UntitledMenu0 = "Bearbeiten"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Ausschneiden"
MenuItem EditCopy = "Kopieren"
MenuItem EditPaste = "Einfügen"
MenuItem EditClear = "Löschen"
MenuItem AppleAbout = "About..."
End MenuBar
Class Workthread Inherits Thread
EventHandler Sub Run()
dim t as integer
t=ticks
start
t=ticks-t
MsgBox format(t/60,"0.0")+" seconds."
End EventHandler
Sub additem(f as folderItem)
dim list as listbox
dim d as date
d=f.ModificationDate
list=mainwindow.list
list.addrow f.DisplayName
list.Cell(list.lastIndex,1)=d.LongDate+" "+d.LongTime
End Sub
Sub searchOnVolume(v as folderItem)
dim c as CatSearchMBS
dim f as folderItem
dim error as boolean // We ignore some errors in this example!
dim k,nn as integer
dim d as date
dim start,ende,d1,d2 as Double
d=new date
d.Minute=0
d.Second=0
d.Hour=0
d1=2147483647.0 // &H7FFFFFFF
d2=4294967296.0 // pow(2,32)
start=d.TotalSeconds
if start>d1 then
start=start-d2
end if
d.day=d.day+1
ende=d.TotalSeconds
if ende>d1 then
ende=ende-d2
end if
if v<>nil then
c=new CatSearchMBS
'c.UseIndexedSearch=true
if c.search(v,true) then
c.ModificationDateStart=start
c.ModificationDateEnd=ende
nn=c.searchNext
while nn>=0
k=k+1
if k=10000 then // something wrong?
msgBox "Takes a long time!? Better we stop."
return
end if
f=c.result
if f<>nil and nn=0 then
additem f
end if
nn=c.searchNext
wend
end if
end if
End Sub
Sub start()
dim n,i as integer
dim v as folderItem
n=volumecount-1
mainwindow.bar.maximum=n
for i=0 to n
mainwindow.bar.value=i
v=volume(i)
mainwindow.volumename.text=v.name
searchonvolume v
next
mainwindow.bar.value=n
mainwindow.bar.visible=false
mainwindow.volumename.text="ready"
End Sub
End Class
Class App Inherits Application
End Class
End Project
See also:
The items on this page are in the following plugins: MBS MacClassic Plugin.