News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Mapping F10 key doesn't work

Started by schickb, April 25, 2008, 08:07:50 PM

Previous topic - Next topic

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:


//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


You will also need to update your makefile accordingly:
add to the include path:
pkg-config --cflags gtk+-2.0

and to the lib path:
pkg-config --libs gtk+-2.0

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:
pkg-config --cflags gtk+-2.0

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:


//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


You will also need to update your makefile accordingly:
add to the include path:
pkg-config --cflags gtk+-2.0

and to the lib path:
pkg-config --libs gtk+-2.0

Works like a charm :)
Eran


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

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]