Re: Gtk::Table with a Gtk::TextView



2005/8/11, Daniel Albuschat <d albuschat gmail com>:

> So here's the complete, working example:

Man... it's one of these days, you know.
I goofed even on the "fixed" example.
But at least now I get the same result for the test
case and the actual application.

> #include <gtkmm.h>
>
> struct Win: public Gtk::Window {
>   public:
>     Gtk::Table t;
>     Gtk::ScrolledWindow sw;
>     Gtk::TextView v;
>     Glib::RefPtr<Gtk::TextBuffer> tb;
>     Win(): t(2,2) {
>       add(sw);

Nah, this is not what I intended to do. It should read
  add(t);

>       sw.add(v);
>       sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
>       t.attach(sw,0,2,0,2, Gtk::EXPAND, Gtk::EXPAND);
>       tb = Gtk::TextBuffer::create();
>       tb->set_text("Foo");
>       v.set_buffer(tb);
>       show_all();
>     }
> };
>
> int main( int argc, char *argv[] ) {
>   Gtk::Main m(argc, argv);
>   Win win;
>   Gtk::Main::run(win);
> }

The results are still rather strange. I got a working TextView inside
the ScrolledWindow and therefore with scrollbars. But it is at some magical
fixed size that won't change.
If you're interested, I've put a screenshot online here:
http://viming.de/foo_gtkmm.png

Please, someone enlighten me...
I haven't worked on my pet project for days because of it. ;(

Cya,
   Daniel



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