rust-sciter icon indicating copy to clipboard operation
rust-sciter copied to clipboard

Window as arguments cause error

Open Donald2010 opened this issue 2 years ago • 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 ?

Donald2010 avatar Mar 31 '22 14:03 Donald2010

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.

pravic avatar Apr 04 '22 06:04 pravic