Platforms to show: All Mac Windows Linux Cross-Platform
/Win/HTMLViewer Windows/HTMLViewer execCommand
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/HTMLViewer Windows/HTMLViewer execCommand
This example is the version from Sun, 5th Nov 2022.
Project "HTMLViewer execCommand.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 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
End Project
See also:
- /Win/HTMLViewer Windows/DebugBar
- /Win/HTMLViewer Windows/HTML Editor
- /Win/HTMLViewer Windows/HTML Editor Win
- /Win/HTMLViewer Windows/HTMLViewer Extensions
- /Win/HTMLViewer Windows/HTMLViewer Get and Set Field
- /Win/HTMLViewer Windows/HTMLViewer get html source
- /Win/HTMLViewer Windows/More HTMLViewer Printing
- /Win/HTMLViewer Windows/Reload htmlviewer
- /Win/HTMLViewer Windows/Run JavaScript Function
- /Win/HTMLViewer Windows/textArea Test/textArea Test
The items on this page are in the following plugins: MBS Win Plugin.