Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Child Frames do not close without ribbon bar Collapse All
Subject Author Date
Burak Petekkaya May 8, 2007 - 7:22 AM

Dear Tech Support,
First of all I want to mention that I did not reply the message under the "asserts while changing theme" thread because my priorities had been changed. But I will write an example for that problem.

Now,
Our program had two options. User can use the program with ribbon bar or without ribbonbar. If the second option had been chosen the program opens with mfc defaults(menus,etc.)
When a child frame had been created in the main frame we can resize or close the childframe properly but when we maximize the childframe the 3 buttons on top(minimize,restore,close) does not work. We can not even catch On_Close message on the childframe? What can the problem be?
Below the creation of the child frame is shown,

int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    try
    {
        if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
            return -1;
    }
    catch(CHaspException ex)
    {
        if (ex.GetExceptionId() != -1)
            AfxMessageBox(ex.GetExceptionMessage());
        return -1;
    }
    // TODO: Add your specialized creation code here
    CMainFrame* pParent = (CMainFrame*) GetMDIFrame();
    if ( this->GetSafeHwnd() != pParent->GetSafeHwnd()
        && this->GetSafeHwnd() != pParent->m_pGustoPanel->GetSafeHwnd()
        && this->GetSafeHwnd() != pParent->m_pOpenWinChildFrame->GetSafeHwnd())
    {
        pParent->m_titleList.AddTail(this);
        pParent->UpdateOpenWindowsList();
    }
    
    return 0;
}

Technical Support May 8, 2007 - 12:06 PM

We need to more details about your project in the non-ribbon mode. Was the ribbon bar created but now it is hidden? What Prof-UIS controls were also created in the frame window? It would be very helpful to look at main frame’s source code or receive a test project from you.

Burak Petekkaya May 9, 2007 - 1:53 AM

here is the main frame oncreate method of our program We do not create ribbon bar when non-ribbon mode had been chosen.

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
        if (CExtNCW < CMDIFrameWnd >::OnCreate(lpCreateStruct) == -1)
            return -1;    

    HICON hIcon = (::AfxGetApp())->LoadIcon(IDB_STANDARDBAR_RIBBON);    
    ASSERT( (::AfxGetApp())->m_pszProfileName != NULL );
    g_CmdManager->ProfileSetup((::AfxGetApp())->m_pszProfileName,GetSafeHwnd());
    if (m_bUseRibbonBar)
