Unable to see all widgets in a scrolled window.



Dear all,

I've write a small sample applications to learn how to use a scrolled window with a layout widget (Attached to this e-mail).

I've added a vertical box with 7 buttons to the layout. I'm not able to see in the scrolled window all buttons, only half of them.

Could you tell me what I'm doing wrong?

Thanks and Best Regards,
Joaquim Duran
#include <gtkmm/window.h>
#include <gtkmm/button.h>
#include <gtkmm/box.h>
#include <gtkmm/layout.h>
#include <gtkmm/main.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/scrolledwindow.h>

class MainWindow: public Gtk::Window
{
public:
  MainWindow();
  virtual ~MainWindow();

protected:
  void onUpPressed();
  void onDownPressed();

private:
  Gtk::VBox vbox;
  Gtk::HBox hbBttn;
  Gtk::Button up;
  Gtk::Button down;
  Gtk::Adjustment hadj, vadj;
  Gtk::ScrolledWindow win;
  Gtk::Layout layout;

  //Contents of scrolled window
  Gtk::VBox content;
  Gtk::Button b1;
  Gtk::Button b2;
  Gtk::Button b3;
  Gtk::Button b4;
  Gtk::Button b5;
  Gtk::Button b6;
  Gtk::Button b7;
};


MainWindow::MainWindow():
  Gtk::Window(), vbox(), hbBttn(), up("Up"), down("Down"),
  hadj(0, 0, 100),
  vadj(0, 0, 100),
  win(), layout(hadj, vadj),
  content(),
  b1("Bttn 1"), b2("Bttn 2"), b3("Bttn 3"), b4("Bttn 4"),
  b5("Bttn 5"), b6("Bttn 6"), b7("Bttn 7")
{
  add(vbox);
  vbox.pack_start(hbBttn, false, false, 0);
  hbBttn.pack_start(down);
  hbBttn.pack_start(up);

  vbox.pack_start(win);
  win.add(layout);
  layout.add(content);
  content.add(b1);
  content.add(b2);
  content.add(b3);
  content.add(b4);
  content.add(b5);
  content.add(b6);
  content.add(b7);

  resize(200, 200);

  show_all_children();
}


MainWindow::~MainWindow()
{
}


int main(int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);

  MainWindow mainWin;
  Gtk::Main::run(mainWin);

  return 0;
}


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