Print Page | Close Window

tear-off custom control

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=7917
Printed Date: 02 October 2024 at 8:13pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: tear-off custom control
Posted By: nostromo
Subject: tear-off custom control
Date 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;
}





Replies:
Posted By: Oleg
Date 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


Posted By: nostromo
Date 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.





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