User forums > Help

Mapping F10 key doesn't work

(1/2) > >>

schickb:
I am using CB on Ubuntu 8.04 32bit. Mapping keyboard shortcuts to the F keys work for all that I have tried except the F10 key. When I assign that to something (like "next line"), and then hit the F10 key the File menu opens up. Anyone else seen this? I don't think F10 is a special key for gnome.

eranif:
Hi,

I assume that you are trying to map keys to fit the visual studio schema  :wink:

I encoutered this bug in the past in my application, and I ended up adding the following hack in the code:


--- Code: ---//add include file required for the hack
#ifdef __WXGTK20__
#include <gtk-2.0/gtk/gtk.h>
#endif

//add this code somewhere in the frame constructor
#if  defined(__WXGTK20__)
// A rather ugly hack here.  GTK V2 insists that F10 should be the
// accelerator for the menu bar.  We don't want that.  There is
// no sane way to turn this off, but we *can* get the same effect
// by setting the "menu bar accelerator" property to the name of a
// function key that is apparently legal, but doesn't really exist.
// (Or if it does, it certainly isn't a key we use.)
gtk_settings_set_string_property (gtk_settings_get_default (),
                                  "gtk-menu-bar-accel", "F15", "foo");

#endif

--- End code ---

You will also need to update your makefile accordingly:
add to the include path:

--- Code: ---pkg-config --cflags gtk+-2.0
--- End code ---

and to the lib path:

--- Code: ---pkg-config --libs gtk+-2.0
--- End code ---

Works like a charm :)
Eran

schickb:
Thanks, I'll give it a try. Or maybe I'll have to retrain the fingers at some point.

chrisstankevitz:

--- Quote from: eranif on April 25, 2008, 10:32:48 pm ---You will also need to update your makefile accordingly:
add to the include path:

--- Code: ---pkg-config --cflags gtk+-2.0
--- End code ---

--- End quote ---

Hello,

I'm new to makefiles.  Can you tell me how to do this step for the CB configure.in file?  I would like to apply this hack to CB.

Thank you,

Chris

yaoyansi:

--- Quote from: eranif on April 25, 2008, 10:32:48 pm ---Hi,

I assume that you are trying to map keys to fit the visual studio schema  :wink:

I encoutered this bug in the past in my application, and I ended up adding the following hack in the code:


--- Code: ---//add include file required for the hack
#ifdef __WXGTK20__
#include <gtk-2.0/gtk/gtk.h>
#endif

//add this code somewhere in the frame constructor
#if  defined(__WXGTK20__)
// A rather ugly hack here.  GTK V2 insists that F10 should be the
// accelerator for the menu bar.  We don't want that.  There is
// no sane way to turn this off, but we *can* get the same effect
// by setting the "menu bar accelerator" property to the name of a
// function key that is apparently legal, but doesn't really exist.
// (Or if it does, it certainly isn't a key we use.)
gtk_settings_set_string_property (gtk_settings_get_default (),
                                  "gtk-menu-bar-accel", "F15", "foo");

#endif

--- End code ---

You will also need to update your makefile accordingly:
add to the include path:

--- Code: ---pkg-config --cflags gtk+-2.0
--- End code ---

and to the lib path:

--- Code: ---pkg-config --libs gtk+-2.0
--- End code ---

Works like a charm :)
Eran


--- End quote ---

Thanks for your solution. But I'm using the binary installer.
Will this hack code be integrated into C::B?

Navigation

[0] Message Index

[#] Next page

Go to full version