GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Sep 21, 2014 2:09 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 
Offline
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

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


and event handler function is
Code:

[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!!


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

Joined: Sat Feb 04, 2012 12:41 pm
Posts: 10
Hi,
maybe this can help http://developer.gnome.org/gtk3/3.2/gtk3-Bindings.html 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:
Quote:
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! :)


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

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

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.

_________________
E.


Top
 Profile  
 
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: No registered users and 3 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