Platforms to show: All Mac Windows Linux Cross-Platform
/Tools/CUPS/Printer Selection on Mac
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/Printer Selection on Mac
This example is the version from Wed, 10th Dec 2013.
Project "Printer Selection on Mac.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control OpenPrinterButton Inherits PushButton
ControlInstance OpenPrinterButton Inherits PushButton
EventHandler Sub Action()
// Mac uses window title for print job
dim t as string = Title
title = CurrentMethodName
'dim ps as new PrinterSetup
dim g as Graphics = OpenPrinter'(ps)
if g<>Nil then
g.DrawString "Hello World", 50, 50
end if
// restore
Title = t
End EventHandler
End Control
Control OpenPrinterButton1 Inherits PushButton
ControlInstance OpenPrinterButton1 Inherits PushButton
EventHandler Sub Action()
// Mac uses window title for print job
dim t as string = Title
title = CurrentMethodName
'dim ps as new PrinterSetup
dim g as Graphics = OpenPrinterDialog '(ps)
if g<>Nil then
g.DrawString "Hello World", 50, 50
end if
// restore
Title = t
End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub DoubleClick()
dim n as string = me.List(me.ListIndex)
CUPSMBS.SetDefaultPrinter(n)
LoadList
End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
EventHandler Sub Open()
LoadList
if TargetCocoa then
MsgBox "please check the other project for Cocoa."
elseif TargetMachO then
// ok
else
MsgBox "This example is for Mac."
end if
End EventHandler
Sub LoadList()
List.DeleteAllRows
for each c as CUPSDestinationMBS in CUPSMBS.GetDestinations
list.AddRow c.Name
if c.isDefault then
list.Cellbold(list.LastIndex,0) = true
end if
next
End Sub
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
The items on this page are in the following plugins: MBS Tools Plugin.