You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/HTMLViewer Windows/HTMLViewer execCommand
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()
HTMLViewer1.IEEditableMBS = true
End EventHandler
Sub RunJavaScript(code as string)
if TargetWin32 and HTMLViewer1.Renderer = 1 then
// Chromium not supported.
break
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