Minimum Origin Version Required: Origin 2017 SR0
Invoke JavaScript function by name.
BOOL CallJavaScript( LPCTSTR lpcszFunc )
Returns TRUE on success, FALSE on failure.
JavaScript:
<script> function LineMove() { var XValue = document.getElementById("X"); XValue.value = window.external.ExtCall("GetXValue"); } </script>
Labtalk:
line_move($(this.X))
OriginC:
class LTcallJSDlg: public HTMLDlg { public: void LineMove(double dVal) { m_dXValue = dVal; m_dhtml.CallJavaScript("LineMove"); } double GetXValue() { return m_dXValue; } } BEGIN_DISPATCH_MAP(LTcallJSDlg, HTMLDlg) DISP_FUNCTION(LTcallJSDlg, GetXValue, VTS_I4, VTS_VOID) END_DISPATCH_MAP static LTcallJSDlg* s_pDlg = NULL; void LTcallJSDlgHTML() { LTcallJSDlg dlg; s_pDlg = &dlg; dlg.DoModalEx(GetWindow()); s_pDlg = NULL; } void line_move(double dVal) { if ( s_pDlg ) { s_pDlg->LineMove(dVal); } }
Control.h