Gtk::Button and activating it / disabling activation

Hi ruby-gnomists :slight_smile:

If i put a button into a widget, I can move to
it when i use the arrow keys. This is a useful
feature, but not necessarily always.
Is there a way to disable activating a button
with the arrow keys?
It also puts a “raster” around the button when
its activated, and I dont always like to
have this raster.

Attached is sample code, I use Canvas because I originally
had a Canvas field where I moved some icons. When
I did hit cursor_down key, the lower button was
activated though, and this was a bit annoying
to see, thus I later changed my code to use an
EventBox instead of Gtk::Button:

require 'gtk2'
require 'gnomecanvas2'
w=Gtk::Window.new
box=Gtk::VBox.new
box.add Gtk::Label.new('Test')
box.add Gnome::Canvas.new
box.add Gtk::Button.new('Button1')
box.add Gtk::Button.new('Button2')
w.add(box)
w.set_size_request 400,400
w.show_all
Gtk.main


Get your free email from http://www.linuxmail.org

Powered by Outblaze


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

On Tue, Nov 21, 2006 at 08:39:09PM +0100, Roebe XXX wrote:

Hi ruby-gnomists :slight_smile:

Hey!

Responses inline.

If i put a button into a widget, I can move to
it when i use the arrow keys. This is a useful
feature, but not necessarily always.
Is there a way to disable activating a button
with the arrow keys?

You can make the button not able to be focused by setting

button.can_focus = false

It also puts a “raster” around the button when
its activated, and I dont always like to

Do you mean the ‘pressed look’ when the button is clicked?

-pete


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs