Print Page | Close Window

subclassing CXTPStatusBarThemeOffice203

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=23741
Printed Date: 12 December 2024 at 9:09am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: subclassing CXTPStatusBarThemeOffice203
Posted By: rdhd
Subject: subclassing CXTPStatusBarThemeOffice203
Date Posted: 17 October 2018 at 3:48pm
I want to draw a gripper in the status bar. The CXTPStatusBarThemeOffice2013 DrawStatusBarGripper method does nothing. But, I see the method is virtual. So I subclassed from CXTPStatusBarThemeOffice2013 and implemented code to draw the gripper. CJ calls the method and I have a gripper.

But, my destructor is never called. CJ directly calls new on the CJ CXTPStatusBarThemeOffice2013 class in the paint manager code. And it calls delete too. The destructor in CXTPStatusBarThemeOffice2013 is not virtual so making mine virtual doesn't get the job done - my destructor is never called. I finally resorted to not declaring any instance data in the class and keeping static data around (I draw a transparent bitmap in DrawStatusBarGripper that I create one time).

So why have virtual methods if there is not an easy way to get CJ to use my subclass properly? I had to override SetTheme in our command bars subclass, call the CJ method and then delete m_pPaintManger->m_pStatusBarPaintManager (as it is always CXTPStatusBarThemeOffice2013 instance when the theme is xtpThemeOffice2013) Then I allocate my class and set the m_pStatusBarPaintManager pointer to an instance of my derived class.

The CXTPStatusBarThemeOffice2013 class doesn't do the implement dynamic nor even make the destructor virtual. But, I am assuming that just because I didn't see a more direct route to get my class instance in place doesn't mean there isn't one.

Am I missing something? Or will it take, at the very least, CJ making the destructor for XTPStatusBarThemeOffice2013 virtual? I hesitate to modify the CJ class as that is something I have to track and do with each update.



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