Print Page | Close Window

Proper way to subclass CXTPToolBar with member var

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=19571
Printed Date: 29 April 2024 at 11:03am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Proper way to subclass CXTPToolBar with member var
Posted By: cuisinart
Subject: Proper way to subclass CXTPToolBar with member var
Date Posted: 12 March 2012 at 2:44pm

 Hello, I have created a subclassed toolbar that adds its own CXTPControls in its OnCreate section, in order to keep this tidy and somewhat separate from MainFrm (no message processing in MainFrm from this toolbar).  It stores pointers to its controls as member variables, and handles LButtonDown clicks and HScrolls from user input.  Also, it's dyn declared with the macros DECLARE_XTP_COMMANDBAR and IMPLEMENT_XTP_COMMANDBAR as mentioned on this forum.

    All seems to go well, except when loading toolbar states, the codejock framework somehow duplicates and destroys the created controls that the member variables point to.  I read on the forum that the Copy member function needs to be over-ridden, so I did this but it is never called.

 For now, my solution has been to remove all controls and re-create them after the toolbar state has been loaded, so the controls are valid and the toolbar position is loaded from the last state.  However this isn't optimal..

  What is the proper way to subclass a self-contained CXTPToolBar with new member variables (pointers to its self-created controls) without adding a bunch of message handlers to CMainFrame?



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