3

How do I create a button using wxWidgets that has both a label(text) and an image or icon. If I select wxBitmapButton there is a field called "label". But whenever I write anything in that field it doesn't update code in the wxFormBuilder. I have also tried wxButton->SetLabel() but no luck.

Any help or suggestions would be appreciated.

YahooMania
  • 115
  • 4
  • 15

1 Answers1

5

You can only do this in wxWidgets 2.9.1 or greater and can use either a wxBitmapButton or wxButton. To quote from the documentation:

Since version 2.9.1 wxButton supports showing both text and an image (currently only when using wxMSW, wxGTK or wxOSX/Cocoa ports), see SetBitmap() and SetBitmapLabel(), SetBitmapDisabled() methods. In the previous wxWidgets versions this functionality was only available in (the now trivial) wxBitmapButton class which was only capable of showing an image without text.

SteveL
  • 1,811
  • 1
  • 13
  • 23
  • Upgrading to the wx2.9 series does get you quite a lot of improvements. If you need a work around you could always add the text to your image... – SteveL Jan 24 '13 at 20:36
  • Yea I think its better if I just upgrade, better for the long run. Thanks for your help! Should I mark this as the accepted answer? – YahooMania Jan 24 '13 at 21:01
  • 1
    Given that it seems to have answered your question it would be nice :) – SteveL Jan 25 '13 at 08:24