Re: grabbing arrow keys in Gtk::Window



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You should call win.add_events() with Gdk::EventType::KEY_PRESS before
you run your window.


/*Bob Caryl*
Fiscal Systems,Inc.
256.772.8920 Ext. 108
http://www.fis-cal.com <http://www.fis-cal.com/>/

/This email message may contain privileged or confidential information.
If you are not the intended recipient, you may not disclose, use,
disseminate, distribute, copy or rely on this message or attachment in
any way. If you received this email message in error, please return by
forwarding the message and its attachment to the sender and then delete
the message and its attachment from your computer.

Neither Fiscal Systems, Inc., nor its affiliates, accept any liability
for any errors, omissions, corruption or virus in the contents of this
message or any attachments that arise as a result of e-mail transmission./



Emilian Nowak wrote:
> Hello,
> I'm trying to grab key press event inside Gtk::Window
> I made a signal handler for signal_key_press_event(), but this signal is
> emitted when I press keys != (arrow keys).
> 
> I have attached simple test case for that. I was running it on gtkmm 2.8.8 and
> pressing arrow key does nothing. I was expecting it to print "key pressed",
> but something must be wrong here. 
> What is correct way to catch such key pressed events?
> 
> 
> ------------------------------------------------------------------------
> 
> #include <gtkmm.h>
> #include <iostream>
> 
> bool key_pressed_callback(GdkEventKey *ek) {
> 	std::cout << "key pressed" << std::endl;
> 	return true;
> }
> 
> int main(int argc, char *argv[]) {
> 	Gtk::Main app(&argc, &argv);
> 
> 	Gtk::Window win;
> 	win.signal_key_press_event().connect(sigc::ptr_fun(&key_pressed_callback));
> 	app.run(win);
> 
> 	return 0;
> }
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFE6ZtzuCj6XIbb5UIRAmM7AJ96dfa+GpSb1FRQGW4Tiaa4YHf1LQCdGgAu
RHUfnK5ndVR9J4ET5ue4MxI=
=chs6
-----END PGP SIGNATURE-----
begin:vcard
fn:Robert Caryl
n:Caryl;Robert
org:Fiscal Systems, Inc.
adr:;;102 Commerce Circle;Madison;AL;35758;USA
email;internet:bob fis-cal com
title:Senior Software Design Engineer
tel;work:356-772-8920 X108
x-mozilla-html:TRUE
url:http://www.fis-cal.com
version:2.1
end:vcard



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