RE: Capture all key press events



On Wed, 2007-02-21 at 15:31 -0700, Sirisha Muppavarapu wrote:
> 
> I fixed the problem myself. Solution(for newbies out there):
> 
> signal_key_press_event().connect(sigc::mem_fun(*this,&MyClass::key_pressed),false);
> 
> Having false at the end says that default handler should handle all
> the events key_pressed event didn't handle.
> Process the events captured in key_pressed method as required and
> return a true or false.
> Returning true from key_pressed method says key_pressed method handled
> processing of the event.
> Returning false says key_pressed method didn't handle the event,
> default handler should handle the event.

btw, its slightly more efficient to define 

	bool on_key_press_event (GdkKeyEvent*);

in your derived class.

--p





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