Table



Hello,

I've got the following problem with gtk::table. Inside a frame (which is inside a vbox) I use a table. The Table contains labels and entrys. The Labels are displayd centered. How can I change the alignment to right?

Best Regards,

Wätzold


CODE==========

#include "minima.h"
#include <iostream>

ExampleWindow::ExampleWindow()
: Button_initlist_Close(),
  VBox_initlist_1(true, 5),
  Frame_initlist_1("Test"),
  Label_initlist_1("Number of occupied states (N_states):\t", Gtk::ALIGN_LEFT),
  Label_initlist_2("Numbers of variatet states (N_vek):\t", Gtk::ALIGN_LEFT),
  Label_initlist_3("Index of k-selection (k_index):\t", Gtk::ALIGN_LEFT),
  Label_initlist_4("Mass (mass):\t", Gtk::ALIGN_LEFT),
  Table_initlist_1(2,4,false)
{

  set_title("Gtk::MFPP (Minimize Fermionic Projector Programm)");

  VBox_initlist_main.set_border_width(10);
  add(VBox_initlist_main);
 
  VBox_initlist_main.pack_start(Frame_initlist_1, false, false, 0);
    
  Table_initlist_1.attach(Label_initlist_1,0,1,0,1,Gtk::EXPAND, Gtk::EXPAND,5,5);
  Table_initlist_1.attach(Entry_initlist_data1,1,2,0,1,Gtk::EXPAND, Gtk::EXPAND,5,5);
  Entry_initlist_data1.set_max_length(40);
  Entry_initlist_data1.set_text("Testtext");

  Table_initlist_1.attach(Label_initlist_2,0,1,1,2,Gtk::EXPAND, Gtk::EXPAND,5,5);
  Table_initlist_1.attach(Entry_initlist_data2,1,2,1,2,Gtk::EXPAND, Gtk::EXPAND,5,5);
  Entry_initlist_data2.set_max_length(40);
  Entry_initlist_data2.set_text("Testtext");
   
  Table_initlist_1.attach(Label_initlist_3,0,1,2,3,Gtk::EXPAND, Gtk::EXPAND,5,5);
  Table_initlist_1.attach(Entry_initlist_data3,1,2,2,3,Gtk::EXPAND, Gtk::EXPAND,5,5);
  Entry_initlist_data3.set_max_length(40);
  Entry_initlist_data3.set_text("Testtext");
 
  Label_initlist_4.set_alignment(Gtk::ALIGN_RIGHT);
  Table_initlist_1.attach(Label_initlist_4,0,1,3,4,Gtk::EXPAND, Gtk::EXPAND,5,5);
  Table_initlist_1.attach(Entry_initlist_data4,1,2,3,4,Gtk::EXPAND, Gtk::EXPAND,5,5);
  Entry_initlist_data4.set_max_length(40);
  Entry_initlist_data4.set_text("Testtext");

   
  Frame_initlist_1.add(Table_initlist_1);
   
  VBox_initlist_main.pack_start(VBox_initlist_end);
  VBox_initlist_end.set_border_width(5);
 
  Button_initlist_Close.add_pixlabel("kmplot.xpm", "CALCULATE!");
  set_border_width(10);
  Button_initlist_Close.signal_clicked().connect( SigC::slot(*this, &ExampleWindow::on_button_close) );
  VBox_initlist_main.pack_start(Button_initlist_Close);
  Button_initlist_Close.set_flags(Gtk::CAN_DEFAULT);
  Button_initlist_Close.grab_default();

  show_all_children();
}

ExampleWindow::~ExampleWindow()
{
}

// This function makes shure that the window closes when the button is pressed

void ExampleWindow::on_button_close()
{
  hide();
}


Telefonieren Sie ohne weitere Kosten mit Ihren Freunden von PC zu PC!
Jetzt Yahoo! Messenger installieren!

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