Environment: W2k + php (as the current mainstream development language) 4.3.1 + php (as the current mainstream development language)/gtk0.5.2 a simple Notepad (only files can be opened for modification) & lt ;? Php (as the mainstream development language) set_time_limit (0); & nbsp; // Set
Environment: W2k + php (as the mainstream development language) 4.3.1 + php (as the mainstream development language)/gtk0.5.2
A simple Notepad (only files can be opened for modification)
Set_time_limit (0); // Set the running time
If (! Class_exists ("gtk") // determines whether a GTK module exists.
If (strtoupper (substr ($ _ SERVER ["OS"], 0, 3) = "WIN ")
Dl ("php (as the mainstream development language) _ gtk. dll ");
Else
Dl ("php (as the mainstream development language) _ gtk. so ");
$ Window = & new GtkWindow (); // create a window
$ Window-> set_uposition (100,100); // the position where the window appears.
$ Window-> set_usize (gdk: screen_width ()-200), (gdk: screen_height ()-150); // window size
$ Window-> set_title ("WINDOWS"); // you can specify the window title.
$ Window-> connect_object (destroy, array (gtk, main_quit); // registers window events
$ Vbox = & new GtkVBox ();
$ Hbox = & new GtkHBox ();
$ Window-> add ($ vbox );
$ MenuBar = & new GtkMenuBar (); // create a menu
$ Vbox-> pack_start ($ menuBar, false, false, 0 );
$ File = & new GtkMenuItem ("File ");
$ MenuBar-> append ($ file );
$ FileMenu = & new GtkMenu ();
$ Open = & new GtkMenuItem ("Open ");
$ Save = & new GtkMenuItem ("Save ");
$ Line = & new GtkMenuItem ();
$ Line-> set_sensitive (true );
$ Exit = & new GtkMenuItem ("Exit ");
$ FileMenu-> append ($ open );
$ Open-> connect_object (activate, showFileSelection );
$ FileMenu-> append ($ save );
$ Save-> connect_object (activate, saveFile );
$ FileMenu-> append ($ line );
$ FileMenu-> append ($ exit );
$ Exit-> connect_object (activate, array (gtk, main_quit ));
$ File-> set_submenu ($ fileMenu );
$ Scroll = & new GtkScrolledWindow ();
$ Scroll-> set_border_width (8 );
$ Scroll-> set_policy (GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
$ Hbox-> pack_start ($ scroll, true, true, 0 );
$ Vbox-> pack_start ($ hbox, true, true, 1 );
$ Text = & new GtkText ();
$ Text-> set_editable (true );
$ Text-> set_word_wrap (true );
$ Scroll-> add ($ text );
Function showFileSelection () // file selection function
{
$ File = & new GtkFileSelection ("File Selection ");
$ OK _button = $ file-> OK _button;
$ OK _button-> connect (clicked, openFile, $ file );
$ OK _button-> connect_object (clicked, array ($ file, destroy ));
$ Cancel_button = $ file-> cancel_button;
$ Cancel_button-> connect_object (clicked, array ($ file, destroy ));