Print Page | Close Window

Problem with dynamically created CXTButton

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=9147
Printed Date: 14 November 2025 at 8:14am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problem with dynamically created CXTButton
Posted By: rdhd
Subject: Problem with dynamically created CXTButton
Date 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.



Replies:
Posted By: rdhd
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net