Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Tools Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/CUPS/CUPS
This example is the version from Sun, 5th Nov 2022.
Project "CUPS.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim f as FolderItem = SpecialFolder.Desktop.Child("test.ps")
dim t as TextOutputStream = f.CreateTextFile
t.WriteLine "%!PS"
t.WriteLine "/Courier findfont"
t.WriteLine "20 scalefont"
t.WriteLine "setfont"
t.WriteLine "72 500 moveto"
t.WriteLine "(Hello world!) show"
t.WriteLine "showpage"
End EventHandler
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
EventHandler Sub Change()
PushButton3.Enabled=me.ListIndex>=0
if me.ListIndex>=0 then
EditField1.text = me.Cell(me.ListIndex,2)
else
EditField1.text=""
end if
End EventHandler
EventHandler Sub Open()
for each c as CUPSDestinationMBS in CUPSMBS.GetDestinations
me.AddRow c.Name
'System.DebugLog c.Name
if c.isDefault then
me.CellBold(me.LastIndex,0)=true
end if
me.cell(me.LastIndex,1)=c.Instance
dim lines(-1) as string
for each o as CUPSOptionMBS in c.Options
lines.Append o.Name+": "+o.Value
'System.DebugLog o.Name+": "+o.Value
next
me.Cell(me.LastIndex,2)=Join(lines,EndOfLine)
next
End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action()
dim f as FolderItem = SpecialFolder.Desktop.Child("test.ps")
dim printer as string = Listbox1.Cell(Listbox1.ListIndex,0)
call CUPSMBS.PrintFile(printer, f, f.Name)
End EventHandler
End Control
Control EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
End Control
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 Tools Plugin.