Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#11244 closed defect (fixed)

Check menu item bug on Vista

Reported by: malcompl Owned by:
Priority: normal Milestone:
Component: wxMSW Version: stable-latest
Keywords: wxMenu Cc:
Blocked By: Blocking:
Patch: yes

Description

I found bug in menu on Windows Vista.
If we set the bitmaps to check item (bitmap with std or less size), changing status not change the bitmap, because function GetHBitmapForMenu always return HBITMAP for checked bitmap.

I attach small patch ;)

Index: src/msw/menu.cpp
===================================================================
--- src/msw/menu.cpp	(wersja 62133)
+++ src/msw/menu.cpp	(kopia robocza)
@@ -399,7 +399,7 @@
                 pItem->SetBitmap(img, checked);
             }
 
-            return GetHbitmapOf(pItem->GetBitmap());
+            return GetHbitmapOf(pItem->GetBitmap(checked));
         }
     }
 #endif // wxUSE_IMAGE

Attachments (1)

menucheck.patch download (1.6 KB) - added by malcompl 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by malcompl

I updated patch to fix some other problem in checkable menu item with bitmaps.

Please apply this patch to owner-drawn branch too if it's is possible, I would be glad.

Changed 5 years ago by malcompl

comment:2 Changed 5 years ago by VZ

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

(In [62142]) Use checked bitmap for menu items under Vista.

The normal (unchecked) bitmap was always used for the menu items under Vista,
fix this and do use the checked bitmap if needed.

Closes #11244.

comment:3 Changed 5 years ago by malcompl

Thanks for appiled, but what about rest patch, I mean first check if item is checkable and set bitmap before set hbmpItem?

comment:4 Changed 5 years ago by vadz

  • Resolution fixed deleted
  • Status changed from closed to reopened

Sorry, I didn't realize the attached patch was not the same one that you put inline so I just applied the part which I saw manually.

Will check in the rest (into ownerdraw-refactor branch) soon.

comment:5 Changed 5 years ago by VZ

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

(In [62211]) Set up menu bitmaps correctly for checkable items.

We must not set MENUITEMINFO::hbmpItem for the checkable items as it would
then be used for both checked and unchecked state.

Closes #11244.

comment:6 Changed 4 years ago by VZ

(In [63221]) Set up menu bitmaps correctly for checkable items.

We must not set MENUITEMINFO::hbmpItem for the checkable items as it would
then be used for both checked and unchecked state.

Closes #11244.

Note: See TracTickets for help on using tickets.