background image

17         $dialog = new GtkMessageDialog($wnd, Gtk::DIALOG_MODAL,
18             Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, $errors);
19         $dialog->set_markup(
20             "The following errors occured:\r\n"
21             . "<span foreground=’red’>" . $errors . "</span>"
22         );
23         $dialog->run();
24         $dialog->destroy();
25     }
26 else {
27         $wnd->destroy();
28     }
29 }
30 $wnd = new GtkWindow();
31 $wnd->set_title(‘Login’);
32 $wnd->connect_simple(‘destroy’, array(‘gtk’, ‘main_quit’));
33 $txtUsername = new GtkEntry();
34 $txtPassword = new GtkEntry();
35 $lblUsername = new GtkLabel(‘_Username’,true);
36 $lblPassword = new GtkLabel(‘_Password’,true);
37 $btnLogin = new GtkButton(‘_Login’);
38 $btnCancel = new GtkButton(‘_Cancel’);
39 $lblUsername->set_mnemonic_widget($txtUsername);
40 $lblPassword->set_mnemonic_widget($txtPassword);
41 $btnCancel->connect_simple(‘clicked’,array($wnd,’destroy’));
42 $btnLogin->connect_simple(‘clicked’,'login’,$wnd,$txtUsername,$txtPassword);
43 $tbl = new GtkTable(3,2);
44 $tbl->attach($lblCredit,0,2,0,1);
45 $tbl->attach($lblUsername,0,1,1,2);
46 $tbl->attach($txtUsername,1,2,1,2);
47 $tbl->attach($lblPassword,0,1,2,3);
48 $tbl->attach($txtPassword,1,2,2,3);
49 $bbox = new GtkHButtonBox();
50 $bbox->set_layout(Gtk::BUTTONBOX_EDGE);
51 $bbox->add($btnLogin);
52 $bbox->add($btnCancel);
53 $vbox = new GtkVBox();
54 $vbox->pack_start($tbl);
55 $vbox->pack_start($bbox);
56 $wnd->add($vbox);
57 //$lblHello = new GtkLabel("This is my first php talbe application\nhaha");
58 //$wnd->add($lblHello);
59 $wnd->show_all();
60 Gtk::main();