Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Win/HTMLViewer Windows/HTMLViewer execCommand
Required plugins for this example: MBS MacBase Plugin, MBS MacControls Plugin, MBS Main Plugin, MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/HTMLViewer Windows/HTMLViewer execCommand
This example is the version from Thu, 29th May 2013.
Project "HTMLViewer execCommand.rbp"
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 BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action() execCommand "bold" End EventHandler
End Control
Control BevelButton2 Inherits BevelButton
ControlInstance BevelButton2 Inherits BevelButton
EventHandler Sub Action() execCommand "italic" End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
EventHandler Sub Open() if TargetMacOS then HTMLViewer1.EditableMBS = true elseif TargetWin32 then HTMLViewer1.IEEditableMBS = true end if End EventHandler
Sub RunJavaScript(code as string) if TargetLinux then // not supported on linux. break elseif TargetWin32 and HTMLViewer1.Renderer = 1 then // Chromium not supported. break elseif TargetMacOS then call HTMLViewer1.EvaluateJavaScriptMBS code elseif TargetWin32 then call HTMLViewer1.IERunJavaScriptMBS code else // Unsupported break end if End Sub
Sub execCommand(command as string) RunJavaScript "document.execCommand('"+command+"', false, null);" 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

See also:

Feedback, Comments & Corrections

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

MBS Xojo Plugins