npEdge plugin

About this plugin

This plugin allow you to use the Edge Chromium Runtime WebView2 in your VisualNeo apps. You can place one or more Edge Chromium browsers in VisualNeo rectangles and then control the browser object instances with the provided plugin actions, react when a specific browser object instance event is fired, etc. It's possible to send messages from the HTML pages to VisualNeo and vice versa, as well to execute Javascript code of the HTML pages. This plugin can be also used as a PDF documents viewer, since the used browser has a PDF viewer available out of the box. Take a look at the included plugin samples. Enhance your apps saying goodbye to the venerable Internet Explorer and hello to the modern Edge Chromium browser!

Thirparty

This plugin are imposible without the aid of this people:

Thanks a lot!

Plugin actions index

npEdgeCreate

Create a new instance of a Edge object and attach it to a VisualNeo rectangle object. You must specify the VisualNeo rectangle in which you want to create the browser object instance. The result variable store "True" if everything is OK, or "False" if an error occur.

For the Data folder argument you can specify a folder path in which the Edge Runtime will create the right stuff for the browser object instance. You can specify different data folders for different browser object instances, but it's not mandatory. In fact, the Data folder is not mandatory: if you leave the Data folder empty, then the referred folder will be created aside your app's executable. However, can be a good idea to set a Data folder path to assert that the app have permissions to write into that folder.

↑↑

npEdgeDestroy

Destroy a previously created Edge object instance and deattach from their VisualNeo rectangle. You must specify the VisualNeo rectangle in which you previusly created the browser object instance. Note that this action is not mandatory, that is, if you close the app the any browser object instance will be propertly destroyed.

↑↑

npEdgeDestroyAll

Destroy all previously created Edge objects instances and deattach from their VisualNeo rectangles. Note that this action is not mandatory, that is, if you close the app the any browser object instance will be propertly destroyed.

↑↑

npEdgeOptions

Specify general options of a Edge object instance. Set to "True" or "False" the various general options that this action Properties dialog offers to you. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgeAvailable

Check if the Edge Runtime is available to be used in the system. This action can be executed previously to try to create any instance of the Edge browser objects. This action determines if the Edge Runtime WebView2 is available to be used in the system. You can download the Edge Runtime WebView2 in various flavours and then include it in your app installation, for example. Note that the Edge Runtime WebView2 must be installed in the system in order to get this plugin working as expected. The "WebView2Loader.dll" file (which is included in the samples folder) must be also be present aside your app's executable file folder.

↑↑

npEdgeSetBrowserArgs

This action can be executed to established optional browser arguments / flags which act for all the Edge object instances. This action must be called before you create any Edge browser instance using the npEdgeCreate action. For more information about the available browser arguments / flags you can take a look at this Microsoft page.

↑↑

npEdgeGetBrowserArgs

Execute this action to retrieve the possible previously established browser arguments by using the npEdgeSetBrowserArgs action. The result variable store the previously established browser arguments if any or an empty string if there is no established browser arguments.

↑↑

npEdgeNavigate

Navigate to the specified URL in the specified Edge object instance.

↑↑

npEdgeAddScript

Add the specified Javascript code (you can also specify a Javascript file path) to be inserted in the document when it's loaded. You can then use this Javascript, for example, with the npEdgeExecScript action. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgeExecScript

Execute the specified Javascript code in the specified Edge object instance. Take a look at the Messages.pub sample app which is included with the plugin installation: you can see how we prepare a Javascript function in the "Messages.html" file: that function is executed from VisualNeo using this plugin action. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgePostMessage

Send a message to the current page in the specified Edge object instance. Take a look at the Messages.pub sample app which is included with the plugin installation: you can see how we prepare a Javascript message handler in the "Messages.html" file: that message hander is fired from VisualNeo using this plugin action. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgeStop

Stop the navigation process in the specified Edge object instance. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action. You can execute the npEdgeCanBack action to determine is there is a possible page in the history to be back nagivated.

↑↑

npEdgeRefresh

Refresh the current page in the specified Edge object instance. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action. You can execute the npEdgeCanBack action to determine is there is a possible page in the history to be back nagivated.

↑↑

npEdgeBack

Navigate to the previous history page in the specified Edge object instance. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action. You can execute the npEdgeCanBack action to determine is there is a possible page in the history to be back nagivated.

↑↑

npEdgeForward

