Re: How to put widget into dialog ?



Nietykalny wrote:

Hello Everyone :)

I'm writting simpl c++ and gtkmm 2.4 application, which is simpla database, but nevermind. I doesn't know how to put widget like Gtk::Label into Gtk::Dialog ? I've been trying somethig like this:
  Gtk::VBox *pBox=itsDialog.get_vbox();
  pBox->pack_start(itsLabel);

Unfourtunetlly, it doesn't work. I'd like to know how to create many windows in one Gtk::Main::run() loop. First - parent window is with menus and the second is with preferences. I tried to have two Gtk::Main::run() for, but if both windows was open and parent window has been closed the program hanged.
---------------------------------------------------------------------
Toshiba i FIFA World Cup
Wygraj bilety i notebooki z Intel Centrino Duo Mobile Technology
http://link.interia.pl/f1912

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


This is how I do it:

   // set up my widgets to add to the dialog
   Gtk::Label label;
   label.set_markup("<big> Enter new employee ID: </big>");
   Gtk::Entry entry;
   entry.set_max_length(5);
   entry.set_has_frame();
   entry.set_activates_default(TRUE);
// instantiate the dialog and add the buttons
   // I'll need
   Gtk::Dialog db;
   db.set_title(" New Employee Record ");
   db.set_has_separator(TRUE);
   db.set_position(Gtk::WIN_POS_CENTER_ALWAYS);
   db.add_button(Gtk::Stock::OK,Gtk::RESPONSE_OK);
   db.add_button(Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL);
   db.set_default_response(Gtk::RESPONSE_OK);

   // create a horizontal box for formatting purposes
   Gtk::HBox hbox(FALSE,4);
   hbox.set_border_width(5);
   hbox.pack_start(label,TRUE,FALSE,3);
   hbox.pack_start(entry,TRUE,FALSE,3);

   // add the horizontal box to the dialog's accessible
   // vertical box and show all the widgets (which is
   // probably why your code didn't work in the first
   // place)
   db.get_vbox()->pack_start(hbox,TRUE,FALSE,3);
   db.show_all_children();
Hope this helps,

Bob
begin:vcard
fn:Robert Caryl
n:Caryl;Robert
org:Fiscal Systems, Inc.
adr:;;102 Commerce Circle;Madison;AL;35758;USA
email;internet:bob fis-cal com
title:Senior Software Design Engineer
tel;work:356-772-8920 X108
x-mozilla-html:TRUE
url:http://www.fis-cal.com
version:2.1
end:vcard



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