Opened 4 years ago

Closed 10 months ago

#12550 closed defect (fixed)

wxBitmapButton does not draw correctly up button presses when a "selected' image is provided

Reported by: mears Owned by:
Priority: normal Milestone:
Component: wxMSW Version: dev-latest
Keywords: wxBitmapButton bitmap Cc:
Blocked By: Blocking:
Patch: yes

Description

Note: I have only verified that this bug exists under Windows XP.

When a button is selected, the enabled version of the button isn’t cleared (or masked). Instead the original button is seen in the transparent sections of the selected button (seestandard.png and standardPress.png). One other thing to note is that if while the button is pressed, you hold and navigate the cursor of the button and then back of the top of it, it does draw correctly.

http://alkaspace.com/is.php?i=106546&img=standard.jpg
http://alkaspace.com/is.php?i=106547&img=standardPre.jpg

Attachments (6)

Test.py download (931 bytes) - added by mears 4 years ago.
Source file. Had to change the buttons since I don't have the originals at work
goDisabled.png download (3.1 KB) - added by mears 4 years ago.
goPress.png download (5.9 KB) - added by mears 4 years ago.
test-case.patch download (755 bytes) - added by awi 10 months ago.
Patch to reproduce the issue.
goDisabled-c.png download (3.2 KB) - added by awi 10 months ago.
Color bitmap
clear-button-bg.patch download (623 bytes) - added by awi 10 months ago.
Fix (erasing button's background)

Download all attachments as: .zip

Change History (9)

Changed 4 years ago by mears

Source file. Had to change the buttons since I don't have the originals at work

Changed 4 years ago by mears

Changed 4 years ago by mears

comment:1 Changed 4 years ago by vadz

I'd like to know if this problem can still be seen in 2.9.1.

Also, is it reproducible in the widgets sample by chance?

Changed 10 months ago by awi

Patch to reproduce the issue.

Changed 10 months ago by awi

Color bitmap

Changed 10 months ago by awi

Fix (erasing button's background)

comment:2 Changed 10 months ago by awi

  • Keywords wxBitmapButton bitmap added
  • Patch set
  • Version changed from 2.8.11 to dev-latest

Indeed, it seems that bitmap for current state of the button (e.g. selected state) doesn't overwrite previous bitmap. This occurs if the new bitmap has a transparency channel or if it is smaller then the background bitmap. This affects only buttons without borders.
Patch reproducing the issue attached (and also the color bitmap where the issue is more easily to observe).

The effect occurs because for buttons with no borders the background (and previous bitmap) is not erased before the new bitmap is drawn.

Patch attached.

comment:3 Changed 10 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [75664]) Draw the selected bitmap correctly in wxMSW buttons.

Clear the previously drawn bitmap before drawing the new one.

Closes #12550.

Note: See TracTickets for help on using tickets.