Problem packing labels into Gtk::Table



This is based on the online Gtk::Table demo, and the only difference is
that I am trying to pack labels instead of buttons:

#ifndef GTKMM_EXAMPLEWINDOW_H
#define GTKMM_EXAMPLEWINDOW_H

#include <gtkmm.h>

class ExampleWindow : public Gtk::Window {
public:
  ExampleWindow();
  virtual ~ExampleWindow();
protected:
  //Child widgets:
  Gtk::Table m_Table;
  Gtk::Label m_Label1, m_Label2, m_Label3, m_Label4;
};

#endif //GTKMM_EXAMPLEWINDOW_H


ExampleWindow::ExampleWindow()
: m_Table(2, 2, true),
  m_Label1("label 1"),
  m_Label2("label 2"),
  m_Label3("label 3"),
  m_Label4("label 4")
{
  set_title("Gtk::Table");
  set_border_width(20);

  m_Label1.show();
  m_Table.attach(m_Label1, 0, 1, 0, 1);

  m_Label2.show();
  m_Table.attach(m_Label2, 0, 1, 1, 2);

  m_Label3.show();
  m_Table.attach(m_Label3, 1, 2, 0, 1);

  m_Label4.show();
  m_Table.attach(m_Label4, 1, 2, 1, 2);

  add(m_Table);

  m_Table.show();
}

The problem I get is that this code gives me "Illegal instruction" at
runtime.  Anybody knows why?

(I am using gtkmm-2.4.11 on Gentoo).


Thanks,

Nickolai



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