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 » Menu question Collapse All
Subject Author Date
Gevork Odabashyan Sep 10, 2004 - 7:34 AM

Hello...


The two methods CMainFrame have been shown in your samples : OnBarCheck and OnUpdateControlBarMenu. The current samples version has implementation like this:


void CMainFrame::OnUpdateControlBarMenu(CCmdUI* pCmdUI)
{
// CFrameWnd::OnUpdateControlBarMenu( pCmdUI );
 CExtControlBar::DoFrameBarCheckUpdate(
  this,
  pCmdUI,
  false
  );
}


BOOL CMainFrame::OnBarCheck(UINT nID)
{
// return CFrameWnd::OnBarCheck( nID );
 return
  CExtControlBar::DoFrameBarCheckCmd(
   this,
   nID,
   false
   );
}


As far as I understand this, there are two variants of the implementation for this methods. CExtControlBar-based implementation complies the VS.NET-like control bars.


First, as mentioned in Your help, in this case "no check marks and are only used to activate resizable control bars". But tooltips for this control bars are still "Show / hide xxx-bar". Can You correct this little mismatch?


The second is menu question from my email to Your support. My dynamic control bars are are fixed-size control bars, derived from CExtPanelControlBar. I don’t want to use registered icons for them. All I want is checked/unchecked icons such as "status bar" command have. What I need to do for that?


Ruslan.


 

Technical Support Sep 13, 2004 - 11:52 AM

Indeed if the auto-hide feature (with respect to the resizable control bars) is used in your app, then appropriate commands always display these bars and their visibility cannot be controlled. We will fix this in the next Prof-UIS release. If this problem is critical for you right now, we will provide you with the update in a few days.

As for the second question, if you allocate the command identifiers for your dynamic control bars in the command manager and do not assign icons to these commands, only check-marks will be displayed, which is exactly what you need. Please provide us with more details on how you implemented dynamic panel bars in your app or let us take a look at your source code.

Gevork Odabashyan Sep 14, 2004 - 4:35 AM

Ok, tell me please when the menthoned release will be chiped?


Here are some parts of source code about second problem:


Suppose that


class CMainFrame : public CMDIFrameWnd
{


...
  typedef map <LONG, CExtPanelControlBar*> CDealControlBars;


 CDealControlBars     m_mapCP2DealDockedWnds;


...
};



This method creates dynamic control bars and corresponding commands from registry’s data:


void CMainFrame::LoadNonMDIDealWndsState(const CString& strLogin)
{
 if (!strLogin.IsEmpty())
 {
  try
  {
   CMemFile file;
   CTTApp* pApp = static_cast<CTTApp*>(AfxGetApp());
   CString strRegKeyPath = ...


   if (CExtCmdManager::FileObjFromRegistry(file, strRegKeyPath))
   {
    CArchive ar(&file, CArchive::load);


    int nCount = 0;
    ar >> nCount;


    LONG nCPID = 0;
    UINT nChildID = 0;
    CString strDealWnd((LPCSTR)IDS_DEAL_WINDOW);


    for (int i = 0; i < nCount; ++i)
    {
     ar >> nCPID;
     ar >> nChildID;


     CString caption;


     CExtPanelControlBar* pControlBar = new CExtPanelControlBar;
     pControlBar->m_bAutoDelete = TRUE;
     if( !pControlBar->Create(
       caption,
       this,
       nChildID,
       WS_CHILD
       |CBRS_LEFT|CBRS_GRIPPER|CBRS_TOOLTIPS
       |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
       |CBRS_HIDE_INPLACE|CBRS_FLOAT_MULTI


       )
      )
     {
      CString strFormat(_T("CMainFrame::LoadNonMDIDealWndsState: Failed to create deal control bar, CPID is %d"));
      CString strMsg;
      strMsg.Format(strFormat, nCPID);
      ReportInternalError(strMsg);
      continue;
     }


     bool bSuccess = false;
     CDealView* pView = (CDealView*)RUNTIME_CLASS(CDealView)->CreateObject();
     if (pView)
     {
      CCreateContext context;
      context.m_pCurrentFrame = NULL;
      context.m_pCurrentDoc = NULL;
      context.m_pNewViewClass = NULL;
      context.m_pNewDocTemplate = NULL;
      context.m_pLastView = NULL;
      if (pView->Create(NULL, NULL, WS_CHILD | WS_VISIBLE, m_rcDealView, pControlBar, AFX_IDW_PANE_FIRST, &context))
      {
       pView->ModifyStyleEx(0, WS_EX_CLIENTEDGE, SWP_FRAMECHANGED | SWP_DRAWFRAME);
       m_mapCP2DealWindow.insert(make_pair(nCPID, pView));
       pView->SetCPID(nCPID);
       pView->Dock();
       bSuccess = true;
      }


     }


     if (bSuccess)
     {
      CExtCmdItem cmdBar;
      cmdBar.m_nCmdID = nChildID;
      cmdBar.m_sMenuText = _T(" - ") + strDealWnd;
      g_CmdManager->CmdSetup(
          __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
          cmdBar,
          true,
          NULL);


      m_mapCP2DealDockedWnds.insert(make_pair(nCPID, pControlBar));
      pControlBar->EnableDocking(CBRS_ALIGN_ANY);
      m_ctrlBarChildIDGenerator.ExcludeValue(nChildID);
     }
     else
     {
      pControlBar->DestroyWindow();
     }


    }
   }
  }
  catch(...)
  {
  }
 }
}



And this method modifies "View" submenu of the main menu:


LRESULT CMainFrame::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam)
{
 CExtPopupMenuWnd::MsgPrepareMenuData_t* pData = reinterpret_cast<CExtPopupMenuWnd::MsgPrepareMenuData_t*>(wParam);
 ASSERT (pData != NULL);
 CExtPopupMenuWnd* pPopup = pData->m_pPopup;
 ASSERT (pPopup != NULL);


 INT nReplacePos = pPopup->ItemFindPosForCmdID(ID_LIST_OF_ALL_BARS);
 if (nReplacePos >= 0)
 {
  VERIFY(pPopup->ItemRemove(nReplacePos));
  if (!m_mapCP2DealDockedWnds.empty())
  {
   if (pPopup->ItemInsert((UINT)CExtPopupMenuWnd::TYPE_SEPARATOR))
   {
    for (CDealControlBars::iterator bar_it = m_mapCP2DealDockedWnds.begin(); bar_it != m_mapCP2DealDockedWnds.end(); ++bar_it)
    {
     pPopup->ItemInsert(bar_it->second->GetDlgCtrlID()))
    }
   }
  }
 }


 return TRUE;
}



What I need to correct? Or You need more source code?

Technical Support Sep 15, 2004 - 7:13 AM

The source code you published here does not contain enough details on how dynamic panel bars are created. Several important things are missing. For example, what is m_ctrlBarChildIDGenerator and how does it work? Could you send us your source code? You may send only CYourApp, CMainFrame, CYourChildFrame, CYourView, CYourDoc classes and the project file. We will remove dependencies from the remained source code manually. This will let us help you much faster.

Gevork Odabashyan Oct 1, 2004 - 5:47 AM

Hello...


I wrote the simple test application to illustrate my problem.
In context of my problem it is identical to our real application, exept UI persistance. But I suppose UI persistance is meaningless in this case.
This is a MDI application with CFormView-based views. I want them to be dockable. I use fixed-sized control bars for this. So tell me please, what’s wrong with check/uncheck icons of dynamic control bars?
I sent the test application on your email.


Thank You, Ruslan.