# How to Deactivate a button

**URL:** <https://www.ruby-forum.com/t/how-to-deactivate-a-button/116265>\
**Category:** wxRuby\
**Created:** [October 3, 2007, 11:34pm UTC](https://www.ruby-forum.com/t/how-to-deactivate-a-button/116265 "2007-10-03T23:34:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jayson](https://www.ruby-forum.com/u/jayson)\
**Post date:** [October 3, 2007, 11:34pm UTC](https://www.ruby-forum.com/t/how-to-deactivate-a-button/116265/1 "2007-10-03T23:34:12Z")

</div>

How do you make a button inactive, so that it is visible, but it will  
not respond to clicks?

Thanks  
Jayson

---

<div class="post-metadata">

**Author:** ![jayson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jayson](https://www.ruby-forum.com/u/jayson)\
**Post date:** [October 4, 2007, 9:02am UTC](https://www.ruby-forum.com/t/how-to-deactivate-a-button/116265/2 "2007-10-04T09:02:26Z")

</div>

You can use the enable() method that is inherited from Wx::Window.

ex:

button = Wx::Button.new(SOME\_ID,…)  
button.enable(false)

This way of doing it will cause the button to also look disabled. If  
you do not wish for it to look disabled you will have to setup a block  
that does nothing when the event is triggered.

Sean

---

<div class="post-metadata">

**Author:** ![jayson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@jayson](https://www.ruby-forum.com/u/jayson)\
**Post date:** [October 4, 2007, 9:09pm UTC](https://www.ruby-forum.com/t/how-to-deactivate-a-button/116265/3 "2007-10-04T21:09:32Z")

</div>

Thanks Sean
