Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - LoadCommandBars and customized button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

LoadCommandBars and customized button

 Post Reply Post Reply
Author
Message
jerry2000 View Drop Down
Newbie
Newbie


Joined: 22 April 2004
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote jerry2000 Quote  Post ReplyReply Direct Link To This Post Topic: LoadCommandBars and customized button
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jerry2000 View Drop Down
Newbie
Newbie


Joined: 22 April 2004
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote jerry2000 Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.