Re: How to catch a control-key press in a textview widget ?



>I would like to "catch" when a user  press a control-<key> (where <key> is
>any key of the keyboard)
>while is typing in a "textview" widget...

the press of the control key is just the same as the press of any
other key. so you could just keep track of the state yourself.

however, much easier is to use the "state" field of a GdkEventKey,
which contains a bitmask of the currently depressed modifier keys
(shift, control, etc.). so, when a person presses control-k, you will
see:

	* an event for the control press, ev->state = 0
	* an event for the k press, (ev->state & GDK_CONTROL_MASK) != 0
	* an event for the release of k
	* an event for the release of control

--p



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