Platforms to show: All Mac Windows Linux Cross-Platform
/MacFrameworks/CustomNSTextFieldMBS test
Required plugins for this example: MBS MacFrameworks Plugin, MBS MacBase Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/CustomNSTextFieldMBS test
This example is the version from Fri, 18th Oct 2012.
Project "CustomNSTextFieldMBS test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control CocoaControlMBS1 Inherits CocoaControlMBS
ControlInstance CocoaControlMBS1 Inherits CocoaControlMBS
EventHandler Function GetView() As NSViewMBS
t = new MyCustomNSTextFieldMBS
t.l = listbox1
Return t
End EventHandler
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
EventHandler Sub Close()
t.l = nil
t = nil
End EventHandler
Property t As MyCustomNSTextFieldMBS
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 MyCustomNSTextFieldMBS Inherits CustomNSTextFieldMBS
EventHandler Sub Action()
log CurrentMethodName
End EventHandler
EventHandler Sub Close()
log CurrentMethodName
l = nil
End EventHandler
EventHandler Sub Open()
log CurrentMethodName
End EventHandler
EventHandler Function acceptsFirstMouse(e as NSEventMBS) As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Function acceptsFirstResponder() As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Function becomeFirstResponder() As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Function canBecomeKeyView() As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Function keyDown(e as NSEventMBS) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function keyUp(e as NSEventMBS) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function menuForEvent(e as NSEventMBS, defaultMenu as NSMenuMBS) As NSMenuMBS
log CurrentMethodName
Return defaultMenu
End EventHandler
EventHandler Function mouseDown(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function mouseDownCanMoveWindow() As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Function mouseDragged(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function mouseEntered(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function mouseExited(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function mouseMoved(e as NSEventMBS, x as double, y as double) As boolean
// disabled as it makes a lot of messages
'log CurrentMethodName
End EventHandler
EventHandler Function mouseUp(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function otherMouseDown(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function otherMouseDragged(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function otherMouseUp(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function resignFirstResponder() As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Function rightMouseDown(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function rightMouseDragged(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function rightMouseUp(e as NSEventMBS, x as double, y as double) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function scrollWheel(e as NSEventMBS) As boolean
log CurrentMethodName
End EventHandler
EventHandler Function textShouldBeginEditing(fieldEditor as NSTextMBS) As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Function textShouldEndEditing(fieldEditor as NSTextMBS) As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Sub viewDidMoveToWindow()
log CurrentMethodName
End EventHandler
Sub log(s as string)
System.DebugLog s
if l<>Nil then
l.InsertRow 0, s
end if
End Sub
Property l As listbox
End Class
End Project
The items on this page are in the following plugins: MBS MacFrameworks Plugin.