GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Dec 01, 2015 6:19 pm

All times are UTC

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: KeyPressEvent in Gtk#
PostPosted: Thu Feb 16, 2012 7:14 pm 
GTK+ Geek

Joined: Sun Apr 03, 2011 11:12 am
Posts: 63
Hello everyone, I am using Gtk# in C#. But I am facing a problem. I have a Gtk.TextBox. Now I am connecting KeyPressEvent of Gtk.TextBox, using the following code.
TextBox is txtinput

this.txtinput.KeyPressEvent += new KeyPressEventHandler(this.txtinput_key_press_event);

and event handler function is

[GLib.ConnectBefore]void txtinput_key_press_event(object sender, KeyPressEventArgs args)

Now, I want to block certain keys. In GTK+ in C, this keypressevent handler function has return type of gboolean. So, it was easy to block certain keys. But, how this can be achieved in Gtk# in C#. Please Answer!!

 Post subject: Re: KeyPressEvent in Gtk#
PostPosted: Thu Mar 01, 2012 4:24 pm 
Familiar Face

Joined: Sat Feb 04, 2012 12:41 pm
Posts: 10
maybe this can help It is gtk3.2 and uses CSS. I'm not a c/c# programmer and i don't really get what you are doing :)

Quat from link:
GtkBindingSet provides a mechanism for configuring GTK+ key bindings through CSS files. This eases key binding adjustments for application developers as well as users and provides GTK+ users or administrators with high key binding configurability which requires no application or toolkit side changes.

I just read about it and remembered your post. :)

Hope it helps, if not, sorry! :)

 Post subject: Re: KeyPressEvent in Gtk#
PostPosted: Thu Mar 01, 2012 5:52 pm 
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 925
Location: UK

C# does not bind to GTK v3 as of yet. In is only up to GTK v2.12, so is not particularly up to date.

I do not know C# but looking at the documentation KeyPressEventHandler is derived from GLib.SignalArgs. This has a property called RetVal which I presume is what the original poster is after.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC

Who is online

Users browsing this forum: Google Adsense [Bot], Yahoo [Bot] and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group