|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
emit_stop_by_nameHi,
php-gtk1 has the function GtkObject::emit_stop_by_name http://gtk.php.net/manual1/en/gtk.gtkobject.method.emit_stop_by_name.php From the php-gtk2 Inspector, this function does not exist. Does anybody know if this function is no longer available in php-gtk2? Or it has not been implemented yet. If it is dropped, is there any function that would achieve the same functionaility? Couldn't find any information on the net with regards to the above... Thanks and Regards, /kksou |
|
|
Re: emit_stop_by_nameHi,
> php-gtk1 has the function GtkObject::emit_stop_by_name > http://gtk.php.net/manual1/en/gtk.gtkobject.method.emit_stop_by_name.php > > From the php-gtk2 Inspector, this function does not exist. > > Does anybody know if this function is no longer available in php-gtk2? Or > it > has not been implemented yet. From the GTK 2.0 manual: gtk_signal_emit_stop_by_name is deprecated and should not be used in newly-written code. Use g_signal_stop_emission_by_name() instead. > If it is dropped, is there any function that would achieve the same > functionaility? There is in GTK+ (well, in GObject to be precise,) but it's very low-level stuff - it would need to be wrapped nicely for PHP-GTK. And no, nobody's looked into that one yet. What exactly are you trying to do? - I ask because there may well be a workaround in amongst the existing code base. - Steph > Couldn't find any information on the net with regards to the above... > > Thanks and Regards, > /kksou > > -- > View this message in context: > http://www.nabble.com/emit_stop_by_name-tf2513138.html#a7008642 > Sent from the Php - GTK - General mailing list archive at Nabble.com. > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > __________ NOD32 1.1380 (20060125) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: emit_stop_by_nameI was facing a situation similar to "tab key/field order problem" which you have helped to answer in Feb 2005: http://marc.theaimsgroup.com/?l=php-gtk-general&m=110962563019541&w=2 As noted there, "the emit_stop_by_name is needed to prevent other handlers in the chain from handling the event (without it, the focus changes, but a tab gets inserted as well)" Regards, /kksou |
|
|
Re: emit_stop_by_nameHi,
>> What exactly are you trying to do? - I ask because there may well be a >> workaround in amongst the existing code base. >> > > I was facing a situation similar to "tab key/field order problem" which > you > have helped to answer in Feb 2005: > http://marc.theaimsgroup.com/?l=php-gtk-general&m=110962563019541&w=2 > > As noted there, "the emit_stop_by_name is needed to prevent other handlers > in the chain > from handling the event (without it, the focus changes, but a tab gets > inserted as well)" What happens if you simply have the function/method return TRUE where you would've called emit_stop? This should propagate, so long as it's an event signal you're dealing with. That technique seems to have been used successfully in place of both emit_stop_by_name and its newer cousin throughout the GTK+ source, so depending on the nature of the signal you're dealing with, it could be worth a try. - Steph > > Regards, > /kksou > > > > -- > View this message in context: > http://www.nabble.com/emit_stop_by_name-tf2513138.html#a7011790 > Sent from the Php - GTK - General mailing list archive at Nabble.com. > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > __________ NOD32 1.1380 (20060125) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: emit_stop_by_nameHi Steph, Yes, return TRUE works for most of the signals. But when it comes to 'insert-text' for GtkEntry. It doesn't seem to work. Here's an example. Scenario: To set up a GtkEntry that accepts only hexadecimal numbers. With php-gtk1, the code is short and sweet with the use of emit_stop_by_name() <?php if( !extension_loaded('gtk')) dl( 'php_gtk.' . PHP_SHLIB_SUFFIX); $window = &new GtkWindow(); $window->connect('destroy', array('Gtk','main_quit')); $entry = &new GtkEntry(); $entry->connect('insert-text', 'on_insert'); $window->add($entry); $window->show_all(); Gtk::main(); function on_insert($widget, $text, $len, $position) { $text = substr($text, 0, $len); if (!preg_match("/[0-9a-fA-F]/", $text)) { # not hexadecimal number - just gobble it up $widget->emit_stop_by_name('insert-text'); } } ?> With php-gtk2, return TRUE doesn't work as expected. Thought it would stop the signal propagation. But the non-hexadecimal character still gets displayed in GtkEntry. <?php $window = new GtkWindow(); $window->set_size_request(400, 200); $window->connect_simple('destroy', array('Gtk','main_quit')); $window->connect('destroy', array('Gtk','main_quit')); $entry = new GtkEntry(); $entry->connect('insert-text', 'on_insert'); $window->add($entry); $window->show_all(); Gtk::main(); function on_insert($widget, $text, $len, $position) { $text = substr($text, 0, $len); if (!preg_match("/[0-9a-fA-F]/", $text)) { echo "not hexadecimal number!\n"; #$widget->emit_stop_by_name('insert-text'); return true; } return false; } ?> I have done some trial and errors, and managed to get the same effect in php-gtk2 by capturing 'key-press-event' in $windows and then manually insert the characters into the GtkEntry. Though the effect is the same, the solution, if emit_stop_by_name() is available, would be more straightforward. Regards, /kksou |
|
|
Re: emit_stop_by_namekksou wrote:
> I have done some trial and errors, and managed to get the same effect in > php-gtk2 by capturing 'key-press-event' in $windows and then manually insert > the characters into the GtkEntry. Though the effect is the same, the > solution, if emit_stop_by_name() is available, would be more > straightforward. > > > I played around with your example and came up with the following. You don't have to manually insert the characters and the filter works even though the logic of the if() statement may seem "backwards." Other than that, it's pretty straightforward, IMHO. Hope this helps. <?php function onInsert($widget, $event) { $result = false; $character = chr($event->keyval); if(!preg_match("/[0-9a-fA-F]/", $character)) { $result = true; } return($result); } // onInsert() $entry = new GtkEntry(); $entry->connect('key-press-event', 'onInsert'); $window = new GtkWindow(); $window->set_size_request(400, 200); $window->connect_simple('destroy', array('Gtk','main_quit')); $window->connect('destroy', array('Gtk','main_quit')); $window->add($entry); $window->show_all(); Gtk::main(); ?> -Ron T. -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: emit_stop_by_namekksou wrote:
> I have done some trial and errors, and managed to get the same effect in > php-gtk2 by capturing 'key-press-event' in $windows and then manually insert > the characters into the GtkEntry. Though the effect is the same, the > solution, if emit_stop_by_name() is available, would be more > straightforward. > > > I played around with your example and came up with the following. You don't have to manually insert the characters and the filter works even though the logic of the if() statement may seem "backwards." Other than that, it's pretty straightforward, IMHO. Hope this helps. <?php function onInsert($widget, $event) { $result = false; $character = chr($event->keyval); if(!preg_match("/[0-9a-fA-F]/", $character)) { $result = true; } return($result); } // onInsert() $entry = new GtkEntry(); $entry->connect('key-press-event', 'onInsert'); $window = new GtkWindow(); $window->set_size_request(400, 200); $window->connect_simple('destroy', array('Gtk','main_quit')); $window->connect('destroy', array('Gtk','main_quit')); $window->add($entry); $window->show_all(); Gtk::main(); ?> -Ron T. -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: emit_stop_by_nameHi Ron, Thanks for the sample code. Works very well for this scenario! Regards, /kksou |
|
|
Re: emit_stop_by_nameIf it's not implemented yet, I'll do that soon.
-Andrei On Oct 26, 2006, at 3:29 AM, kksou wrote: > > Hi, > > php-gtk1 has the function GtkObject::emit_stop_by_name > http://gtk.php.net/manual1/en/ > gtk.gtkobject.method.emit_stop_by_name.php > >> From the php-gtk2 Inspector, this function does not exist. > > Does anybody know if this function is no longer available in php-gtk2? > Or it > has not been implemented yet. > > If it is dropped, is there any function that would achieve the same > functionaility? > > Couldn't find any information on the net with regards to the above... > > Thanks and Regards, > /kksou > > -- > View this message in context: > http://www.nabble.com/emit_stop_by_name-tf2513138.html#a7008642 > Sent from the Php - GTK - General mailing list archive at Nabble.com. > > -- > 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 |
|
|
Re: emit_stop_by_nameYou're very welcome, sir. -Ron T. |
|
|
Re: emit_stop_by_nameGObject::stop_emission() is implemented (also known as
emit_stop_by_name() for BC). -Andrei On Oct 26, 2006, at 3:29 AM, kksou wrote: > > Hi, > > php-gtk1 has the function GtkObject::emit_stop_by_name > http://gtk.php.net/manual1/en/ > gtk.gtkobject.method.emit_stop_by_name.php > >> From the php-gtk2 Inspector, this function does not exist. > > Does anybody know if this function is no longer available in php- > gtk2? Or it > has not been implemented yet. > > If it is dropped, is there any function that would achieve the same > functionaility? > > Couldn't find any information on the net with regards to the above... > > Thanks and Regards, > /kksou > > -- > View this message in context: http://www.nabble.com/ > emit_stop_by_name-tf2513138.html#a7008642 > Sent from the Php - GTK - General mailing list archive at Nabble.com. > > -- > 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 |
|
|
Re: emit_stop_by_nameThanks, Andrei! Will work out some intersting examples on the use of this function. Regards, /kksou p.s. It's relatively easy to recompile php-gtk2 on linux. However, for windows, was wondering if the php-gtk2 core team would release an updated compilation of Gnope_PHPGtk2_dll so that this function would also be available for the windows users. Thanks...! |
| Free embeddable forum powered by Nabble | Forum Help |