Platforms to show: All Mac Windows Linux Cross-Platform
/MacControls/NSTextFinder and find bar
Required plugins for this example: MBS MacCocoa Plugin, MBS MacBase Plugin, MBS Main Plugin, MBS MacControls Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/NSTextFinder and find bar
This example is the version from Wed, 16th Oct 2018.
Project "NSTextFinder and find bar.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action()
dim t as NSTextViewMBS = TextArea1.NSTextViewMBS
dim n as NSScrollViewMBS = TextArea1.NSScrollViewMBS
if finder = nil then
finder = new NSTextFinderMBS
'n.findBarPosition = n.NSScrollViewFindBarPositionAboveContent
finder.client = t
finder.findBarContainer = n
finder.incrementalSearchingEnabled = true
end if
if me.Value then
if n.FindBarVisible then
finder.performAction finder.kActionShowFindInterface
return
end if
if t.usesFindBar then
n.FindBarVisible = true
return
end if
t.usesFindBar = true
end if
'n.FindBarVisible = me.Value
if me.Value then
finder.performAction finder.kActionShowFindInterface
else
finder.performAction finder.kActionHideFindInterface
end if
End EventHandler
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
Property finder As NSTextFinderMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacControls Plugin.