Scrollable Widgets



Hey,
    I cant figure out how scrollable widgets and Scrollbars should be put together in order to work. Here's a dummy app that should show what I mean:
#include <gtkmm.h>
#include <iostream>
int main( int argc, char* argv[] ){
    Gtk::Main kit( argc, argv );
     
    Gtk::Window wnd;
    Gtk::Table main_table;
    Gtk::TextView text;
    Gtk::HScrollbar h_scroll;
    Gtk::VScrollbar v_scroll;
   
    wnd.add( main_table );
   
    main_table.attach( text, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL );
    main_table.attach( v_scroll, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK | Gtk::FILL );
    main_table.attach( h_scroll, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK );
   
    text.set_scroll_adjustments( *h_scroll.get_adjustment(), *v_scroll.get_adjustment() );
    wnd.show_all_children();
    Gtk::Main::run( wnd );
    return 0;
}

When you write in the TextView the whole application grows, it doesnt get hide by the ScrollBars. Please, don't tell me to use Scrolled windows cause what I want to do is different, I just want to know how to work with the Scrollbars and scrollable widgets.


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