Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Problem with dynamically created CXTButton
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with dynamically created CXTButton

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 954
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: Problem with dynamically created CXTButton
    Posted: 19 December 2007 at 11:51am
I have the folowing code that creates a CXTButton I am placing on a dialog:
 
pBmpButton->Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, xtpRect, pDlg,1);

pBmpButton->SetWindowText(strText);

pBmpButton->SetTheme(xtThemeOfficeXP);

pBmpButton->SetXButtonStyle(BS_XT_WINXP_COMPAT|BS_XT_HILITEPRESSED);

I then add an icon to the button. The button displays fine.

My problem is that when I move over the button, it does not draw with the orange highlight and pressing does not show the blue highlight. If I remove BS_OWNERDRAW, I get the highlighting but the bitmap never shows up.
 
What do I need to do to get the bitmap, text and highlighting all working together?
 
By the way, as per the sample, I also have this code that simply subclasses an existing button and the highlighting works fine:
 

pNewXTPBtn = new CXTButton();

pNewXTPBtn->SubclassDlgItem(nBtnID, this);

pNewXTPBtn->SetTheme(xtThemeOfficeXP);

pNewXTPBtn->SetXButtonStyle(BS_XT_WINXP_COMPAT|BS_XT_HILITEPRESSED|BS_XT_TWOROWS);

I tried adding BS_XT_TWOROWS in the first case but that has no effect. I have also looked at the existing button for the second case in the resource editor and it only has the child and visible styles set. So other than the first button being created dynamically, I can find nothing that causes the two to display differently when the mouse moves over (or presses) the buttons.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 954
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2007 at 1:41pm
Mea culpa - The button was originally subclassed from CBitmapButton. After subclassing from the CJ button, the message_map was not updated (but message handlers were updated to call the new CJ base class) so the MouseMove message never made it to CJ because the code did not have a mouse move handler.
 
Now that I have chained the class's message map to the CJ one, everything works.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.078 seconds.