Re: Tab pressing



First you must intercept the <Enter> keystroke event before it is
propagated to the widgets contained in your application window(s).  To
do this, you must connect your own callback slot to
Gtk::Main::signal_key_snooper like this:

Gtk::Main::signal_key_snooper().connect(sigc::mem_fun(*this,&YourClass::on_enter_key_pressed));

This callback slot will receive a Gtk::Widget pointer and a GdkEventKey
pointer; so you can determine whether or not the enter key has been
pressed.  I attempted to use gtk_propagate_event to propagate a TAB
keypress, but I was unable to get it to work.  The code below definitely
intercepts the <Enter> keystroke.

// code begins
YourClass::on_enter_key_pressed(Gtk::Widget* widget, GdkEventKey *keyevent)
{
  
    if(keyevent->keyval == GDK_Enter && keyevent->type == GDK_KEY_PRESS)
    {

    }

    return 1;

}
// code ends

Disclaimer:  I could not find anything on what the return value from the
callback should be or why.

Can anyone help with code to propagate a tab key press for Volosatov?

Bob

Volosatov Alexander wrote:

>I need when user press <Enter>, emit <Tab> pressing.
>What function I must use and how?
>
>Alex
>_______________________________________________
>gtkmm-list mailing list
>gtkmm-list gnome org
>http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>  
>



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