Navigate to the next history page in the specified Edge object instance. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action. You can execute the npEdgeCanForward action to determine is there is a possible page in the history to be forward nagivated.

↑↑

npEdgeOpenDevTools

Open the Developer Tools window for the specified Edge object instance. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgeSourceUrl

Get the current source URL of the specified Edge object instance. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgeDocTitle

Get the current document title of the specified Edge object instance. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgeShowHtml

Show the specified HTML into the specified Edge object instance. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgeCanBack

Check if is possible to navigate to the previous history page in the specified Edge object instance. The result variable store "True" if there is a page in the browser's history to be back navigated. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npEdgeCanForward

Check if is possible to navigate to the next history page in the specified Edge object instance. The result variable store "True" if there is a page in the browser's history to be forward navigated. Note that you must wait for the npOnEdgeActive event in order to execute this action, in other words, once the referred event is fired, you can execute this action.

↑↑

npOnEdgeActive

Set a publication subroutine to be executed when the specified Edge object instance active event is fired. This event is fired if everything is OK after you create an object instance of the Edge object, so the browser is ready to be used and you can execute other plugin's actions like npEdgeNavigate. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances.

↑↑

npOnEdgeMessage

Set a publication subroutine to be executed when the specified Edge object instance message event is fired. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances. The message variable store the message that the HTML page has send to VisualNeo.

Take a look at the Messages.pub sample app included by the plugin installation. Basically you can use the "window.chrome.webview.postMessage('Here your message');" Javascript code to send messages from the HTML pages to your VisualNeo app, that is, once you execute that Javascript code this event is fired and you can get the sended message which is stored in the message variable.

↑↑

npOnEdgeUrlChanged

Set a publication subroutine to be executed when the specified Edge object instance URL changed event is fired. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances. The URL variable store the changed URL.

↑↑

npOnEdgeTitleChanged

Set a publication subroutine to be executed when the specified Edge object instance document title changed event is fired. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances. The Title variable store the changed document title.

↑↑

npOnEdgeNavStarting

Set a publication subroutine to be executed when the specified Edge object instance navigation starting event is fired. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances. The Title variable store the changed document title.

↑↑

npOnEdgeNavCompleted

Set a publication subroutine to be executed when the specified Edge object instance navigation completed event is fired. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances. The Title variable store the changed document title.

↑↑

npOnEdgeDomLoaded

Set a publication subroutine to be executed when the specified Edge object instance document DOM content loaded event is fired. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances. The Title variable store the changed document title.

↑↑

npOnEdgeNewWindow

Set a publication subroutine to be executed when the specified Edge object instance request a new window to be opened. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances. The Uri variable stores the uri of the window to be opened, and, you can set the Handled variable to "True" if you want to avoid the new window to be opened. So basically if you set to "True" the Handled variable you can use the Uri variable to with npEdgeNavigate in order to navigate to the requested uri in the same browser window / rectangle.

↑↑

npOnEdgeDownload

Set a publication subroutine to be executed when the specified Edge object instance want to download a file. The rectangle variable store a specific browser object instance rectangle, so you can use the same subroutine to handle events from various browser object instances. You can set to true the "CancelVar" variable if you want to cancel the file download. On the other hand, you can set to true the "HandledVar" variable, in order to handle the file download. The "FilePathVar" variable store the file path in which will be downloaded. You can change this "FilePathVar" variable to establish another different place for the file to be downloaded. Take a look at the Download publication sample to see this event in action.

↑↑

Action errors subroutine

All the NeoPlugins deal with errors in the same way that VisualNeo does: when the plugin found an action error the [LastError] variable store information about the error, so you can take care about this variable when execute an action.

But all the NeoPlugins also incorporate an advanced way to deal with possible action errors. You can define a subroutine named OnNeoPluginActionError in order to be executed when some action error are found and you can use this variables inside:

Note that this error handling subroutine are shared for all the NeoPlugins, so you no need to specify a subroutine for every plugin you use in your publication because the same subroutine are recognized and automagically used by every NeoPlugin. Below you can view a sample of this subroutine code:

:OnNeoPluginActionError
  AlertBox "NeoPlugin Error" "Error [LastError] in plugin: [PluginName]"
Return

Also note that the use of this NeoPlugins error handling subroutine is completelly optional. You can continue using the [LastError] variable as usual and even use the both methods at the same time.

↑↑