Platforms to show: All Mac Windows Linux Cross-Platform
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/Clipboard Test
This example is the version from Sun, 17th Mar 2012.
Project "Clipboard Test.xojo_binary_project"
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
run
End EventHandler
End Control
Sub run()
dim c1 as ClipboardMBS
dim c2 as Clipboard
dim failed as Boolean
dim s as string
c1=new ClipboardMBS
c2=new Clipboard
const hello="Hello"
c2.SetText hello
s=c1.GetText
if s<>hello then
MsgBox "Failed to get text from clipboard! "+s
failed=true
end if
if not c1.TextAvailable then
MsgBox "TextAvailable failed! (1)"
failed=true
end if
if not c2.TextAvailable then
MsgBox "TextAvailable failed! (2)"
failed=true
end if
if c1.TextSize<>len(hello) then
MsgBox "TextSize failed! (1)"
failed=true
end if
c1=new ClipboardMBS
c2=new Clipboard
const World="World"
c1.Clear
if c1.TextAvailable then
MsgBox "TextAvailable failed! (3)"
end if
if c2.TextAvailable then
MsgBox "TextAvailable failed! (4)"
end if
c1.AddText World
s=c2.Text
if s<>World then
MsgBox "Failed to set text of clipboard! "+s
failed=true
end if
if c1.TextSize<>len(World) then
MsgBox "TextSize failed! (2)"
failed=true
end if
if not failed then
MsgBox "All tests successfull!"
end if
End Sub
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
The items on this page are in the following plugins: MBS MacClassic Plugin.