Adjust resize to fake window to point

I create a GTK window, which for various reasons I want to make without modification by the user. But calling the set_resizable method on the window causes it to display at a size of 1 pixel by 1 pixel. (jn in the code below, the window displays the expected size if the line with the variable parameter is commented out). It doesn't matter which order is invoked by resizing and set-resizable.) Is there anything else that needs to be done?

Here is the code ...

#include <iostream>
#include "myarea.hpp"
#include <gtkmm/main.h>
#include <gtkmm/window.h>

int main(int argc, char** argv)
{
    Gtk::Main kit(argc, argv);
    Gtk::Window win;
    win.set_title("DrawingArea");
    win.resize (600, 600);
    //win.set_resizable (false);

    MyArea area;
    win.add(area);
    area.show();

    Gtk::Main::run(win);

    return 0;
}
+3
source share
2 answers

win.set_size_request(600, 600); resize. 100%, , , set_resizable(false) resize, , .

+10

Gtk::Window::set_default_size()

+1

Source: https://habr.com/ru/post/1761888/


All Articles