fltk-rs / fltk-webview

webview functionality for embedded fltk windows
MIT License
47 stars 7 forks source link

resize window , the webview gets bigger #14

Closed dongjian closed 2 years ago

dongjian commented 2 years ago

Hi!

when I try laouts other window works fine , but the webview gets bigger and resizeble. like below

image image resize webview window image here is my code

fn main() {
    let a = app::App::default().with_scheme(app::Scheme::Gtk);
    let mut win = window::Window::default().with_size(640, 480);

    let mut col = Flex::new(0, 0, 400, 300, None);
    col.set_color(Color::Blue);
    col.set_type(group::FlexType::Column);
    //main_panel(&mut col);

    let mut test_win = window::Window::default();
    test_win.set_color(Color::Red);
    test_win.end();

    let mut wv_win = window::Window::default();
    wv_win.make_resizable(true);
    wv_win.set_border(false);
    wv_win.end();
    //col.set_size(&test_win2, 100);
    col.end();
    win.resizable(&col);
    win.set_color(enums::Color::from_rgb(250, 250, 250));

    win.end();
    win.show();
    win.size_range(600, 400, 0, 0);
    let mut wv = fltk_webview::Webview::create(false, &mut wv_win);
    wv.navigate("https://google.com");
    a.run().unwrap();
}

any help ?

MoAlyousef commented 2 years ago

It's not clear what you want to achieve. Also what's your operating system?

dongjian commented 2 years ago

It's not clear what you want to achieve. Also what's your operating system? image I have a player like this . when I resize the window , the web view become bigger like this

image I am using win10 . Mac did not test yet .

MoAlyousef commented 2 years ago

And you don't want it to be resized when the main window is resized?

dongjian commented 2 years ago

I don't want webview become big. Is there any way to make webview hight same as vlcview when resize the window. I try flex but it not working.

MoAlyousef commented 2 years ago

You can put the webview window inside a group and make the group non-resizable, you'll have to give the window a size.

fn main() {
    let a = app::App::default().with_scheme(app::Scheme::Gtk);
    let mut win = window::Window::default().with_size(640, 480);

    let mut col = group::Flex::new(0, 0, 400, 300, None);
    col.set_color(Color::Blue);
    col.set_type(group::FlexType::Column);
    //main_panel(&mut col);

    let mut test_win = window::Window::default();
    test_win.set_color(Color::Red);
    test_win.end();
    let mut grp = group::Group::default();
    let mut wv_win = window::Window::default().with_size(400, 200);
    wv_win.end();
    grp.end();
    grp.make_resizable(false);
    col.end();
    win.resizable(&col);
    win.set_color(Color::from_rgb(250, 250, 250));

    win.end();
    win.show();
    win.size_range(600, 400, 0, 0);
    let mut wv = fltk_webview::Webview::create(false, &mut wv_win);
    wv.navigate("https://google.com");
    a.run().unwrap();
}
dongjian commented 2 years ago

Thanks! it worked! but It would be nicer if webview behaved like the other window