Ruby Forum wxRuby > Bitmap toggle button

Posted by Ajithkumar Warrier (Guest)
on 22.04.2008 17:46
(Received via mailing list)
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
Posted by Alex Fenton (Guest)
on 22.04.2008 18:39
(Received via mailing list)
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
Posted by Alex Fenton (Guest)
on 22.04.2008 18:41
(Received via mailing list)
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

a
Posted by Ajithkumar Warrier (Guest)
on 22.04.2008 19:08
(Received via mailing list)
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.