I have a bitmap button in a StaticBoxSizer. I need to toggle the button between two images periodically (based on the status of of a device). To ‘change’ the bitmap button, do I need to detach the button from the sizer, destroy the button, recreate the button with the other bitmap, then add it to the sizer? Or is there a better way?
On Feb 26, 9:07 am, Patrick Tisdale <patrick.tisd...@gmail.com> wrote:
I have a bitmap button in a StaticBoxSizer. I need to toggle the button
between two images periodically (based on the status of of a device). To
'change' the bitmap button, do I need to detach the button from the sizer,
destroy the button, recreate the button with the other bitmap, then add it
to the sizer? Or is there a better way?
Thanks,
Patrick
I think it would be easier to just create two buttons and show/hide
them as needed. Put both in the sizer, hide the one you don't want to
see initially and then when you need to show it, hide the original
button. You may need to call Layout() after the show/hide.
I think it would be easier to just create two buttons and show/hide
them as needed. Put both in the sizer, hide the one you don't want to
see initially and then when you need to show it, hide the original
button. You may need to call Layout() after the show/hide.
couldn't you just call SetBitmap() on the button when you want to change it?
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
I have a bitmap button in a StaticBoxSizer. I need to toggle the button
between two images periodically (based on the status of of a device).
To 'change' the bitmap button, do I need to detach the button from the
sizer, destroy the button, recreate the button with the other bitmap,
then add it to the sizer? Or is there a better way?
I couldn't tell from the docs if that would work or not and didn't
want to spend the time putting together a script to test it.
- Mike
···
On Feb 26, 12:01 pm, Chris Barker <Chris.Bar...@noaa.gov> wrote:
Mike Driscoll wrote:
> I think it would be easier to just create two buttons and show/hide
> them as needed. Put both in the sizer, hide the one you don't want to
> see initially and then when you need to show it, hide the original
> button. You may need to call Layout() after the show/hide.
couldn't you just call SetBitmap() on the button when you want to change it?
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
This works, however I’m having trouble getting it to update. It only updates the bitmap at the next gui event(when I click on another button). I’ve tried button.GetParent().Layout(), but still no update.
BTW, this is a GenBitmapButton.
Thanks,
Patrick
···
On Fri, Feb 26, 2010 at 3:05 PM, Mike Driscoll kyosohma@gmail.com wrote:
This works, however I'm having trouble getting it to update. It only
updates the bitmap at the next gui event(when I click on another button).
I've tried button.GetParent().Layout(), but still no update.
This works, however I’m having trouble getting it to update. It only updates the bitmap at the next gui event(when I click on another button). I’ve tried button.GetParent().Layout(), but still no update.