Page 1 of 1

Button with both bitmap and text label?

Posted: Tue Nov 22, 2005 10:54 pm
by theosib
Another of my noob questions. I have been trying to search for this on google to no avail. Is there a way to have a button that has both a text label AND a bitmap/icon? I tried creating a wxBitmapButton and then using SetLabel, but all I saw was the bitmap.

Any suggestions?


Posted: Tue Nov 22, 2005 10:58 pm
by sethjackson
I think to do that create a dialog then place the wxBitmapButton on it. Then set the label of the dialog. Or do you want text on the button itself? ... tmapbutton

Posted: Tue Nov 22, 2005 11:54 pm
by lowjoel
im working on the patch for it... I can't release it yet... but you can use Dave fileccia's first ... tid=309863

Posted: Wed Nov 23, 2005 12:04 am
by leio
Meanwhile there are classes out in the wild, such as mmMultiButton from mmwx:

I recall that wxCode might have had something like that too, but not sure if that wasn't some other place...

Posted: Wed Nov 23, 2005 7:57 am
by BlowdyNose

When you don't need to change or query the label on runtime, just write the label you want into the bitmap until the patch is released :twisted: .

- BlowdyNose

Posted: Wed Nov 23, 2005 2:02 pm
by lowjoel
yea, but my patch is for MSW only, sorry ppl. And yes i use a wxWindowDC ;)

Posted: Wed Nov 23, 2005 4:36 pm
by leio
It is extremely trivial to do it in GTK+. No idea about Mac.

Posted: Wed Nov 23, 2005 4:42 pm
by Ksmith22
Could you overload the paint event of the button class to draw the image first and then draw text? I think that would work.

Posted: Wed Nov 23, 2005 4:46 pm
by leio
It will not, unless you are dealing with a wxUniversal port (and then it might not work either), or are lucky on a certain port.