Print Page | Close Window

LoadCommandBars and customized button

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=3991
Printed Date: 06 October 2024 at 5:23am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: LoadCommandBars and customized button
Posted By: jerry2000
Subject: LoadCommandBars and customized button
Date Posted: 12 April 2006 at 6:13am
I have some problems with LoadCommandBars and my own XTPControlButton's.

I my own class CControlVarMenu derived from CXTPControlButton. In  OnCreateControl I create my objects:

if(lpCreateControl->nID == ID_POPUP_SEND)
{
lpCreateControl->pControl = new CControlVarMenu(&m_MenuEntries, VM_SEND);
return TRUE;
}

You see the 2 parameters in the constructor.

All work very well until the user makes a customization of the toolbar. After
LoadCommandBars the constructor of my objects is now called with NULL in the
parameter (without calling OnCreateControl).
When the button on the toolbar is pressed, the member variables of my button
objects are not set!

What is the correct way to set the member variables of my CXTPControlButton
object after a LoadCommandBars?

thank you



Replies:
Posted By: Oleg
Date Posted: 12 April 2006 at 7:42am

 

Hello, you have to override void DoPropExchange and Copy methods and implement save/restore logic for your control.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jerry2000
Date Posted: 13 April 2006 at 4:39am
Hi, thx for help

I Have already overwritten the Copy method.

The DoPropExchange method is not interresing for me, because i have no static information to store. I have only dynamical information (for example in the posted source: "m_MenuEntries" is a collection of objects of inserted USB sticks).

Should i go through the tollbar buttons, and set the members with a new function?



Posted By: Oleg
Date Posted: 13 April 2006 at 7:58am

Hello,

If m_MenuEntries is dynamic menu, you can fill items before user popup menu with these items.

See source of Samples\CommandBars\DynamicPopups\ControlUndo.cpp how to fill items dynamically before they become visible.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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