Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window as arguments cause error #135

Open
Donald2010 opened this issue Mar 31, 2022 · 1 comment
Open

Window as arguments cause error #135

Donald2010 opened this issue Mar 31, 2022 · 1 comment
Labels

Comments

@Donald2010
Copy link

Donald2010 commented Mar 31, 2022

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 ?

@pravic
Copy link
Member

pravic commented Apr 4, 2022

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 pravic added the question label Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants