Using set_sensitive on a button

Hi.

I use .set_sensitive on a button.

That button then becomes:

  • non functional (you can’t click on it)
  • greyed out in case it has an image

I am fine with the non-functional part of the button. I don’t want it to
respond on anymore click events.

But, that greyed out part is a problem. The colourful image it has
suddenly is greyish, and that looks ugly.

Is there a way to disable the click functionality of a button otherwise?

Something like …

button.disable_event(:click)

Or something similar?

On Sun, Sep 11, 2011 at 19:42, Marc H.
[email protected] wrote:

suddenly is greyish, and that looks ugly.
You’re in Gtk+ territory again. Please realize that Ruby-GNOME2 is
simply a wrapper around various “GNOME” libraries. All Ruby-GNOME2
does, more or less, is provide data conversion between Ruby types and
C/GLib/Gtk+ types.

That is nice but your statement has not helped much. :frowning:

My goal is to stay within the Ruby world when I try to solve a problem
in the ruby-gtk / ruby-gnome world.

I need this functionality for a ruby-gtk implementation of the game
Mastermind.

On the right side, I display the solution if an event happens.

My current solution is to show the buttons there, but without making
them CLICKABLE.

I am using .set_sensitive for this, which is totally inadequate. The
buttons are greyish suddenly and I CAN NOT SEE THE OLD IMAGE ANYMORE.

So all I really need is the answer to the question how to disable a
button to be clickable.

PS: Plus, we should shape up … the WWW has CSS and Javascript. Those
things start to become really trivial in Javascript.

On Tue, 2011-09-13 at 06:08 +0200, Marc H. wrote:

My current solution is to show the buttons there, but without making
them CLICKABLE.

So all I really need is the answer to the question how to disable a
button to be clickable.

Perhaps one approach would be to not use Gtk buttons at all. You could
simply use a Gtk::Image. You would need to wrap the image in a
Gtk::EventBox in order to get mouse click events - the documentation for
Gt;::Image has an example.

Regards
Grant

On Tue, Sep 13, 2011 at 06:08, Marc H.
[email protected] wrote:

That is nice but your statement has not helped much. :frowning:

Nice? How?

My goal is to stay within the Ruby world when I try to solve a problem
in the ruby-gtk / ruby-gnome world.

My point was that your goals may not be in alignment with the goals of
this list.

So all I really need is the answer to the question how to disable a
button to be clickable.

Again, this list isn’t primarily about answering questions pertaining
to doing things in Gtk+, through Ruby-GNOME2 libraries or otherwise.
I’m not stopping you from asking or anyone answering, but please
realize that there are lists that are better suited for these
questions, for example,
http://mail.gnome.org/mailman/listinfo/gtk-list.

The Ruby-GNOME2 project is extremely strapped for development
resources and I’m sure you wouldn’t want to use up our limited time
when another mailing list may have more resources to spare.

That said, your bug reports are much appreciated and it’s great to see
people using Ruby-GNOME2.

I also see that Grant has provided a possible solution. I hope that
it works for you!