[Vala] keybinding in vala



Hello.

I've got problem with making keybinding work - all the examples and tutorials I've
managed to find deal with trivial (single key) case only :(

I'd like to use Ctrl+t as a key combo in my app. Here is the code:

        private bool key_pressed(Gdk.EventKey event)
        {
                string key = Gdk.keyval_name(event.keyval);
                if(key == "t" && (event.state & Gdk.ModifierType.CONTROL_MASK) != 0)
                {
                        this.new_tab();
                        stderr.printf("ctrl+t pressed");
                        return true;
                }
                stderr.printf("something else pressed: ");
                stderr.printf(key);
                return false;
        }

The problem is that the code reacts to just Ctrl by itself, not Ctrl+t. Is there way
to make it work? COuld you point me to some tutorial or provide example?

thanks,
Max.


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