WebViewWebMessageReceivedEventArgs
class cAlgo.API
DesktopCLICloud
Provides data for the WebView control WebMessageReceived event.
Environment behaviour
CLI — not supported. Never raised in the CLI: the events that pass it never fire there (WebView.WebMessageReceived).
Cloud — not supported. Never raised in the cloud: the events that pass it never fire there (WebView.WebMessageReceived).
Definition
public class WebViewWebMessageReceivedEventArgs
Namespace: cAlgo.API · Group: EventArgs
Examples
protected override void OnStart()
{
var webView = new WebView();
webView.WebMessageReceived += OnWebMessageReceived;
Chart.AddControl(webView);
webView.NavigateToStringAsync("<button onclick=\"window.chrome.webview.postMessage('buy')\">Buy</button>");
}
private void OnWebMessageReceived(WebViewWebMessageReceivedEventArgs args)
{
Print("Message {0} received from {1}", args.Message, args.Source);
}
def on_start(self):
webView = WebView()
webView.WebMessageReceived += self.on_web_message_received
api.Chart.AddControl(webView)
webView.NavigateToStringAsync("<button onclick=\"window.chrome.webview.postMessage('buy')\">Buy</button>")
def on_web_message_received(self, args):
api.Print(f"Message {args.Message} received from {args.Source}")
Properties
| Name | Description |
|---|---|
MessageDesktopCLICloudstring | The message that was received. |
SourceDesktopCLICloudstring | Gets the URI of the document that sent this web message. |
WebViewDesktopCLICloudWebView | WebView Control. |