Owner drawn button with drop-down menu 
Author Message
 Owner drawn button with drop-down menu

I have an owner drawn button class (CButtonSSL, published
at the Code Project
http://www.*-*-*.com/ ),
which is capable of displaying a drop-down arrow and a
menu.

I have recently discovered that if the parent window of
the button loses focus then when focus is regained the
check state of the menu items is lost, i.e. none of the
menu items are checked any more :(

In the source code the class stores a CMenu member
variable, m_menu. In the call to SetSSLButtonMenu the menu
is initialised with a call to m_menu.LoadMenu passing in
the resource ID of the menu. The menu item check states
are altered in the call to CheckSSLMenuItem which calls
m_menu.CheckMenuItem () passing in the menu ID and the
check state.

In the OnLButtonDown event handler the popup menu is shown
as follows:

  CMenu* pMenu = m_menu.GetSubMenu (0);
  pMenu->TrackPopupMenu (TPM_RIGHTALIGN | TPM_LEFTBUTTON,
x, y, GetParent ());

I have scoured the MSDN and other such resources and get
work out why the menu would be losing it's check states.
Any suggestions?

Kind Regards,

Derek Lakin
Salamander Software Ltd.

http://www.*-*-*.com/ ~salamander.software



Mon, 03 May 2004 22:37:35 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. CComboBox -> DropDown Button owner drawn

2. CComboBox -> DropDown Button owner drawn

3. Drawing Icons On Existing Drop Down Menus

4. Owner draw buttons get extraneous draw item messages

5. Toolbar drop-down menu problem trying to display popup menu (IE Deskbar)

6. Owner Drawn Menus - Iconic Menu Representation

7. Problem with owner-draw menus and items with popup-menu

8. Automatically drop-down menu / update menu

9. Owner Drawn Menus like the start menu

10. MSVC 1.52 button disable with owner draw buttons

11. Owner draw button in replacement of the next/back button in a CPropertySheet in Wizard mode

12. Newbie to owner drawn: Scroll Bars in Owner drawn ListCtrl

 

 
Powered by phpBB® Forum Software