William,

I was initially hesitant to post the code because it uses the C++
bindings, which may not be appropriate for this list, but here goes
(it's really simple):

#ifndef GTKMM_EXAMPLEWINDOW_H
#define GTKMM_EXAMPLEWINDOW_H

#include <gtkmm.h>

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

#endif //GTKMM_EXAMPLEWINDOW_H

#include <iostream>
#include "examplewindow.hh"

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();
}

ExampleWindow::~ExampleWindow()
{
}

I modified it slightly as per
http://mail.gnome.org/archives/gtk-app-devel-list/1999-August/msg00238.html

How would you write this in "pure" GTK?  Once I have it in GTK, I will
probably be able to port it to C++.


Regards,

Nickolai



On 7/16/05, William Park <[EMAIL PROTECTED]> wrote:
> On Sat, Jul 16, 2005 at 03:14:12PM -0500, Nickolai Dobrynin wrote:
> > Hi,
> >
> > Does anybody have a working example of packing multiple labels into
> > GtkTable?  I know how to do this with buttons, but when I do it the
> > same way with labels, I get a seg fault or "illegal instruction".
> 
> Should be the same.  Can you post the code sample that works with
> buttons, then?
> 
> --
> William Park <[EMAIL PROTECTED]>, Toronto, Canada
> ThinFlash: Linux thin-client on USB key (flash) drive
>            http://home.eol.ca/~parkw/thinflash.html
> BashDiff: Super Bash shell
>           http://freshmeat.net/projects/bashdiff/
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to