# Bitmap toggle button

**URL:** <https://www.ruby-forum.com/t/bitmap-toggle-button/135492>\
**Category:** wxRuby\
**Created:** [April 22, 2008, 5:46pm UTC](https://www.ruby-forum.com/t/bitmap-toggle-button/135492 "2008-04-22T17:46:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ajithkumar\_Warrier](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e99b99/32.png) [@Ajithkumar\_Warrier](https://www.ruby-forum.com/u/Ajithkumar_Warrier)\
**Post date:** [April 22, 2008, 5:46pm UTC](https://www.ruby-forum.com/t/bitmap-toggle-button/135492/1 "2008-04-22T17:46:37Z")

</div>

Hi,

How do I make a bitmap toggle button? I tried making a toggle button  
and then drawing onto it, but that didn’t work. Also, I tried a bitmap  
button but that wouldn’t remain pressed like a toggle button.

Thanks for any help,

warrior

---

<div class="post-metadata">

**Author:** ![Ajithkumar\_Warrier](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e99b99/32.png) [@Ajithkumar\_Warrier](https://www.ruby-forum.com/u/Ajithkumar_Warrier)\
**Post date:** [April 22, 2008, 6:39pm UTC](https://www.ruby-forum.com/t/bitmap-toggle-button/135492/2 "2008-04-22T18:39:05Z")

</div>

Ajithkumar Warrier wrote:

> How do I make a bitmap toggle button? I tried making a toggle button  
> and then drawing onto it, but that didn’t work. Also, I tried a bitmap  
> button but that wouldn’t remain pressed like a toggle button.  
> There’s nothing in standard wxRuby and wxWidgets like that, apart from a  
> “toggle” tool in a Wx::ToolBar.

If you search for “wxBitmapButton bitmap” you’ll turn up references to  
several wxWidgets C++ classes that do this. Maybe you could adapt the  
code from one of those to Ruby.

alex

---

<div class="post-metadata">

**Author:** ![Ajithkumar\_Warrier](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e99b99/32.png) [@Ajithkumar\_Warrier](https://www.ruby-forum.com/u/Ajithkumar_Warrier)\
**Post date:** [April 22, 2008, 6:41pm UTC](https://www.ruby-forum.com/t/bitmap-toggle-button/135492/3 "2008-04-22T18:41:27Z")

</div>

Ajithkumar Warrier wrote:

> How do I make a bitmap toggle button? I tried making a toggle button  
> and then drawing onto it, but that didn’t work. Also, I tried a bitmap  
> button but that wouldn’t remain pressed like a toggle button.  
> Also, you might adapt from wxPython’s GenBitmapToggleButton. The python  
> code should be easier to translate into wxRuby.

[http://svn.wxwidgets.org/svn/wx/wxPython/trunk/wx/lib/buttons.py](http://svn.wxwidgets.org/svn/wx/wxPython/trunk/wx/lib/buttons.py)

a

---

<div class="post-metadata">

**Author:** ![Ajithkumar\_Warrier](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e99b99/32.png) [@Ajithkumar\_Warrier](https://www.ruby-forum.com/u/Ajithkumar_Warrier)\
**Post date:** [April 22, 2008, 7:08pm UTC](https://www.ruby-forum.com/t/bitmap-toggle-button/135492/4 "2008-04-22T19:08:06Z")

</div>

Thanks Alex,

wxPython’s GenBitmapToggleButton seems to rely heavily on the toggle  
mixin, and it might require more digging in than I had originally  
intended. I’ll try it later and keep posted.
