Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - tear-off custom control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

tear-off custom control

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


Joined: 01 September 2007
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote nostromo Quote  Post ReplyReply Direct Link To This Post Topic: tear-off custom control
    Posted: 01 September 2007 at 3:07pm
Hi all,

I'm trying to add a custom control to a popup button, that can be ripped off, like the font color control in the CodeJock example "TearOffPopups ".

However, it doesn't work correctly.
behavior: click on button, see the custom control (a dialog), tear off the bar. Everything is still okay.
Now close the bar, and click the button again.: the button is empty! where did the contents of the custom control go?

Or, tear off the bar, click the button again, now the control shows in the popup (which is ok),  the teared off bar shows a blank space.  The teared off bar stays blank when the popup is closed.

Any ideas how to get this working?
Thanks!


code:
To test, I added a simple dialog to the TearOffPopus project, with style set to "Child","control=true", "no border", added a member to the mainframe, and did the following in OnCreateControl: (replaced the colorpopup with this)

int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
{
    if (lpCreateControl->bToolBar)
    {
        if (lpCreateControl->nID == ID_BUTTON_TEXT && pToolBar->GetBarID() == IDR_MAINFRAME)
        {
            CXTPControlPopup* pPopup = new CXTPControlPopup();

            CXTPPopupBar* pBar = CXTPPopupToolBar::CreatePopupToolBar(GetCommandBars());
            pPopup->SetCommandBar(pBar);

            m_dlgTest.Create(CDlgTest::IDD, this);
            CXTPControlCustom* pControlCustom = CXTPControlCustom::CreateControlCustom( &m_dlgTest );
            pControlCustom->SetFlags(xtpFlagManualUpdate);
            pControlCustom->SetVerticalPositionOption(xtpVerticalShow);
       
            pBar->GetControls()->Add(pControlCustom);
    //    pBar->GetControls()->Add(new CXTPControlColorSelector(), ID_CMD_COLORSET);

            pBar->SetTearOffPopup(_T("Measure Settings"), 1005, 0);
            pBar->EnableCustomization(FALSE);

            pBar->InternalRelease();

            lpCreateControl->pControl = pPopup;

            return TRUE;
        }
    }
    return FALSE;
}


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: 03 September 2007 at 5:44am
Hi,
 
Yes, Custom controls can't be added to tearoff bars. 
I think you understand that its not possible to show _same dialog_ (m_dlgTest )  in 2 windows in same time.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
nostromo View Drop Down
Newbie
Newbie


Joined: 01 September 2007
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote nostromo Quote  Post ReplyReply Direct Link To This Post Posted: 03 September 2007 at 5:09pm
Oleg, it doesn't NEED to be shown in 2 windows at the same time, that's not what I'm asking.  You can't click in 2 windows at the same time. The problem is that it isn't shown in ANY window, after closing the teared-off one.


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.125 seconds.