Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - when the toolbar docking both side, nothing!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

when the toolbar docking both side, nothing!

 Post Reply Post Reply
Author
Message
suchout View Drop Down
Groupie
Groupie


Joined: 29 September 2009
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote suchout Quote  Post ReplyReply Direct Link To This Post Topic: when the toolbar docking both side, nothing!
    Posted: 23 October 2009 at 5:41am

Hi

i developed dynamic toolbar.
 
and, if the toolbar is docking top or bottom ,  buttons are show
 
but toolbar was dragged left or right side, the toolbar is empty,
 
 
i don't know what to do..ㅠㅠ
 
please help me handsom guys~^^
 
 
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: 23 October 2009 at 8:46am
Hi,
 
Show some code where you create it.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
suchout View Drop Down
Groupie
Groupie


Joined: 29 September 2009
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote suchout Quote  Post ReplyReply Direct Link To This Post Posted: 25 October 2009 at 8:23pm

Hi,

< create toolbar >
   m_pToolBar = (CXTPToolBar*)m_pCmdBars->Add(_T("toolbar"), m_aNFInfo->vec_tbInfo.BarPos);
   if (!m_pToolBar || !m_pToolBar->LoadToolBar(IDR_MAINFRAME)) {
       TRACE0("Failed to create toolbar\n");
       return;
   }  
 
  < and clear toolbar >
   int i, nCount;
   for (i = 1; i < pMainCommandBars->GetCount();i++) {  
      m_pToolBar = pMainCommandBars->GetAt(i);    
      nCount = m_pToolBar->GetControlCount();  
      for (int j = 0; j < nCount; j++) {
         m_pToolBar->GetControls()->Remove(0);    
      }
   }
 
 < and dynamic add >
   char *_path, *_image, *_tok;   
   CString *sPath;
   HICON hIcon = NULL;
   HBITMAP hBitmap = NULL;
   CXTPImageManagerIconHandle icoHandle;
       
   m_ToolbarID[0] = WM_USER + m_nUserid;       
   if (strstr(_tok, "ICON")) {
      hIcon = (HICON)LoadImage(NULL, *sPath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
      icoHandle.CopyHandle(CXTPImageManagerIconHandle(hIcon));
   }
   else if(strstr(_tok, "BMP")) {    
       sprintf(_image, "\\%s.bmp", tool_info.image);
       strcat(_path, _image);
       sPath = new CString(_path); 
    
       m_hbmImage = LoadImage(NULL, *sPath, IMAGE_BITMAP, 16, 16, LR_LOADFROMFILE | LR_CREATEDIBSECTION );        
       BITMAP bm = {0};
       ::GetObject(m_hbmImage, sizeof(bm), &bm );
       CBitmap bmpIcon;
       bmpIcon.Attach(m_hbmImage);   
       CSize iconSize(bm.bmWidth, bm.bmHeight);
       HICON hIcon = CXTPTransparentBitmap(bmpIcon).ConvertToIcon();
       icoHandle = hIcon;
   }   
   m_hIcon = icoHandle.GetIcon();
   m_pToolBar->GetControls()->Add(xtpControlCustom, m_ToolbarID[0]); 
   m_pToolBar->GetControl(m_pToolBar->GetControls()->GetCount() - 1)->SetCustomIcon(m_hIcon);   
   m_pToolBar->GetControl(m_pToolBar->GetControls()->GetCount() - 1)->SetTooltip((CString)tool_info._name);
   
 
is there any fault in this code? or ..??
 
thank you
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.141 seconds.