wxNO_BORDER - no effect on wxbutton (msw)

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
coolnicklas
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Aug 10, 2006 11:05 am

wxNO_BORDER - no effect on wxbutton (msw)

Post by coolnicklas » Sat Apr 07, 2007 1:21 pm

Hi I'm trying to put a flat wxButton in a panel (using a sizer), using the style flag "wxNO_BORDER", but that flag seems to have no effect.

I 'tried to create a wxBitmapButton with the same flag, and the button became flat.

Am I doing something wrong?

Code: Select all

m_nameButton = new wxButton(this, ID_BUDDY_NAME, m_name, wxDefaultPosition, wxSize(10, 20), wxNO_BORDER);

sizer->Add(m_nameButton, wxSizerFlags(1).Left());
Picture of result is provided...
Thanks in advance
/Nicklas
Attachments
noflatbuttons.png
noflatbuttons.png (6.96 KiB) Viewed 1229 times
Software Developer

lowjoel
Moderator
Moderator
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel » Sat Apr 07, 2007 1:38 pm

According to http://www.lpthe.jussieu.fr/~zeitlin/wx ... utton.html it should work. File a bug report on SourceForge?

Joel

coolnicklas
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Aug 10, 2006 11:05 am

Post by coolnicklas » Sat Apr 07, 2007 4:48 pm

Hi Joel,
I'm working on my laptop now, which is running wxwidgets 2.6.3. I will compile this code on my other computer running wxwidgets 2.8.0, if the problem persists i will file a bug report.

/Nicklas
Software Developer

nlevisrael
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Jan 08, 2008 10:31 pm

I have similar troubles

Post by nlevisrael » Fri Jan 11, 2008 3:40 am

I'd love some further response on this thread, because I have the same question. I can prevent a border being drawn by using a bitmap button and deliberately not including "wxBU_AUTODRAW" in the constructor, but this means I will have to create a bunch of separate but similar bitmap images, when all I want is a few "flat" buttons, with labels but no border. There a post at http://lists.wxwidgets.org/archive/wx-u ... 32428.html from 2003, of somehow who evidently wanted something similar, but it got only two replies (someone suggested using a toolbar with one lone button, but that seems awfully hackish). Another post in a different thread seemed to imply that wxBORDER_NONE worked differently than wxNO_BORDER, but as far as I can tell the latter is just a macro which expands to the former, and neither have the desired effect. The only thing I can think of is that I lack proper understanding of how themes work and that the default theme is drawing a border and overriding wxNO_BORDER style. Any suggestions? "Flat" buttons are pretty useful, and it's a shame if wxWidgets makes them hard to achieve. (For what it's worth, they're easy with Windows Forms.)
(using MSW, VC++ '05, 2.8.7)

Post Reply