RE: [PHP-GTK] GTk Entry

From: Date: Mon, 09 Aug 2004 15:49:12 +0000
Subject: RE: [PHP-GTK] GTk Entry
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4949@lists.php.net to get a copy of this message
This works, but I'd re-think that design if I were you. It would be nicer to alter selected text than to have to type it into an entirely separate widget, no? nb you were trying to pass the function a gtkbutton before .. use connect_object() and send arguments as part of the function call rather than trying to make things global. <?php //gtk.php if(!extension_loaded("gtk")) { dl("php_gtk." . PHP_SHLIB_SUFFIX); } function shutdown() { echo "Shutting down now..."; gtk::main_quit(); } function return_text($input, $editor, $window) { $str = $input->get_text(); if (!$str) { return false; } else { $str = "<b>" . $str . "</b>"; $editor->insert_text($str, -1); $window->destroy(); } } function Bold($editor) { $window = &new GtkWindow(); $box = &new GtkHBox(); $input = &new GtkEntry(); $input->set_text("Insert the string to format"); $button = &new GtkButton('Inserisci'); $button->connect_object('clicked','return_text', $input, $editor, $window); $box->pack_start($input); $box->pack_start($button); $window->add($box); $window->show_all(); } $window2 = &new GtkWindow(); $window2->set_title("Editor"); $box = &new GtkHbox(); $editor = &new GtkText(); $editor->set_editable(1); $adj = $editor->vadj; $scroll = &new GtkVScrollbar($adj); $box->pack_start($editor); $box->pack_start($scroll); $window2->add($box); $window2->show_all(); //pannello di controllo con pulsanti per formattare $window = &new GTkWindow(); $window->set_title("::[ Felix ]::"); $window->connect('destroy','shutdown'); $control = &new GTkVButtonBox(); $window->add($control); $button_1 = &new GtkButton("Bold"); $button_2 = &new GtkButton("Break"); $button_3 = &new GtkButton("Italic"); $button_4 = &new GtkButton("List"); $button_1->connect_object("clicked", "Bold", $editor); $control->pack_start($button_1); $control->pack_start($button_2); $control->pack_start($button_3); $control->pack_start($button_4); $window->show_all(); gtk::main(); ?> > -----Original Message----- > From: difenza2003@libero.it [mailto:difenza2003@libero.it] > Sent: 09 August 2004 16:04 > To: GTk GTk > Subject: [PHP-GTK] GTk Entry > > > I've changed the code but i don't have good result. > I receice the same error: > Fatal error: Call to a member function on a non-object in > c:\php4\gtk.php on line 17 > The line 17 is where i assign the value of GTkEntry to the > variable $str_tag into the function > bold_text(). > Who help me to resolve this problem ? > Thank you so much to all > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.gtk.general (#4949) next »