Help with adding MenuBar
| From: | Jared Mashburn | Date: | Sun, 05 Jan 2003 06:24:40 +0000 |
| Subject: | Help with adding MenuBar | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2841@lists.php.net to get a copy of this message | ||
Hi everyone,
Im new to this list and have a question.
I have gotten a snippet of code that I have tweaked into a login prompt,
everthing works fine, but I want to add a MenuBar to the top. (which
code I have also borrowed from the Documentations....By themselves they
work as expected but together something goes wrong.
I would apprciate any help... Thanks Jared
$window = &new GtkWindow();
$window->set_title('Login');
$window->connect('destroy', 'destroy');
$window->connect('delete-event', 'delete_event');
$window->set_border_width(10);
##### MenuBar
$box1 = &new GtkVBox(false, 5);
$window->add($box1);
$menubar = &new GtkMenuBar();
$box1->pack_start($menubar, false, false, 0);
$header1 = &new GtkMenuItem("File");
$menubar->append($header1);
$header2 = &new GtkMenuItem("Edit");
$menubar->append($header2);
$filemenu = &new GtkMenu();
$open = &new GtkMenuItem("Open");
$filemenu->append($open);
$save = &new GtkMenuItem("Save");
$filemenu->append($save);
$separator = &new GtkMenuItem();
$separator->set_sensitive(false);
$filemenu->append($separator);
$exit = &new GtkMenuItem("Exit");
$exit->connect_object("activate", array("gtk",
"main_quit"));
$filemenu->append($exit);
$header1->set_submenu($filemenu);
$box1->pack_end();
#####End MenuBar
#####TableInfo Start
$table = &new GtkTable(4, 2);
$table->set_row_spacings(4);
$table->set_col_spacings(4);
$window->add($table);
$user_label = &new GtkLabel('Username: ');
$table->attach($user_label, 0, 1, 0, 1);
$pass_label = &new GtkLabel('Password: ');
$table->attach($pass_label, 0, 1, 1, 2);
$user_entry = &new GtkEntry();
$table->attach($user_entry, 1, 2, 0, 1);
$pass_entry = &new GtkEntry();
$pass_entry->set_visibility(FALSE);
$table->attach($pass_entry, 1, 2, 1, 2);
$check = &new GtkCheckButton('Save Logon Info?');
$check->set_active(FALSE);
$table->attach($check, 1, 2, 2, 3);
$button = &new GtkButton('Login');
$button->connect('clicked','user_login');
$table->attach($button, 0, 2, 3, 4);
######TableInfo End
$window->show_all();
Gtk::main();
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc