#11477: wxButton would be good to align bitmap next to text

1 view
Skip to first unread message

wxTrac

unread,
Nov 24, 2009, 4:58:14 AM11/24/09
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/11477>

#11477: wxButton would be good to align bitmap next to text
-------------------------+--------------------------------------------------
Reporter: pete_b | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: GUI-all | Version: 2.9.0
Keywords: | Blockedby:
Patch: 0 | Blocking:
-------------------------+--------------------------------------------------
wxButton's with a bitmap and a label look odd.

They look a lot better if the bitmap is aligned to the left of the text
and the whole lot is centred inside the button. As happens in Qt.
Maybe this could be offered as an additional alignment mode.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/11477>

wxTrac

unread,
Nov 25, 2009, 9:22:04 AM11/25/09
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:1>

#11477: wxButton would be good to align bitmap next to text

--------------------------+-------------------------------------------------
Reporter: pete_b | Owner:
Type: enhancement | Status: closed


Priority: normal | Milestone:
Component: GUI-all | Version: 2.9.0

Resolution: wontfix | Keywords:
Blockedby: | Patch: 0
Blocking: |
--------------------------+-------------------------------------------------
Changes (by vadz):

* status: new => closed
* resolution: => wontfix


Comment:

I don't know why are they odd (unless you see something different from the
button in the "Button" page of the widgets sample?) but we use the native
XP support for button images so we just follow the native behaviour here
(for XP+, there is no native support for button images in the previous
Windows versions).

IOW I don't think there is anything to change here and no other alignment
modes are supported by Windows.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:1>

wxTrac

unread,
Nov 25, 2009, 12:27:33 PM11/25/09
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:2>

#11477: wxButton would be good to align bitmap next to text

--------------------------+-------------------------------------------------
Reporter: pete_b | Owner:
Type: enhancement | Status: closed


Priority: normal | Milestone:
Component: GUI-all | Version: 2.9.0

Resolution: wontfix | Keywords:
Blockedby: | Patch: 0
Blocking: |
--------------------------+-------------------------------------------------

Comment(by pete_b):

This is on XP.

Attached image shows the difference between the current behaviour and the
aligned behaviour.
I think the bottom version with bitmaps aligned to the button text looks
much better.

Doesn't really matter a huge amount to me as I'm using a 'branch' of
wxButton anyway. But it would be nice not to have to do things this way.

I could probably put together a patch if interested.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:2>

wxTrac

unread,
Nov 25, 2009, 8:43:32 PM11/25/09
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:3>

#11477: wxButton would be good to align bitmap next to text

--------------------------+-------------------------------------------------
Reporter: pete_b | Owner:
Type: enhancement | Status: closed


Priority: normal | Milestone:
Component: GUI-all | Version: 2.9.0

Resolution: wontfix | Keywords:
Blockedby: | Patch: 0
Blocking: |
--------------------------+-------------------------------------------------

Comment(by vadz):

While I might subjectively prefer the "aligned" version too, it's just not
a good criterion for choosing it. wxWidgets wraps native API and provides
native UI. We currently do what XP itself does and unless there is some
way to use the native API to implement the "aligned" variant too I don't
think we are going to do anything about it.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:3>

wxTrac

unread,
Nov 26, 2009, 5:15:11 AM11/26/09
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:4>

#11477: wxButton would be good to align bitmap next to text
--------------------------+-------------------------------------------------
Reporter: pete_b | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: 2.9.0
Resolution: wontfix | Keywords:
Blockedby: | Patch: 0
Blocking: |
--------------------------+-------------------------------------------------

Comment(by pete_b):

Replying to [comment:3 vadz]:
> While I might subjectively prefer the "aligned" version too, it's just
not a good criterion for choosing it. wxWidgets wraps native API and
provides native UI. We currently do what XP itself does and unless there
is some way to use the native API to implement the "aligned" variant too I
don't think we are going to do anything about it.

Ok fair enough - wx should definitely be as native as possible wherever
possible.

However, I don't entirely agree that it shouldn't be possible to do
because the native OS doesn't do the job well enough.

The VCL and Qt draw their buttons in this way because it looks correct.
If I want buttons that look like this in wx, then I have to completely re-
implement wxButton and suffer maintenance wise in the future as my
wxButton implementation will now diverge from wx and the build probably
continually break with new major wx versions. I can live with it but I
feel like having a shower after looking at that bit of code.

Having buttons with and image but no text is not supported by windows 2003
but it is already implemented in wxButton using owner-draw which probably
goes against the 'native only' argument.
Is not using UXTheme and owner draw a native API feature? (By the way,
it's surprising that the current wxButton implementation does not re-use
wxRendererNative in the owner draw routine).

Perhaps the proper solution is to make owner-draw possible for client code
using wxButton? This does not really conflict with the 'native only'
approach of wx.
If this is done then it is simple to derive from wxButton and implement
any custom rendering requirements. In fact, it is almost already possible
by overriding MSWOnDraw (except a style flag would be needed to force
owner draw). For a proper implementation though, MSWOnDraw is a tad
platform specific as owner draw would presumably be possible for wxGeneric
and probably other platforms.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:4>

wxTrac

unread,
Nov 26, 2009, 11:01:28 AM11/26/09
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:5>

#11477: wxButton would be good to align bitmap next to text
--------------------------+-------------------------------------------------
Reporter: pete_b | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: GUI-all | Version: 2.9.0
Resolution: wontfix | Keywords:
Blockedby: | Patch: 0
Blocking: |
--------------------------+-------------------------------------------------

Comment(by vadz):

Implementing support for owner drawing opens a huge can of worms (if we
support it for buttons, why not for the other controls?) and is totally
not portable so I'm very, very reluctant to do it.

I wouldn't prevent people from modifying wxButton under MSW to allow it
but I don't support this and won't do it myself.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/11477#comment:5>
Reply all
Reply to author
Forward
0 new messages