Re: Space Bar Issue




developer wrote:
Hi List,

On the app I am making, when I press the space bar,
it is treated as a left mouse click on any one of
the gtk2 buttons on the screen at the time, and
even a click on a gtk2 button that used to be on
the screen.

More precisely, the space bar is "activating" the currently focused button. 
It doesn't happen at random, it takes effect on the button with the keyboard
focus.

I don't want the users of my app to change screens
or activate functions by pressing the space bar.
But that's exactly what happens. Pressing the
space bar behaves like left clicking on a button.

This is one of gtk+'s selling points, that it can be driven with the keyboard.
 This is important for systems without a mouse, or with a broken mouse, or for
doing things more quickly than a mouse will allow, for accessibility, etc,
etc.  Recall that the user can cycle through the buttons and entries etc of a
window by hitting the Tab key; i for one make use of this every day to keep
from having to grab the mouse for every little thing.

And I don't even choose which button gets activated.

By default, the first focusable widget in a window is given keyboard focus. 
You can, of course, change this.

You can choose which widget in a window gets keyboard focus:

   $window->set_focus ($widget);

You can choose which widget in a window is the "default", such that when the
user activates the default action for a window (e.g., by pressing enter in a
single-line text entry), this is the widget that gets activated:

   $window->set_default ($widget);

You can choose which response of a dialog is the default:

   $dialog->set_default_response ('ok');


You can prevent a widget from being able to have keyboard focus, although this
is not recommended:

   $widget->can_focus (FALSE);


-- 
muppet <scott at asofyet dot org>




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