Platforms to show: All Mac Windows Linux Cross-Platform
/MacControls/NSTextView show invisible characters
Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/NSTextView show invisible characters
This example is the version from Tue, 22th Oct 2012.
Project "NSTextView show invisible characters.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action()
l.showInvisibleCharacters = me.value
TextArea1.Refresh
End EventHandler
End Control
EventHandler Sub Open()
// create the plugin class which has some extra features
l = new NSLayoutManagerMBS
// get textview
dim n as NSTextViewMBS = TextArea1.NSTextViewMBS
// get container
dim c as NSTextContainerMBS = n.textContainer
// and replace the layout manager with our special one
c.replaceLayoutManager l
// make the replacement characters red
l.textColor = NSColorMBS.redColor
// you can customize characters if you don't like our defaults
// space
'l.InvisibleCharMapping(asc(" ")) = "+"
// tab
'l.InvisibleCharMapping(9) = "*"
// EndOfLine
'l.InvisibleCharMapping(10) = "!"
'l.InvisibleCharMapping(13) = "!"
End EventHandler
Property l As NSLayoutManagerMBS
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
End Project
See also:
The items on this page are in the following plugins: MBS MacControls Plugin.