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 General Discussion » Toolbar Icons are not displaying Collapse All
Subject Author Date
Jon A Jul 13, 2004 - 3:21 AM

Hey all.

I tried your brrof-UI 2.25 and it looked great from the demos. However when i tried to implement the UI into my program using the article provided, the toolbar buttons refused to display. I can select the enabled icons but there is no picture. Is there some code i’m forgetting to add?

Source:


// MainFrm.cpp : implementation of the CMainFrame class
//


#include "stdafx.h"
#include "LP.h"


#include "MainFrm.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#endif



// CMainFrame


IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)


BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
 ON_WM_CREATE()
END_MESSAGE_MAP()


static UINT indicators[] =
{
 ID_SEPARATOR,           // status line indicator
 ID_INDICATOR_CAPS,
 ID_INDICATOR_NUM,
 ID_INDICATOR_SCRL,
};



// CMainFrame construction/destruction


CMainFrame::CMainFrame()
{
 // TODO: add member initialization code here
 g_PaintManager.InstallPaintManager( RUNTIME_CLASS(CExtPaintManagerOffice2003) );
}


CMainFrame::~CMainFrame()
{
}


static UINT g_statBasicCommands[] =
{
 ID_APP_ABOUT,
 ID_APP_EXIT,
 ID_FILE_NEW,
 ID_VIEW_TOOLBAR,
 ID_VIEW_STATUS_BAR,
 ID_EDIT_COPY,
 ID_EDIT_CUT,
 ID_EDIT_PASTE,
 ID_WINDOW_CASCADE,
 ID_WINDOW_TILE_HORZ,
 0, // end of list
};


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


 if (!m_wndMenuBar.Create(
  NULL, // _T("Menu Bar"),
  this
  ))
 {
  TRACE0("Failed to create menubar\n");
  return -1;
 }


 if( !m_wndToolBar.Create(
   _T( "Toolbar name" ),
   this,
   AFX_IDW_TOOLBAR
  )
  || !m_wndToolBar.LoadToolBar( IDR_MAINFRAME )
  )
 {
  TRACE0( "Failed to create toolbar" );
  return -1;
 }


 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
 }
 
 if( !CExtControlBar::FrameEnableDocking(this) )
 {
  ASSERT( FALSE );
  return -1;
 }


 // Enable Docking
 m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);


 // Docking Related
 DockControlBar(&m_wndMenuBar);
 DockControlBar(&m_wndToolBar);


 RecalcLayout();


 return 0;
}


BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
 if( !CMDIFrameWnd::PreCreateWindow(cs) )
  return FALSE;
 // TODO: Modify the Window class or styles here by modifying
 //  the CREATESTRUCT cs


 return TRUE;
}


BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{


 if( m_wndMenuBar.TranslateMainFrameMessage(pMsg) )
  return TRUE;


 return CFrameWnd::PreTranslateMessage(pMsg);
}


// CMainFrame diagnostics


#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
 CMDIFrameWnd::AssertValid();
}


void CMainFrame::Dump(CDumpContext& dc) const
{
 CMDIFrameWnd::Dump(dc);
}


#endif //_DEBUG



// CMainFrame message handlers

Technical Support Jul 13, 2004 - 9:34 AM

Dear Jon,

You forgot to set up command profile information in the command manager. Please compare your CMainFrame::OnCreate method with the similar methods in Prof-UIS samples (SDI, SDIDOCVIEW, MDI, or MDIDOCVIEW). You need to use the following code just before m_wndMenuBar.Create(...) at the beginning of your CMainFrame::OnCreate method:

 g_CmdManager->ProfileSetup(
  pApp->m_pszProfileName,
  GetSafeHwnd()
  );
 VERIFY(
  g_CmdManager->UpdateFromMenu(
   pApp->m_pszProfileName,
   IDR_MAINFRAME
   )
  );

Jon A Jul 14, 2004 - 7:33 AM

I added the above lines of code. Then i ended up with two errors:

LP error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall CExtCmdManager::UpdateFromMenu(wchar_t const *,unsigned int,bool,bool)" (__imp_?UpdateFromMenu@CExtCmdManager@@QAE_NPB_WI_N1@Z) referenced in function "protected: int __thiscall CMainFrame::OnCreate(struct tagCREATESTRUCTW *)" (?OnCreate@CMainFrame@@IAEHPAUtagCREATESTRUCTW@@@Z)

LP error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall CExtCmdManager::ProfileWndAdd(wchar_t const *,struct HWND__ *)" (__imp_?ProfileWndAdd@CExtCmdManager@@QAE_NPB_WPAUHWND__@@@Z) referenced in function "protected: int __thiscall CMainFrame::OnCreate(struct tagCREATESTRUCTW *)" (?OnCreate@CMainFrame@@IAEHPAUtagCREATESTRUCTW@@@Z)

what could be the cause of this problem?

Technical Support Jul 14, 2004 - 8:46 AM

We suppose the problem lies somewhere in your project configuration. May it be that your project uses Prof-UIS version 2.24 or earlier?