Rust bindings for Sciter

Overview

Rust bindings for Sciter

Build status Build Status Minimum supported Rust version Current Version Documentation License Join the forums at https://sciter.com/forums

Check this page for other language bindings (Delphi / D / Go / .NET / Python / Rust).


Introduction

Sciter is an embeddable multiplatform HTML/CSS/script engine with GPU accelerated rendering designed to render modern desktop application UI. It's a compact, single dll/dylib/so file (4-8 mb) engine without any additional dependencies.

Screenshots

Check the screenshot gallery of desktop UI examples and DirectX UI integration via Rust GFX.

Description

Physically Sciter is a mono library which contains:

  • HTML and CSS rendering engine based on the H-SMILE core used in HTMLayout,
  • JavaScript alike Scripting engine – core of TIScript which by itself is based on c-smile engine,
  • Persistent Database (a.k.a. JSON DB) based on excellent DB products of Konstantin Knizhnik.
  • Graphics module that uses native graphics primitives provided by supported platforms: Direct2D on Windows 7 and above, GDI+ on Windows XP, CoreGraphics on MacOS, Cairo on Linux/GTK. Yet there is an option to use built-in Skia/OpenGL backend on each platform.
  • Network communication module, it relies on platform HTTP client primitives and/or Libcurl.

Internally it contains the following modules:

  • CSS – CSS parser and the collection of parsed CSS rules, etc.
  • HTML DOM – HTML parser and DOM tree implementation.
  • layout managers – collection of various layout managers – text layout, default block layout, flex layouts. Support of positioned floating elements is also here. This module does the layout calculations heavy lifting. This module is also responsible for the rendering of layouts.
  • input behaviors – a collection of built-in behaviors – code behind "active" DOM elements: <input>, <select>, <textarea>, etc.
  • script module – source-to-bytecode compiler and virtual machine (VM) with compacting garbage collector (GC). This module also contains runtime implementation of standard classes and objects: Array, Object, Function and others.
  • script DOM – runtime classes that expose DOM and DOM view (a.k.a. window) to the script.
  • graphics abstraction layer – abstract graphics implementation that isolates the modules mentioned above from the particular platform details:
    • Direct2D/DirectWrite graphics backend (Windows);
    • GDI+ graphics backend (Windows);
    • CoreGraphics backend (Mac OS X);
    • Cairo backend (GTK on all Linux platforms);
    • Skia/OpenGL backend (all platforms)
  • core primitives – set of common primitives: string, arrays, hash maps and so on.

Sciter supports all standard elements defined in HTML5 specification with some additions. CSS is extended to better support the Desktop UI development, e.g. flow and flex units, vertical and horizontal alignment, OS theming.

Sciter SDK comes with a demo "browser" with a builtin DOM inspector, script debugger and documentation viewer:

Sciter tools

Check https://sciter.com website and its documentation resources for engine principles, architecture and more.

Getting started:

  1. Download the Sciter SDK and extract it somewhere.
  2. Add the corresponding target platform binaries to PATH (bin.win, bin.osx or bin.lnx).
  3. If you do not already have it installed, you need GTK 3 development tools installed to continue: sudo apt-get install libgtk-3-dev
  4. Build the crate and run a minimal sciter sample: cargo run --example minimal.
  5. For your apps add the following dependency to the Cargo.toml: sciter-rs = "*".

Brief look:

Here is a minimal sciter app:

extern crate sciter;

fn main() {
    let mut frame = sciter::Window::new();
    frame.load_file("minimal.htm");
    frame.run_app();
}

It looks similar to this:

Minimal sciter sample

Interoperability

In respect of tiscript functions calling:

use sciter::{Element, Value};

let root = Element::from_window(hwnd);
let result: Value = root.call_function("namespace.name", &make_args!(1,"2",3));

Calling Rust from script can be implemented as following:

struct Handler;

impl Handler {
  fn calc_sum(&self, a: i32, b: i32) -> i32 {
    a + b
  }
}

impl sciter::EventHandler for Handler {
  dispatch_script_call! {
    fn calc_sum(i32, i32);
  }
}

And we can access this function from script:

// `view` represents window where script is running.
// `stdout` stream is a standard output stream (shell or debugger console, for example)

stdout.printf("2 + 3 = %d\n", view.calc_sum(2, 3));

Check rust-sciter/examples folder for more complex usage.

Library documentation.

