Re: [gtk-list] GTK--: how do I add a Gtk_VScrollbar to a Gtk_Text ?



Ionut Borcoman at home <borco@mailbox.ro> writes:
> This is quite embaressment: I have had to write four or five times more
> code to be able to add a VScrollbar to a Text widget in GTK-- than in
> GTK+. Can somebody please show me the right way to do this ?

Some things are shorter to do in gtk+. :)

> Here is my code (maybe I win some prize for bad coding with it, but the
> GTK-- docs didn't help me at all, so it is not entirely my fault ... ):

class Modeling : public Gtk_Window {
   Gtk_Adjustment adj;
   Gtk_HBox ihbox;
   Gtk_Text itext;
   Gtk_VScrollbar iscrollbar;
Modeling(): adj(0,0,100), itext(0,&adj), iscrollbar(&adj) {
  add(&ihbox);
  ihbox.pack_start(&itext,false);
  itext.set_usize(400,300);
  itext.set_editable(true);
  ihbox.pack_start(&iscrollbar,false);
  ihbox.show_all();
}
};

or something like that... :)

> Cannot be added an scrollbar to the Gtk_Text or, at least, a data member
> to keep the adjustments ?

hmm, maybe scrolledwindow would work for it better?

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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