Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/HTMLViewer Mac/HTMLViewer Printing and Email
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacControls Plugin, MBS Win Plugin, MBS Main Plugin, MBS MacCocoa Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/HTMLViewer Mac/HTMLViewer Printing and Email
Project "HTMLViewer Printing and Email.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
EventHandler Sub Open() me.LoadURL "http://www.mbsplugins.de/" End EventHandler
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() call HTMLViewer1.IEPrintMBS End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() call HTMLViewer1.PrintDialogMBS End EventHandler
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action() if TargetMacOS then HTMLViewer1.preferencesMBS.shouldPrintBackgrounds=me.Value end if End EventHandler
EventHandler Sub Open() if TargetMacOS then me.Value = HTMLViewer1.preferencesMBS.shouldPrintBackgrounds end if End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() dim e as new EmailMessage dim html as string e.AddRecipient EditField4.text e.Subject = "test email" e.FromAddress = "zivi@mac.com" if TargetWin32 then html = HTMLViewer1.IEHTMLTextMBS else html = HTMLViewer1.mainFrameMBS.dataSource.data end if html = Replace(html, "<head>", "<head><base href=""http://www.mbsplugins.de/"" />") e.BodyPlainText = "see html content in this email" e.BodyHTML = html sock.Messages.Append e sock.Address = EditField1.text sock.Username = EditField2.text sock.Password = EditField3.text sock.port = 25 sock.SendMail End EventHandler
End Control
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control EditField2 Inherits TextField
ControlInstance EditField2 Inherits TextField
End Control
Control EditField3 Inherits TextField
ControlInstance EditField3 Inherits TextField
End Control
Control sock Inherits SMTPSocket
ControlInstance sock Inherits SMTPSocket
EventHandler Sub ConnectionEstablished(greeting as string) Listbox1.Addrow "connected" End EventHandler
EventHandler Sub Error() if me.LastErrorCode<>102 then Listbox1.Addrow "error "+str(me.LastErrorCode) end if End EventHandler
EventHandler Sub MailSent() Listbox1.Addrow "mail sent" End EventHandler
EventHandler Sub MessageSent(Email as EmailMessage) Listbox1.Addrow "message sent" End EventHandler
EventHandler Sub ServerError(ErrorID as integer, ErrorMessage as string, Email as EmailMessage) Listbox1.Addrow "Server error: "+ErrorMessage End EventHandler
End Control
Control EditField4 Inherits TextField
ControlInstance EditField4 Inherits TextField
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
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 MacControls Plugin.

Feedback: Report problem or ask question.

The biggest plugin in space...