What is supported right now:

Platforms:

  • Windows
  • OSX
  • Linux
  • Raspberry Pi

License

Bindings library licensed under MIT license. Sciter Engine has the own license terms and end used license agreement for SDK usage.

Comments
  • compile error on macosx

    compile error on macosx

    cargo run --example minimal just output error message:

    warning: unused manifest key: badges.appveyor.repository
    warning: unused manifest key: package.categories
    warning: unused manifest key: package.categories
    warning: unused manifest key: package.categories
    warning: unused manifest key: package.categories
       Compiling sciter-rs v0.4.16 (file:///Volumes/src/git/rust/rust-sciter)
    error: linking with `cc` failed: exit code: 1
      |
      = note: "cc" "-m64" "-L" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Volumes/src/git/rust/rust-sciter/target/debug/examples/minimal-049750bad57ec635.0.o" "-o" "/Volumes/src/git/rust/rust-sciter/target/debug/examples/minimal-049750bad57ec635" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Volumes/src/git/rust/rust-sciter/target/debug/deps" "-L" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Volumes/src/git/rust/rust-sciter/target/debug/deps/libsciter-e229de1bcb7d347a.rlib" "/Volumes/src/git/rust/rust-sciter/target/debug/deps/liblazy_static-4345d0db7d7e9b05.rlib" "/Volumes/src/git/rust/rust-sciter/target/debug/deps/libobjc_foundation-cd7bec3c0f31e91a.rlib" "/Volumes/src/git/rust/rust-sciter/target/debug/deps/libblock-81bb5816adb186e4.rlib" "/Volumes/src/git/rust/rust-sciter/target/debug/deps/libobjc_id-f01a1943dfb75bb9.rlib" "/Volumes/src/git/rust/rust-sciter/target/debug/deps/libobjc-2834ac60b01b7699.rlib" "/Volumes/src/git/rust/rust-sciter/target/debug/deps/libmalloc_buf-826d6968858cdff6.rlib" "/Volumes/src/git/rust/rust-sciter/target/debug/deps/liblibc-6451aa7d8103c93e.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-f1544d51c14ee547.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-0973ad751bdffbae.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-30637a1739b412eb.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librand-6ce8560490ee791c.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcollections-77c40ab2fac1172e.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-40208fb59386bff5.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-4b56f5c0b7251555.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-cba64299ce12485f.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_unicode-a98ebaa82aaee358.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-cfc94a4f91ad8df0.rlib" "/Users/tony/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-51cf9867f46a760f.rlib" "-l" "sciter-osx-64" "-framework" "Foundation" "-l" "System" "-l" "objc" "-l" "objc" "-l" "objc" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m"
      = note: ld: library not found for -lsciter-osx-64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    
    error: aborting due to previous error
    
    error: Could not compile `sciter-rs`.
    
    To learn more, run the command again with --verbose.
    
    bug help wanted os:osx 
    opened by outersky 18
  • [osx] Unable to start examples

    [osx] Unable to start examples

    When I tried to launch examples(multiple), I got the following error messages.

    $ cargo run --example threads
        Finished dev [unoptimized + debuginfo] target(s) in 0.3 secs
         Running `target/debug/examples/threads`
    window::create(rect (0, 0, 1200, 900), flags 96, parent 0x0
    window::create with flags 96
    view 0x7f9722432bb0
    view 0x7f9722432bb0 -> window 0x7f9722455140
    fatal runtime error: allocator memory exhausted
    [1]    981 illegal hardware instruction  cargo run --example threads
    

    I have no idea why. I just wanted to learn this library using rust. I'm using macOS High Sierra 10.13.4, rustc 1.26.0-nightly (e5277c145 2018-03-28) and fresh sciter-sdk.

    bug os:osx 
    opened by bgrzesik 14
  • How to inject code in all windows?

    How to inject code in all windows?

    I'm making an application where the user can create windows using their own html files, but it would require the windows to have a default behavior, so I developed a simple code that could be manually added by the user, but if there was a way to inject that code would make it a lot easier, I searched and found RuntimeOptions::InitScript, I tried calling a native function and nothing happened.

    sciter-engine 
    opened by WesleiRamos 9
  • I can't connect to the inspector anymore

    I can't connect to the inspector anymore

    I recently updated my sciter-sdk and I am unable to connect to the inspector. My code is unchanged. I was previously able to connect to the inspector and now I am not able to. Unfortunately, I didn't take note of what version of the SDK I had previously, but it was a few months old I think. EDIT: I should add that I am using Sciter version 4.2.7.5 on Linux-5.0.5-200.fc29.x86_64

    opened by DevJac 9
  • I have new err on compile error.

    I have new err on compile error.

    $ cargo run --example minimal Finished dev [unoptimized + debuginfo] target(s) in 0.03s Running target/debug/examples/minimal thread 'main' panicked at 'called Result::unwrap() on an Err value: ()', examples/minimal.rs:18:12 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

    opened by iakuf 8
  • Can't call JavaScript

    Can't call JavaScript

    JavaScript cannot be called when using the Sciter.JS library. Nothing happens, except it returns Ok(undefined).

    fn document_complete(&mut self, root: HELEMENT, _target: HELEMENT) {
      let value = &Element::from(root).call_function("foo", &make_args!("bar"));
      println!("{:?}", value); // Ok(undefined)
    }
    
    question sciter-engine 
    opened by GirkovArpa 8
  • update winit requirement from 0.19 to 0.24

    update winit requirement from 0.19 to 0.24

    Updates the requirements on winit to permit the latest version.

    Release notes

    Sourced from winit's releases.

    v0.24.0

    • On Windows, fix applications not exiting gracefully due to thread_event_target_callback accessing corrupted memory.
    • On Windows, implement Window::set_ime_position.
    • Breaking: On Windows, Renamed WindowBuilderExtWindows's is_dark_mode to theme.
    • On Windows, add WindowBuilderExtWindows::with_theme to set a preferred theme.
    • On Windows, fix bug causing message boxes to appear delayed.
    • On Android, calling WindowEvent::Focused now works properly instead of always returning false.
    • On Windows, fix alt-tab behaviour by removing borderless fullscreen "always on top" flag.
    • On Windows, fix bug preventing windows with transparency enabled from having fully-opaque regions.
    • Breaking: On Windows, include prefix byte in scancodes.
    • On Wayland, fix window not being resizeable when using with_min_inner_size in WindowBuilder.
    • On Unix, fix cross-compiling to wasm32 without enabling X11 or Wayland.
    • On Windows, fix use after free crash during window destruction.
    • On Web, fix WindowEvent::ReceivedCharacter never being sent on key input.
    • On macOS, fix compilation when targeting aarch64
    • On X11, fix Window::request_redraw not waking the event loop.
    • On Wayland, the keypad arrow keys are now recognized.
    • Breaking Rename desktop::EventLoopExtDesktop to run_return::EventLoopExtRunReturn.
    • Added request_user_attention method to Window.
    • Breaking: On macOS, removed WindowExt::request_user_attention, use Window::request_user_attention.
    • Breaking: On X11, removed WindowExt::set_urgent, use Window::request_user_attention.
    • On Wayland, default font size in CSD increased from 11 to 17.
    • On Windows, fix bug causing message boxes to appear delayed.
    • On Android, support multi-touch.
    • On Wayland, extra mouse buttons are not dropped anymore.
    • Breaking: MouseButton::Other now uses u16.
    Changelog

    Sourced from winit's changelog.

    0.24.0 (2020-12-09)

    • On Windows, fix applications not exiting gracefully due to thread_event_target_callback accessing corrupted memory.
    • On Windows, implement Window::set_ime_position.
    • Breaking: On Windows, Renamed WindowBuilderExtWindows's is_dark_mode to theme.
    • Breaking: On Windows, renamed WindowBuilderExtWindows::is_dark_mode to theme.
    • On Windows, add WindowBuilderExtWindows::with_theme to set a preferred theme.
    • On Windows, fix bug causing message boxes to appear delayed.
    • On Android, calling WindowEvent::Focused now works properly instead of always returning false.
    • On Windows, fix Alt-Tab behaviour by removing borderless fullscreen "always on top" flag.
    • On Windows, fix bug preventing windows with transparency enabled from having fully-opaque regions.
    • Breaking: On Windows, include prefix byte in scancodes.
    • On Wayland, fix window not being resizeable when using WindowBuilder::with_min_inner_size.
    • On Unix, fix cross-compiling to wasm32 without enabling X11 or Wayland.
    • On Windows, fix use-after-free crash during window destruction.
    • On Web, fix WindowEvent::ReceivedCharacter never being sent on key input.
    • On macOS, fix compilation when targeting aarch64.
    • On X11, fix Window::request_redraw not waking the event loop.
    • On Wayland, the keypad arrow keys are now recognized.
    • Breaking Rename desktop::EventLoopExtDesktop to run_return::EventLoopExtRunReturn.
    • Added request_user_attention method to Window.
    • Breaking: On macOS, removed WindowExt::request_user_attention, use Window::request_user_attention.
    • Breaking: On X11, removed WindowExt::set_urgent, use Window::request_user_attention.
    • On Wayland, default font size in CSD increased from 11 to 17.
    • On Windows, fix bug causing message boxes to appear delayed.
    • On Android, support multi-touch.
    • On Wayland, extra mouse buttons are not dropped anymore.
    • Breaking: MouseButton::Other now uses u16.

    0.23.0 (2020-10-02)

    • On iOS, fixed support for the "Debug View Heirarchy" feature in Xcode.
    • On all platforms, available_monitors and primary_monitor are now on EventLoopWindowTarget rather than EventLoop to list monitors event in the event loop.
    • On Unix, X11 and Wayland are now optional features (enabled by default)
    • On X11, fix deadlock when calling set_fullscreen_inner.
    • On Web, prevent the webpage from scrolling when the user is focused on a winit canvas
    • On Web, calling window.set_cursor_icon no longer breaks HiDPI scaling
    • On Windows, drag and drop is now optional and must be enabled with WindowBuilderExtWindows::with_drag_and_drop(true).
    • On Wayland, fix deadlock when calling to set_inner_size from a callback.
    • On macOS, add hide__other_applications to EventLoopWindowTarget via existing EventLoopWindowTargetExtMacOS trait. hide_other_applications will hide other applications by calling -[NSApplication hideOtherApplications: nil].
    • On android added support for run_return.
    • On MacOS, Fixed fullscreen and dialog support for run_return.
    • On Windows, fix bug where we'd try to emit MainEventsCleared events during nested win32 event loops.
    • On Web, use mouse events if pointer events aren't supported. This affects Safari.
    • On Windows, set_ime_position is now a no-op instead of a runtime crash.
    • On Android, set_fullscreen is now a no-op instead of a runtime crash.
    • On iOS and Android, set_inner_size is now a no-op instead of a runtime crash.
    • On Android, fix ControlFlow::Poll not polling the Android event queue.
    • On macOS, add NSWindow.hasShadow support.
    • On Web, fix vertical mouse wheel scrolling being inverted.
    Commits
    • 6db308f Release 0.24.0
    • 6f70fd9 Windows: Changed thread_event_target_callback's WM_DESTROY to WM_NCDESTROY (#...
    • db038d9 On Windows, implement 'Window::set_ime_position' with IMM API
    • c5620ef On Wayland, don't drop extra mouse buttons
    • 8fb7aa5 Android: Improved multi-touch (#1783)
    • 6ddee9a Ability to force a theme on Windows (#1666)
    • 5700359 Android: support multi-touch (#1776)
    • 0861a35 Add 'request_user_attention' to Window
    • f79efec Fix deprecation warning in the window icon example
    • 77d5d20 Windows: Delayed Message Boxes Fix. (#1769)
    • Additional commits viewable in compare view

    opened by SonnyX 7
  • Can't set `UxTheming(true)`

    Can't set `UxTheming(true)`

    This line in my code panics: sciter::set_options(sciter::RuntimeOptions::UxTheming(true)).unwrap(); It panics with the following message: thread 'main' panicked at 'calledResult::unwrap()on anErrvalue: ()', src/libcore/result.rs:999:5

    I see the following code is related to this error:

    /// Set various sciter engine global options, see the [`RuntimeOptions`](enum.RuntimeOptions.html).
    pub fn set_options(options: RuntimeOptions) -> std::result::Result<(), ()> {
    	use RuntimeOptions::*;
    	use capi::scdef::SCITER_RT_OPTIONS::*;
    	let (option, value) = match options {
    		ConnectionTimeout(ms) => (SCITER_CONNECTION_TIMEOUT, ms as usize),
    		OnHttpsError(behavior) => (SCITER_HTTPS_ERROR, behavior as usize),
    		// GpuBlacklist(json) => (SCITER_SET_GPU_BLACKLIST, json.as_bytes().as_ptr() as usize),
    		InitScript(script) => (SCITER_SET_INIT_SCRIPT, script.as_bytes().as_ptr() as usize),
    		ScriptFeatures(mask) => (SCITER_SET_SCRIPT_RUNTIME_FEATURES, mask as usize),
    		GfxLayer(backend) => (SCITER_SET_GFX_LAYER, backend as usize),
    		DebugMode(enable) => (SCITER_SET_DEBUG_MODE, enable as usize),
    		UxTheming(enable) => (SCITER_SET_UX_THEMING, enable as usize),
        LibraryPath(path) => {
          return set_library(path).map_err(|_|());
        }
    	};
    	let ok = (_API.SciterSetOption)(std::ptr::null_mut(), option, value);
    	if ok != 0 {
    		Ok(())
    	} else {
    		Err(())
    	}
    }
    

    The value of ok ends up being 0, and so the Err(()) is returned. I'm not sure where to look for documentation on the Sciter C++ API, but the set option call is returning 0, what does that mean?

    The error occurs on Linux (GTK / Wayland), but not on Windows.

    bug os:linux 
    opened by DevJac 7
  • "first" example crashes (reads from null pointer after last line of main())

    I downloaded the Sciter SDK, copied the sciter.dll for win64 and generated the sciter.lib file from it. I cloned rust-sciter and ran the examples, all worked except first which crashed:

          Running `target\debug\examples\first.exe`
    calling SciterAPI x64
    getting abi version
    sciter abi version: 0
    sciter class name: H-SMILE-CHILD
    sciter version: 4.1.1.5703 [4, 1, 1, 5703]
    error: process didn't exit successfully: `target\debug\examples\first.exe` (exit code: 3221225477)
    

    Unhandled exception at 0x00007FFB36A93499 (sciter.dll) in first.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

    So it's reading from a null pointer for some reason, after the last line of main, weird.. Any idea how to fix this? (I'm on Win8.1 btw)

    bug os:win 
    opened by Boscop 7
  • Not support include relative_path in tiscript On Windows

    Not support include relative_path in tiscript On Windows

    some.html
       <script  type="text/tiscript" >
     include "some.tis"
     </script >
    

    It come with this

    WARNING:DOM: failed to load "//chgetitle.tis" file, error=161
    ERROR:TIS: Error: File not found - file://chgetitle.tis
    ERROR:TIS:      at undefined
    

    my file tree

    ├─src
    │  ├─bin
    │  └─ui
    │      └─some.html
           |__some.tis
       |__main.rs (run app)
    

    IS there some problem? Yet,using absolute path (like D:/A/B/some.tis) will work.

    Thus,after packing it (exe),openning it somewhere else and losing original path will cause layout err,seem like no tis applied.

    question 
    opened by dobefore 5
  • Segmentation Fault

    Segmentation Fault

    https://github.com/GirkovArpa/sciter-js-rust-boilerplate/blob/57e93470707b7d5688f8f6f9a134d43f1e35e122/build/assets/js/main.js#L13

    document.set_title = function set_title(text) {
      $('h1').textContent = Window.this.xcall('capitalize', text);
    }
    

    Removing document.set_title = from the above snippet causes a segmentation fault when this code is triggered:

    $('#sum_async').on('click', () => {
      const textboxes = $$('.sum_async');
      const numbers = textboxes.map((textbox) => textbox.value);
      const [a, b] = numbers;
      Window.this.xcall('sum_async', a, b, function (sum) {
        Window.this.modal(<info>{sum}</info>);
        // segmentation fault 
      });
    });
    
    bug sciter-engine 
    opened by GirkovArpa 5
  • Sciter 5 support

    Sciter 5 support

    Does rust-sciter support sciter 5? It doesn't seem like it Issue here https://sciter.com/forums/topic/linux-no-libsciter-gtk-so-and-shader-compilation-error/

    When using rust-sciter it's still looking for the old libsciter

    thread 'main' panicked at 'error: 'libsciter-gtk.so' was not found neither in PATH nor near the current executable.
      Please verify that Sciter SDK is installed and its binaries (from bin.lnx) are available in PATH.', /home/mintdev/.cargo/registry/src/github.com-1ecc6299db9ec823/sciter-rs-0.5.58/src/lib.rs:359:21
    

    Linux Mint VM in VirtualBox 6.1, running on Windows 10 21h1 19044.1889 Linux Mint 21 Cinnamon 5.4.11 5.15.0-46-generic AMD Ryzen 9 5900HX with Radeon Graphics × 6 VMware SVGA II Adapter (prog-if 00 [VGA controller])

    My cargo.lock

    name = "sciter-rs"
    version = "0.5.58"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "5cdb1443364559d670a1b190bea5cdd1064cd9347e7e18150f18737bbc3c2234"
    dependencies = [
     "lazy_static",
     "libc",
     "objc",
     "objc-foundation",
    ]
    

    rust

    mintdev@mintdev-VirtualBox:~/Documents/transmitic_workspace$ cargo --version
    cargo 1.64.0 (387270bc7 2022-09-16)
    mintdev@mintdev-VirtualBox:~/Documents/transmitic_workspace$ rustup --version
    rustup 1.25.1 (bb60b1e89 2022-07-12)
    info: This is the version for the rustup toolchain manager, not the rustc compiler.
    info: The currently active <code>rustc</code> version is <code>rustc 1.64.0 (a55dd71d5 2022-09-19)</code>
    
    opened by Andrew-Shay 0
  • WebView does not work

    WebView does not work

    When I run the program, WebView does not display the web page. The examples of this repositories can run successfully in my computer and I also use the sciter-webview.dll file. Did I do anything wrong?These are my codes.

    webview.html

    <html>
    
    <head>
        <title></title>
        <style>
            html,
            body {
                padding: 0;
                margin: 0;
            }
    
            webview {
                display: block;
                size: 1000;
                background: red;
                behavior: webview library(sciter-webview);
            }
        </style>
    
    </head>
    
    <body>
    
        <webview src="https://www.sciter.com"></webview>
    </body>
    
    </html>
    

    main.rs

    use sciter;
    
    fn main() {
        let mut frame = sciter::Window::new();
        frame.load_file("webview.html");
        frame.run_app();
    }
    
    <- rust                                                             scapp.exe->
    

    image

    opened by SULAPIS 6
  • why call set_options blocked the application

    why call set_options blocked the application

    i have a demo both tokio_native_tls and async_native_tls will be blocked after set_options.

    pub async fn test_tls_client()  {
        let addr = "14.215.177.39:443";
        let host = "www.baidu.com";
    
        let socket = TcpStream::connect(addr.clone()).await?;
        let cx = TlsConnector::builder().build()?;
        let cx = tokio_native_tls::TlsConnector::from(cx);
    
        let mut socket = cx.connect(host.clone(), socket).await?; // *** blocked there 
    
        socket.write_all(format!("\
                 GET / HTTP/1.0\r\n\
                 Host: {}\r\n\
                 \r\n\
                 ",host.clone())
                    .as_bytes(),
            ).await?;
    
        let mut data = Vec::new();
        socket.read_to_end(&mut data).await?;
        println!("recv tls {}", String::from_utf8_lossy(&data[..]));
    }
    
    fn main() {
       std::thread::spawn(move || test_tls_client());
        use sciter::SCRIPT_RUNTIME_FEATURES::*;
        sciter::set_options(sciter::RuntimeOptions::ScriptFeatures(
           ALLOW_FILE_IO as u8
        ));
        let mut frame = sciter::WindowBuilder::main_window().create();
        frame.load_file("./src/minimal.htm");
        frame.run_app();
    }
    

    if i inited options by set_options function, then request tls will be block this demo.

    what's the default options? why is blocked demo in https client?

    opened by mycoco2014 0
  • Window as arguments cause error

    Window as arguments cause error

    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 ?

    question 
    opened by Donald2010 1
  • How to use `set_variable`?

    How to use `set_variable`?

    I tried doing this:

        window
            .set_variable("hello", Value::from("world"))
            .expect("Could not set variable.");
    

    But I don't know how to retrieve the set variable. Window.this.hello and globalThis.hello both return undefined. Even get_variable returns undefined.

    question 
    opened by thecodrr 8
Releases(0.5.56)
Owner
Terra Informatica Software, Inc
Sciter SDK bindings
Terra Informatica Software, Inc
Rust bindings for the FLTK GUI library.

fltk-rs Rust bindings for the FLTK Graphical User Interface library. The FLTK crate is a crossplatform lightweight gui library which can be statically

Mohammed Alyousef 1.1k Jan 9, 2023
Rust bindings for Dear ImGui

imgui-rs: Rust bindings for Dear ImGui (Recently under new maintenance, things subject to change) Window::new(im_str!("Hello world")) .size([300.0

null 2k Jan 7, 2023
Rust bindings to the minimalist, native, cross-platform UI toolkit `libui`

Improved User Interface A cross-platform UI toolkit for Rust based on libui iui: ui-sys: iui is a simple (about 4 kLOC of Rust), small (about 800kb, i

Rust Native UI Group 865 Dec 27, 2022
QML (Qt Quick) bindings for Rust language

QML-rust - bindings for Qt Quick Bindings are based on DOtherSide C bindings for QML Library is mostly feature-compliant with other bindings based on

Oak 204 Dec 8, 2022
Provides Rust bindings for GTK libraries

The gtk-rs organization aims to provide safe Rust binding over GObject-based libraries

null 431 Dec 30, 2022
Provides Rust bindings for Gnome libraries

gtk-rs-core The gtk-rs organization aims to provide safe Rust binding over GObject-based libraries. You can find more about it on https://gtk-rs.org.

null 174 Dec 26, 2022
Drew's fast Rust AppKit bindings

Drew's fast Rust AppKit bindings Provides select Rust bindings for Apple AppKit framework. This may be compared to, appkit crate cacao objrs_framework

Drew Crawford 2 Oct 28, 2022
Rust bindings for Dear ImGui

imgui-rs: Rust bindings for Dear ImGui (Recently under new maintenance, things subject to change) ui.window("Hello world") .size([300.0, 100.0], C

null 2k Jan 7, 2023
Rust bindings and wrappers for GLib, GDK 3, GTK+ 3 and Cairo.

THIS REPOSITORY IS DEPRECATED SEE: https://github.com/rust-gnome rgtk Rust bindings and wrappers for GLib, GDK 3, GTK+ 3 and Cairo. Building rgtk expe

Jeremy Letang 124 Jul 10, 2022
Provides Rust bindings for GTK libraries

gtk3-rs The gtk-rs organization aims to provide safe Rust binding over GObject-based libraries. You can find more about it on https://gtk-rs.org. This

null 431 Dec 30, 2022
Rust bindings for the FLTK GUI library.

fltk-rs Rust bindings for the FLTK Graphical User Interface library. The fltk crate is a cross-platform lightweight gui library which can be staticall

fltk-rs 1.1k Jan 9, 2023
The bindings to the Nuklear 2D immediate GUI library.

nuklear-rust The bindings to the Nuklear 2D immediate GUI library. Currently beta. Drawing backends: gfx-pre-ll for GFX 3D drawing engine (examples: O

Serhii Plyhun 332 Dec 27, 2022
Egui bindings for macroquad

egui bindings for macroquad This is the easiest way to use egui. Just two functions! Web demo. Usage You need to call ui when you need to get informat

ilya sheprut 54 Dec 28, 2022
Egui bindings for miniquad

egui bindings for miniquad native On Linux you first must run apt install libx11-dev libxi-dev libgl1-mesa-dev (miniquad dependencies). cargo run --re

Fedor Logachev 48 Dec 28, 2022
Unsafe bindings and a safe wrapper for gtk4-layer-shell, automatically generated from a .gir file

gtk4-layer-shell: gtk4-layer-shell-sys: gtk4-layer-shell This is the safe wrapper for gtk4-layer-shell, automatically generated from its .gir file. Fo

null 3 Apr 30, 2023
A simple, cross-platform GUI automation module for Rust.

AutoPilot AutoPilot is a Rust port of the Python C extension AutoPy, a simple, cross-platform GUI automation library for Python. For more information,

null 271 Dec 27, 2022
A data-first Rust-native UI design toolkit.

Druid A data-first Rust-native UI toolkit. Druid is an experimental Rust-native UI toolkit. Its main goal is to offer a polished user experience. Ther

null 8.2k Dec 31, 2022
The Rust UI-Toolkit.

The Orbital Widget Toolkit is a cross-platform (G)UI toolkit for building scalable user interfaces with the programming language Rust. It's based on t

Redox OS 3.7k Jan 1, 2023
An easy-to-use, 2D GUI library written entirely in Rust.

Conrod An easy-to-use, 2D GUI library written entirely in Rust. Guide What is Conrod? A Brief Summary Screenshots and Videos Feature Overview Availabl

PistonDevelopers 3.3k Jan 1, 2023