![]() |
LoadCommandBars and customized button |
Post Reply ![]() |
Author | |
jerry2000 ![]() Newbie ![]() Joined: 22 April 2004 Status: Offline Points: 29 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello, you have to override void DoPropExchange and Copy methods and implement save/restore logic for your control. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jerry2000 ![]() Newbie ![]() Joined: 22 April 2004 Status: Offline Points: 29 |
![]() ![]() ![]() ![]() ![]() |
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? |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |