Re: simple help needed
| From: | tony g | Date: | Wed, 06 Nov 2002 07:05:58 +0000 |
| Subject: | Re: simple help needed | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2592@lists.php.net to get a copy of this message | ||
Q: using destroy() or hide()
why does the "Exit" button dissapear, and the active
(new opened by $open->connect_object("activate","entry_window");) window still remains, i have declared $window1 as global.
thanks
antony
Roberto Villarreal wrote:
On Wed, 06 Nov 2002 11:45:41 +0900 tony g <kamigwi@netscape.net> wrote:Hello everyone, I am new to the list and also to GTK PHP, little experience with PHP though. I would like to request for some help. 1. How do u close the current active window (called by entry_window()--see script) that has been called by the main program without closing the gtk::main loop or any other windows that are open for that matter.;$window->hide(); (I think you must declare $window as global before) It wont destroy the window so you can show it again later, maybe you can also use $window->destroy(); Also you can write a function that will be the destroy event callback $window->connect('destroy', 'hide_function'); function hide_function($window) { $window->hide(); return true; }2. After obtaining output from say mysql, how do u send it to the default printer, or just save it( how do u print the information on a widget or window) using a button or menuIf you have a GtkEntry and there is where you want to write your mysql data use this: $entry = &new GtkEntry(); $entry->set_text('your data here'); Hope this helps you.I would really appreciate any help given. here is a sample of what i was working with: function shutdown() {gtk::main_quit();} function entry_window() { $window1 = &new GtkWindow(); $window1->set_position(GTK_WIN_POS_CENTER); $window1->set_border_width(10); $window1->set_default_size(500,300); $window1->connect('delete_event','delete_event'); $namelabel = &new GtkLabel("Name"); $agelabel = &new GtkLabel("Age"); $genderlabel = &new GtkLabel("Gender"); $name = &new GtkEntry(); $age=&new GtkEntry(); $gender=&new GtkEntry(); $name->connect('activate', 'get_input'); $age->connect('activate', 'get_input'); $gender->connect('activate', 'get_input'); $save = &new GtkButton('Save Data'); $save->connect('clicked', 'save_data'); $exit = &new GtkButton('Exit'); $exit->connect('clicked','....help......'); $table = &new GtkTable(3,2); $table->attach($name,2,3,0,1); $table->attach($age,2,3,1,2); $table->attach($gender,2,3,2,3); $table->attach($namelabel,0,1,0,1); $table->attach($agelabel,0,1,1,2); $table->attach($genderlabel,0,1,2,3); $table->attach($save,0,1,3,4); $table->attach($exit,2,3,3,4); $window1->add($table); $window1->show_all(); } $window = &new GtkWindow(); $window->set_uposition(10, 10); $window->set_usize((gdk::screen_width()-20), (gdk::screen_height()-30)); $window->connect_object('destroy', array('gtk', 'main_quit')); $box = &new GtkVBox(); $window->add($box); $menubar = &new GtkMenuBar(); $box->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"); $open->connect_object("activate","entry_window"); $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); $window->show_all(); Thanks, Antony -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php