Platforms to show: All Mac Windows Linux Cross-Platform

/MacClassic/Catalog Search/Findfile with Thread demo


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/Findfile with Thread demo

This example is the version from Sun, 5th Nov 2022.

Project "Findfile with Thread demo.xojo_binary_project"
Class mainwindow Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control runButton Inherits PushButton
ControlInstance runButton Inherits PushButton
EventHandler Sub Action() dim w as workthread w=new workthread w.run End EventHandler
End Control
Control iText Inherits TextField
ControlInstance iText Inherits TextField
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub Open() me.columnalignment(1)=3 // size on right End EventHandler
End Control
Control info Inherits Label
ControlInstance info Inherits Label
End Control
End Class
MenuBar Menü
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "Ablage"
MenuItem FileQuit = "Beenden"
MenuItem UntitledMenu7 = ""
MenuItem UntitledMenu0 = "Bearbeiten"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Ausschneiden"
MenuItem EditCopy = "Kopieren"
MenuItem EditPaste = "Einfügen"
MenuItem EditClear = "Löschen"
MenuItem UntitledMenu6 = ""
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu4 = ""
End MenuBar
Class Workthread Inherits Thread
EventHandler Sub Run() dim c as CatSearchMBS dim nn,n,i as integer dim f as folderItem dim k as integer dim list as listbox dim v as folderItem dim catalogchanged as Boolean catalogchanged=false mainwindow.runButton.enabled=false c=new CatSearchMBS list=mainwindow.list list.DeleteAllRows n=volumecount-1 for i=0 to n v=volume(i) if c.search(v,true) then c.name=mainwindow.itext.text c.partialName=true nn=c.searchNext while nn>=0 if nn=2 then catalogchanged=true end if k=k+1 if k=1000 then // something wrong? msgBox "Takes a long time!? Better we stop." return end if f=c.result if f<>Nil and nn=0 then // Something found list.addrow f.name #If RBVersion < 2019 list.Cell(list.lastIndex,1)=Format((f.length+f.resourceForkLength)/1024,"0")+" KB" list.Cell(list.lastIndex,2)=readable(f.mactype) list.Cell(list.lastIndex,3)=readable(f.maccreator) #Else list.Cell(list.lastIndex,1)=Format((f.length)/1024,"0")+" KB" #EndIf list.Cell(list.lastIndex,4)=v.name end if nn=c.searchNext wend end if next mainwindow.runButton.enabled=true mainwindow.info.text=str(list.ListCount)+" items found." if catalogchanged then MsgBox "The catalog of one of the volumes changed while searching. You may have duplicate items or missing ones." End If End EventHandler
Function readable(s as string) As string // files don't need to have a creator or filetype if s=chr(0)+chr(0)+chr(0)+chr(0) then return "?" else return s end if End Function
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.


The biggest plugin in space...