Re: simple help needed
| From: | Roberto Villarreal | Date: | Wed, 06 Nov 2002 03:25:02 +0000 |
| Subject: | Re: simple help needed | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2588@lists.php.net to get a copy of this message | ||
On Wed, 6 Nov 2002 11:32:51 +0800
"firepages.com.au" <fire@firepages.com.au> wrote:
> Hi for 1), add this function..
>
> function close_window($widget,$mode='')
> {
> $window = $widget->get_toplevel();
> if($mode){/*this bit is for if you make your window modal using
> grab_add() if not - ignore*/
> Gtk::grab_remove($window);
> }
> $window->destroy();
> }
>
> then for your button...
>
> $exit->connect('clicked',close_window);
>
>
> 2) depends on all sorts of things ;) have not a clue about sending to the
> the printer but if to screen , you first need a widget that can display text
> to put the returned data into, and depending on what that widget is will
> decide the answer , let us know.
>
>
On windows you can use php_printer.dll it works nice
http://www.php.net/printer
Dont know if on linux you can do something similar, maybe using PDFlib
(www.php.net/manual/en/ref.pdf.php) and then read it with ghostscript or send it to your printer...
but it seems much more complicated... haven't tasted it
>
> Simon Wheeler.
>
>
> ----- Original Message -----
> From: "tony g" <kamigwi@netscape.net>
> To: <php-gtk-general@lists.php.net>
> Sent: Wednesday, November 06, 2002 10:45 AM
> Subject: [PHP-GTK] simple help needed
>
>
> > 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.;
> > 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 menu
> >
> > 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
> >
> >
> >
> >
>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php