GTK--: how do I add a Gtk_VScrollbar to a Gtk_Text ?



Hi,

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 ?

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_HBox iniHBox;
  Gtk_Text iniText;
  Gtk_VScrollbar *iniScrollbar;
  Gtk_Adjustment *iniAdjustment;
...
public:
  Modeling() : 
...
  {
...
    iniHBox.show();
    iniHBox.pack_start( &iniText, false);
    iniText.set_usize(400,300);
    iniText.set_editable( true );
    iniText.show();
    iniAdjustment = new Gtk_Adjustment(iniText.gtkobj()->vadj); 
    iniScrollbar = new Gtk_VScrollbar( iniAdjustment ) ;
    iniHBox.pack_start( iniScrollbar, false);
    iniScrollbar->show();
...
   }

  ~Modeling(){
    delete iniScrollbar;
    delete iniAdjustment;
  }


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



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