Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Printing/Print Jobs
Function:
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Printing/Print Jobs
This example is the version from Wed, 27th Mar 2012.
Project "Print Jobs.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not TargetWin32 then MsgBox "This examples if only for Windows." Return end if End EventHandler
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control LoadAllJobs Inherits PushButton
ControlInstance LoadAllJobs Inherits PushButton
EventHandler Sub Action() // selected printer dim i as WindowsPrinterInfoMBS = PopupPrinter.RowTag(PopupPrinter.ListIndex) dim w as new WindowsPrinterMBS(i.PrinterName) // get all jobs dim jobs(-1) as WindowsPrinterJobMBS = w.AllJobs // and show in Listbox List.DeleteAllRows for each j as WindowsPrinterJobMBS in jobs AddJob j next End EventHandler
End Control
Control PopupPrinter Inherits PopupMenu
ControlInstance PopupPrinter Inherits PopupMenu
EventHandler Sub Change() LoadJob.Enabled = me.ListIndex>=0 LoadAllJobs.Enabled = me.ListIndex>=0 End EventHandler
EventHandler Sub Open() // add printer namses to popup dim list(-1) as WindowsPrinterInfoMBS = WindowsPrinterInfoMBS.LocalPrinters for each w as WindowsPrinterInfoMBS in list me.AddRow w.PrinterName me.RowTag(me.ListCount-1) = w next // select first if me.ListCount > 0 then me.ListIndex = 0 end if End EventHandler
End Control
Control LoadJob Inherits PushButton
ControlInstance LoadJob Inherits PushButton
EventHandler Sub Action() // selected printer dim i as WindowsPrinterInfoMBS = PopupPrinter.RowTag(PopupPrinter.ListIndex) dim w as new WindowsPrinterMBS(i.PrinterName) dim n as integer = val(JobID.Text) // get job dim j as WindowsPrinterJobMBS = w.GetJob(n) // and show in Listbox List.DeleteAllRows if j<>Nil then AddJob j end if End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control JobID Inherits TextField
ControlInstance JobID Inherits TextField
End Control
Sub AddJob(j as WindowsPrinterJobMBS) List.AddRow str(j.JobID) List.Cell(List.LastIndex, 1) = j.Document dim s as string = j.StatusString if s = "" then s = str(j.Status) end if List.Cell(List.LastIndex, 2) = s List.Cell(List.LastIndex, 3) = str(j.TotalPages) dim w as WindowsDeviceModeMBS = j.DevMode List.Cell(List.LastIndex, 4) = str(w.Copies) 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

Feedback, Comments & Corrections

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




Links
MBS Xojo PDF Plugins