Move the focus along ( Tab keypress? )



Greetings.

I'm trying to trap an Enter keypress and create a Tab keypress ( or otherwise move the focus along ).

So far I've got:

sub process_entry_keypress {
my ( $self, $widget, $event ) = @_; if (
       $event->keyval == $Gtk2::Gdk::Keysyms{ Return } ||
       $event->keyval == $Gtk2::Gdk::Keysyms{ KP_Enter }
      ) {
       print "An Enter key has been pressed!\n";
       my $new_event = Gtk2::Gdk::Event::Key->new('key-press');
       $event->keyval($Gtk2::Gdk::Keysyms{'Tab'});
       $window->get_widget($window_name)->propagate_key_event($new_event);
   }
return FALSE; }

The creation of the event stuff I've copied and pasted from elsewhere without knowing what's going on. And guess what ... it doesn't work :)

Am I going about this the right way? How do I move the focus along / send a Tab keypress?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]