Closed yanyuxuanz closed 5 years ago
You can make a proxy object with required functions and pass it to a newly created window:
Main window:
var API = {
msgBox: function(args..) { view.msgbox.apply(view, args); },
nativeCall: function(args..) { view.nativeCall.apply(view, args); },
};
view.window( {
type: View.POPUP_WINDOW,
url: ...,
parameters: API, // <-- pass our API to a new window
});
New window:
var API = view.parameters;
API.msgBox(#information, "Hello");
Also a slightly easier approach with global functions via View.funcName
(note capital letter - it's a class in opposite to view
- the instance (object) of the class): https://sciter.com/forums/topic/how-to-call-the-native-function-from-the-dialog-view/#post-46473
aha,Solved the problem, same as you said.Thanks.
if I use tiscript to create a new window,then I can't use "view" Object to call go's EventHandler window.DefineFunction();Perhaps I don't know which I have a mistake.. In other words,the main go can only provide handlers for the main window.