Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/Tools/CUPS/CUPS
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS Main Plugin, MBS Tools Plugin, MBS Util 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, 17th Mar 2012.
Project "CUPS.rbp"
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 PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() if not TargetMachO then MsgBox "This feature is Mac OS X only." Return end if dim v as new WebViewMBS(0,0,500,800) v.LoadURL "http://www.monkeybreadsoftware.de/" v.preferences.shouldPrintBackgrounds=true // show background // give some time to load website DelayMBS 3.0 dim s as string = v.RenderDocumentToEPS dim f as FolderItem = SpecialFolder.Desktop.Child("test.ps") dim t as BinaryStream = f.CreateBinaryFile("") t.Write s 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:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Tools Plugin.




Links
MBS Xojo Plugins