VERIFY(g_CmdManager->UpdateFromToolBar((::AfxGetApp())->m_pszProfileName,IDB_STANDARDBAR_RIBBON));    

    CBitmap bm;
    bm.LoadBitmap(IDB_STANDARDBAR_RIBBON);

    m_imageList.Create(16,16,ILC_COLOR24,4,4);    
    m_imageList.Add(&bm,(CBitmap*)NULL);
    
    
    
    if (m_bUseRibbonBar)
    {
        

if(!g_PaintManager.PaintManagerStateLoad("HKEY_CURRENT_USER\\Software","HKEY_CURRENT_USER\\Software\\Liko

m","HKEY_CURRENT_USER\\Software\\Likom\\Anki"))
        {
            g_PaintManager.InstallPaintManager(
            RUNTIME_CLASS(CExtPaintManagerOffice2007_R2_LunaBlue)
            );
        }                
        if(    ! m_wndRibbonBar.Create(NULL, this))
        {
            TRACE0("Failed to create the m_wndRibbonBar toolbar\n");
            return -1; // fail to create
        }        
        SetupUiAdvancedOptions();
        m_wndRibbonBar.InitLikomRibbonBar();            
        
        // it is for adds three additional themes
        m_wndToolBarUiLook.m_bEnableOffice2007r3 = true;
        //
        if(        (! m_wndToolBarUiLook.Create( NULL, this, ID_MENU_GUSTO_UI ) )
            ||    (! m_wndToolBarUiLook.ThemeSwitcherInit() )
            )
        {
            TRACE0("Failed to create the m_wndToolBarUiLook toolbar\n");
            return -1; // fail to create
        }


        m_wndToolBarUiLook.EnableDocking( CBRS_ALIGN_ANY );
        EnableDocking(CBRS_ALIGN_ANY);
        DockControlBar(&m_wndToolBarUiLook,AFX_IDW_DOCKBAR_LEFT);

        if( m_wndMdiTabs.Create( this ) )
            m_wndMdiTabs.OrientationSet( __ETWS_ORIENT_BOTTOM );

        if(    ! m_wndExtToolbar.Create(NULL, this, ID_TOOLBAR2))
        {
            TRACE0("Failed to create the m_wndRibbonToolBar toolbar\n");
            return -1; // fail to create
        }
    

        m_wndExtToolbar.LoadToolBar(IDB_STANDARDBAR_RIBBON);

        m_wndExtToolbar.EnableDocking(CBRS_ALIGN_ANY);
        EnableDocking(CBRS_ALIGN_ANY);    
        DockControlBar(&m_wndExtToolbar,AFX_IDW_DOCKBAR_TOP);                
    }
    else
    {
        if (!m_wndToolBar.Create(this, IDR_MAINFRAME))
        {
            TRACE0("Failed to create toolbar\n");
            return -1; // fail to create
        }

        if (!m_wndToolBar2.Create(this) ||
            !m_wndToolBar2.LoadBitmap(IDB_STANDARDBAR))
        {
            TRACE0("Failed to create toolbar2\n");
            return -1; // fail to create
        }        
    
    }

    // Customize ToolBar create ( NOT WS_VISIBLE )
    if ( !m_CustomToolBar.Create(this, WS_CHILD|CBRS_TOP) )
    {
        TRACE0("Failed to create toolbar\n");
        return -1; // fail to create
    }
    m_CustomToolBar.SetWindowText(LIK_IDS_WINDOWTEXT_KULLANICI_ARAC_CUBUGU);
    m_CustomToolBar.SetBarStyle(m_CustomToolBar.GetBarStyle() |
        CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC | CBRS_ALIGN_ANY);

    m_CustomToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_CustomToolBar,AFX_IDW_DOCKBAR_LEFT);

    
    if (!m_wndStatusBar.Create(this) ||
        !m_wndStatusBar.SetIndicators(indicators,sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1; // fail to create
    }
    
    
    CDC * pDC = GetDC();

    CFont *poldfont = (CFont*)pDC->SelectStockObject(ANSI_VAR_FONT);
    pDC->GetTextMetrics(&tm);
    if (poldfont)
        pDC->SelectObject(poldfont);

    m_dXMultiplier = ((double)tm.tmAveCharWidth+1) / 4;
    m_dYMultiplier = ((double)tm.tmHeight) / 8;
    ReleaseDC (pDC);

    return 0;
}

and here is another important part of mainframe to create menus

BOOL CMainFrame::CreateLoginFirma()
{
    BeginWaitCursor();
    CMenuTanimi *pMenuTanimidb = new CMenuTanimi(&_CriticalSectionDB);
    pMenuTanimidb->m_nPrivateToModul = 1;
    pMenuTanimidb->m_pMenuKullanici = NULL_DBA;
    pMenuTanimidb->m_bSerbestOku = TRUE;

    SetStatusBarText(LIK_IDS_UNKNOWN_41);
    pMenuTanimidb->FillToolBarListWithoutDB(m_ToolbarButtonList);
    pMenuTanimidb->m_nPrivateToModul = 1;

    CProjectAnkiApp *pApp = (CProjectAnkiApp*) AfxGetApp();    

    
    SetStatusBarText(LIK_IDS_UNKNOWN_43);
    pMenuTanimidb->FillMenuList(m_MenuList);
    pMenuTanimidb->m_bSerbestOku = FALSE;
    pMenuTanimidb->m_nPrivateToModul = 0;

    CProjectAnkiApp *app = (CProjectAnkiApp *) AfxGetApp();
    BOOL bRet = TRUE;
    CList<LIKACCEL,LIKACCEL&> listNewAccels;

    //We have our own class for menus because our menus are dynamic. User can add or remove them
    
    if (!m_bUseRibbonBar)
    {        
        CMenu *pMnu = this->GetMenu();
        while ( pMnu->GetMenuItemCount() > 0 )
            if ( !pMnu->DeleteMenu(0,MF_BYPOSITION) )
                AfxMessageBox("DeleteMenu Çalışmadı");        
                    
        CGustoMenu    GustoMenu;
        GustoMenu.Initialize();
        GustoMenu.m_pMainWnd = this;
        GustoMenu.FillMenuler(pMnu->m_hMenu, m_hGustoMenu,m_hGorunumMenu,m_hSeceneklerMenu);
        
        LIKACCEL accel;        
        POSITION pos = GustoMenu.m_listNewAccels.GetHeadPosition();
        while (pos)
        {
            accel = GustoMenu.m_listNewAccels.GetAt(pos);        
            listNewAccels.AddTail(accel);
            GustoMenu.m_listNewAccels.GetNext(pos);
        }
        
        this->DrawMenuBar();
        ASSERT (pMnu->GetMenuItemCount() > 0 );

        
        m_nAccelBeforeGusto =CopyAcceleratorTable(m_hAccelTable,NULL,0)+listNewAccels.GetCount();
        m_nMenuBeforeGusto =m_listExternalPrograms.GetCount();
        m_nAciklamalarBeforeGusto=m_listStdMenuAciklamaImage.GetCount();

                        GustoMenu.FillKullaniciTanimliMenuler(m_hGustoMenu,NULL,app->m_pKullanici,m_listExternalPrograms,listNewAccels,m_bUseRibbonBar);
        
    }
    else
    {
        CGustoMenu    GustoMenu;
        GustoMenu.Initialize();
        GustoMenu.m_pMainWnd = this;
        LIKACCEL accel;        
        POSITION pos = GustoMenu.m_listNewAccels.GetHeadPosition();
        while (pos)
        {
            accel = GustoMenu.m_listNewAccels.GetAt(pos);        
            listNewAccels.AddTail(accel);
            GustoMenu.m_listNewAccels.GetNext(pos);
        }

        
        m_nAccelBeforeGusto =CopyAcceleratorTable(m_hAccelTable,NULL,0)+listNewAccels.GetCount();
        m_nMenuBeforeGusto =m_listExternalPrograms.GetCount();
        m_nAciklamalarBeforeGusto=m_listStdMenuAciklamaImage.GetCount();        
        GustoMenu.FillKullaniciTanimliMenuler(m_hGustoMenu,NULL,app->m_pKullanici,m_listExternalPrograms,listNewAccels,m_bUseRibbonBar);
    }
    EndWaitCursor();
    ...................................

    return TRUE;
}

Technical Support May 10, 2007 - 9:21 AM

Unfortunately we cannot say what is wrong. Would you create a stripped version of your project with UI code only and send it to us?