Code implementation PHP GTK Write text viewer _php tutorial

Source: Internet
Author: User
Tags gtk
We will introduce you to this article

PHP GTK Write Text Viewer code example:

  1. < ? PHP
  2. Require_once (' file.php ');
  3. if (!class_exists (' GTK ')) {
  4. if (Strtoupper (substr (php_os, 0,3) = = ' WIN '))
  5. DL (' Php_gtk.dll ');
  6. Else
  7. DL (' php_gtk.so ');
  8. 10}
  9. function Delete_event ()
  10. {
  11. return false;
  12. }
  13. function shutdown ()
  14. {
  15. Print ("shutting down");
  16. Gtk::main_quit ();
  17. }
  18. function buttonload_clicked ()
  19. {
  20. Selectfile ();
  21. }
  22. function buttonclose_clicked ()
  23. {
  24. Global $window;
  25. $window- > close ();
  26. }
  27. function Fs_ok ($button, $fs)
  28. {
  29. Global $TextBox;
  30. $TextBox- > Insert_text
    (File::readall ($fs->get_filename ()), 0);
  31. return true;
  32. }
  33. function Fs_cancel ()
  34. {
  35. return false;
  36. }
  37. function Selectfile ()
  38. {
  39. $ FS = &new gtkfileselection
    (' Please select the file ');
  40. $ Ok_button = $fs- > Ok_button;
  41. $ok _button- > connect (' clicked ', ' Fs_ok ', $fs);
  42. $ok _button- > Connect_object
    (' Clicked ', Array ($fs, ' destroy '));
  43. $ Cancel_button = $fs- > Cancel_button;
  44. $cancel _button- > Connect
    (' clicked ', ' Fs_cancel ');
  45. $cancel _button- > Connect_object
    (' Clicked ', Array ($fs, ' destroy '));
  46. $fs- > Show ();
  47. }
  48. $ window = &new Gtkwindow ();
  49. $window- > Connect (
    ' Destroy ', ' shutdown ');
  50. $window- > Connect (' delete-event '
    , ' delete_event ');
  51. $window- > set_border_width (0);
  52. $ TextBox = &new gtktext ();
  53. $TextBox- > set_editable (true);
  54. $ Buttonload = &new Gtkbutton (' Load ');
  55. $ButtonLoad- > connect (' clicked ',
    ' buttonload_clicked ');
  56. $ Buttonclose = &new Gtkbutton (' Close ');
  57. $ButtonClose- > connect (' clicked ',
    ' buttonclose_clicked ');
  58. $ VBox = &new Gtkvbox (false, ten);
  59. $VBox- > Pack_start ($ButtonLoad);
  60. $VBox- > Pack_start ($ButtonClose);
  61. $ HBox = &new Gtkhbox (false, ten);
  62. $HBox- > Pack_start ($TextBox);
  63. $HBox- > Pack_start ($VBox);
  64. $window- > Add ($HBox);
  65. $window- > Show_all ();
  66. Gtk::main ();
  67. ?>

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.