We will introduce you to this article
PHP GTK Write Text Viewer code example:
- < ? PHP
- Require_once (' file.php ');
- if (!class_exists (' GTK ')) {
- if (Strtoupper (substr (php_os, 0,3) = = ' WIN '))
- DL (' Php_gtk.dll ');
- Else
- DL (' php_gtk.so ');
- 10}
- function Delete_event ()
- {
- return false;
- }
- function shutdown ()
- {
- Print ("shutting down");
- Gtk::main_quit ();
- }
- function buttonload_clicked ()
- {
- Selectfile ();
- }
- function buttonclose_clicked ()
- {
- Global $window;
- $window- > close ();
- }
- function Fs_ok ($button, $fs)
- {
- Global $TextBox;
- $TextBox- > Insert_text
(File::readall ($fs->get_filename ()), 0);
- return true;
- }
- function Fs_cancel ()
- {
- return false;
- }
- function Selectfile ()
- {
- $ FS = &new gtkfileselection
(' Please select the file ');
- $ Ok_button = $fs- > Ok_button;
- $ok _button- > connect (' clicked ', ' Fs_ok ', $fs);
- $ok _button- > Connect_object
(' Clicked ', Array ($fs, ' destroy '));
- $ Cancel_button = $fs- > Cancel_button;
- $cancel _button- > Connect
(' clicked ', ' Fs_cancel ');
- $cancel _button- > Connect_object
(' Clicked ', Array ($fs, ' destroy '));
- $fs- > Show ();
- }
- $ window = &new Gtkwindow ();
- $window- > Connect (
' Destroy ', ' shutdown ');
- $window- > Connect (' delete-event '
, ' delete_event ');
- $window- > set_border_width (0);
- $ TextBox = &new gtktext ();
- $TextBox- > set_editable (true);
- $ Buttonload = &new Gtkbutton (' Load ');
- $ButtonLoad- > connect (' clicked ',
' buttonload_clicked ');
- $ Buttonclose = &new Gtkbutton (' Close ');
- $ButtonClose- > connect (' clicked ',
' buttonclose_clicked ');
- $ VBox = &new Gtkvbox (false, ten);
- $VBox- > Pack_start ($ButtonLoad);
- $VBox- > Pack_start ($ButtonClose);
- $ HBox = &new Gtkhbox (false, ten);
- $HBox- > Pack_start ($TextBox);
- $HBox- > Pack_start ($VBox);
- $window- > Add ($HBox);
- $window- > Show_all ();
- Gtk::main ();
- ?>
The above code is the PHP gtk write text Viewer related methods introduced.
http://www.bkjia.com/PHPjc/446110.html www.bkjia.com true http://www.bkjia.com/PHPjc/446110.html techarticle in this article we will introduce the PHP gtk write text Viewer code example: Php require_once (' file.php '), if (!class_exists (' GTK ')) {if (Strtoupper (substr (php_os,0,3) = = ' W ...