how to shrink a window



I have a very simply problem: I want to shrink a window but I can't get it run. 
The call to set_size_request seems to resize the window ONLY if it should be bigger as before. The simple 
question is: How can I shrink a window? 

Minimized Example Code:

#include <iostream>
#include <gtkmm.h>
#include <goocanvasmm.h>

Goocanvas::Canvas* canvas;
Gtk::ScrolledWindow* sw;
Gtk::Window* winptr;

bool Do( const Glib::RefPtr<Goocanvas::Item>& item, GdkEventButton* ev)
{
    std::cout << "Do" << std::endl;
    //sw->set_size_request( 400,400); // make the window bigger works
    sw->set_size_request( 100,100); // shrink the window fails! why? Whats to do?

    return true;
}

int main(int argc, char *argv[])
{
    Gtk::Main kit(argc, argv);
    Goocanvas::init("Simu", "0.1", argc, argv);

    canvas=new Goocanvas::Canvas;

    canvas->set_size_request(300, 300);
    canvas->set_bounds(0, 0, 300, 300);



    Glib::RefPtr<Goocanvas::Item> root = canvas->get_root_item();

    Glib::RefPtr<Goocanvas::Ellipse> outer = Goocanvas::Ellipse::create( 100,100,20,20);
    outer->property_line_width() = 5;
    outer->property_stroke_color() = "red";
    outer->property_fill_color()="blue";
    root->add_child( outer );

    sigc::connection conn2= outer->signal_button_press_event().connect( sigc::ptr_fun(&Do));

    sw = Gtk::manage(new Gtk::ScrolledWindow());
    sw->add(*canvas);

    Gtk::VBox hbox;
    hbox.add(*sw);

    Gtk::Window win;
    winptr=&win;
    win.add(hbox);
    win.show_all_children();

    sw->set_size_request( 200,200);

    Gtk::Main::run(win);
    delete canvas;
}

Regards 
 Klaus


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]