sciter-sdk/rust-sciter

Window as arguments cause error

Donald2010 opened this issue · 1 comments

in main.rs,

struct Handler;
impl Handler {
    fn process_window(&self, Window) -> () {   
    }
}
impl sciter::EventHandler for Handler {
    dispatch_script_call! {
        fn process_window(Window) ;
    }
}

in main.htm

var wnd = new Window({ 
                   url   :"file://D:\\develop\\rust\\child.htm",  
                   state : Window.WINDOW_HIDDEN, 
                   isTopmost: true,
                   frameType :  "solid", 
               })
               Window.this.xcall("process_window",wnd);
               wnd.state=Window.WINDOW_SHOWN;

when run, there is error:

the trait bound `*mut _WINDOW: FromValue` is not satisfied
 the trait `FromValue` is not implemented for `*mut _WINDOW`

How could I pass the child window, wnd ,or it's handle to rust ?
I wan't to some properties of new window. Or alternatively , could I create the separate child window from rust code ?

dispatch_script_call! {
        fn process_window(Value) ;
    }

Try this. Basically, leave the window as a Sciter value. What do you want to do with it in general?

sciter::Window is a wrapper over a native HWND, but Window in JS is a totally different type.