Index of /xtras/webview_xtra/win

Icon  Name                    Last modified      Size  Description
[PARENTDIR] Parent Directory - [DIR] lingo_examples/ 2025-05-11 12:41 - [DIR] screenshots/ 2025-05-07 09:02 - [TXT] readme.txt 2025-05-11 09:01 6.4K [   ] webview-xtra-v0.2.zip 2025-05-20 11:57 3.5M
xtra WebView
-- v0.2 (c) 2025 59de44955ebd


Features:
=========

- WebView based on the MS Edge WebView2 runtime, i.e. on a recent version of Chrome/Chromium under the hood.

- Dark Mode: window titlebars, menus, scrollBars, statusBar, dialogs (including Lingo "alerts" and scripting error messageboxes) and the message window (at runtime, not inside Director).

- Native menus created with Lingo - as alternative to Director's field based menus - that support arbitrary nested submenus (and arbitrary key shortcuts, like e.g. also F1, F2 etc.), which can either be used as popup/context menus or assigned to the stage window as main menu (menuBar).

- Native statusBar control (optionally with one or multiple right-aligned parts)

- Some dialogs: messagebox, font picker, color picker

- Some enhancements for the (runtime) message window also in standard (light) mode:
  - text font changed to better looking Consolas 10pt
  - message window has a window icon (same as the stage window)
  - Ctrl+A selects all current text


Events/Callbacks (put handlers with those names in a movie script to get notified)
================

- OnCommand (integer commandID) -- called whenever the user selects a menu item

- OnStatusBarClicked (integer isRightClick, integer sectionNum) -- sections are indexed from left to right, 0 means the main (left) section

- OnThemeChanged (bool isDark) -- called when the user changed the current Windows theme via Windows settings app


Lingo interface
===============

new object me

forget object me

	Always has to be called when using the xtra inside Director (i.e. the authoring tool)

----------------------------------------
-- WebView
----------------------------------------

webviewCreate object me, *boolAllowDevTools, intMovieNum, bgColor, boolHidden, stringWindowTitle

	Create a webview, either embedded or standalone.

	Parameters (optional):

	    boolAllowDevTools (#integer, default=FALSE)
	    	If TRUE, the DevTools (Console etc.) are available (F12)

	    intMovieNum (#integer, default=1)
	    	0: standalone browser window (webview not embedded)
	    	1: webciew embedded into stage window
	    	>1: webview embbeded into MIAW with this position in _player.windowList

	    bgColor (#color, default=COLOR_WINDOW)
	    	Background color of the webview (visible e.g. while resizing it via mouse)

	    boolHidden (#integer, default=FALSE) - Standalone mode only: window title
	    	If TRUE, the webview is hidden by default

	    stringWindowTitle (#string)
	    	Standalone mode only: title of the browser window

webviewDestroy object me

	Destroy the webview.

webviewJSBind object me, string handlerName

	Bind a global (=movie script) Lingo handler to a new global JavaScript function with the same name.

webviewJSEval object me, string javascript

	Evaluate arbitrary JavaScript code. Use bindings if you need to communicate the result of the evaluation.

webviewJSInit object me, string javascript

	Inject JavaScript code to be executed immediately upon loading a page. The code will be executed before window.onload.

webviewJSUnbind object me, string handlerName

	Remove a binding created with bind().

webviewNavigate object me, string url

	Navigate webview to the given URL. URL may be a properly encoded data URI.

webviewSetAutoSize object me

	Make webview automatically resize to the full client rect of its host window
	(ignored if webView is a standalone window)

webviewSetFocus object me

	Set/restore mouse and keyboard focus to webview.

webviewToggleFullScreen object me

	Enter/leave fullscreen mode. Fullscreen mode can also be left by pressing the ESC key.

webviewSetHtml object me, string html

	Load HTML content into the webview.

webviewSetRect object me, integer x, integer y, integer width, integer height

	Embedded mode: Set the rect of the webview.
	Standalone mode: x and y are ignored, webview's window is resized to width and height.

webviewShow object me, integer boolVisible

	Show or hide the webview.

----------------------------------------
-- Menus
----------------------------------------

createMenu object me -- returns hMenu
createPopupMenu object me -- returns hMenu
setMainMenu object me, integer hMenu
getSystemMenu object me -- returns hMenu
insertSubMenu object me, integer hMenu, integer position, string menuName -- returns hMenu
insertMenuItem object me, integer hMenu, integer position, string itemName, integer menuItemID, *intKeyCode, intKeyMod
insertSeparator object me, integer hMenu, integer position
checkMenuItem object me, integer hMenu, integer menuItemID, integer boolChecked
enableMenuItem object me, integer hMenu, integer menuItemID, integer boolEnabled
removeMenu object me, integer hMenu, integer position
removeMenuItem object me, integer hMenu, integer menuItemID
showPopupMenu object me, integer hMenu
destroyMenu object me, integer hMenu

----------------------------------------
-- StatusBar
----------------------------------------

statusBarCreate object me, *sectionWidths

	When called without parameters, create a plain statusBar without sections.
	When one or more integers are passed as parameters, each integer, from left to right, specifies the width of a new statusBar section
	that is shown on the right side of the statusBar. When the window is resized, those sections keep their fixed width, so only the main
	section on the left changes its size.

statusBarMsg object me, string message, *intSectionNum

	intSectionNum omitted or 0: Show string 'message' in the main statusBar section on the left.
	intSectionNum > 0: Show string 'message' in the corresponding statusBar section on the right.

statusBarShow object me, integer boolVisible

	Show/hide the statusBar.

----------------------------------------
-- Dialogs
----------------------------------------

showMessageBox object me, string message, string caption, integer type
showChooseFontDialog object me, string fontName, integer fontSize, integer fontWeight, integer boolItalic
showChooseColorDialog object me, object color

----------------------------------------
-- Dark Mode
----------------------------------------

useDarkMode object me, integer boolDark

----------------------------------------
-- Utilities
----------------------------------------

*appsUseDarkTheme -- returns TRUE if Windows currently uses a dark theme (for applications)
*printMsg string message, *int1, int2, int3, int4