Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - How to enable Scrollbar in Ribbon Bar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to enable Scrollbar in Ribbon Bar

 Post Reply Post Reply
Author
Message
lyonwhl View Drop Down
Newbie
Newbie


Joined: 14 August 2008
Location: China
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote lyonwhl Quote  Post ReplyReply Direct Link To This Post Topic: How to enable Scrollbar in Ribbon Bar
    Posted: 10 November 2008 at 4:53am
Hi
I added a gallery which includes dozens of  picture items  into a Ribbon group ,but the scrollbar on the gallery was unable to use. How to enable it, please help me out.
the left one gallery is what I added. The right two are in the samples.
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: 10 November 2008 at 11:31am
Hi,
Show some code.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lyonwhl View Drop Down
Newbie
Newbie


Joined: 14 August 2008
Location: China
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote lyonwhl Quote  Post ReplyReply Direct Link To This Post Posted: 10 November 2008 at 8:03pm
//file: MainFrame.cpp
BOOL CMainFrame::CreateRibbonBar()
{
     --- ---
    CXTPRibbonTab* pTabGallery = pRibbonBar->AddTab(ID_TAB_GALLERIES);
 
//m_pItemsPictures is defined as CXTPControlGalleryItems* m_pItemsPictures  in MainFrame.h;
m_pItemsPictures=CXTPControlGalleryItems::CreateItems(GetCommandBars(),10000);
  m_pItemsPictures->SetItemSize(CSize(60,50));
  for (int nCount=0;nCount<10;++nCount)
  {
   m_pItemsPictures->AddItem(new CGalleryItemThumbnail());
  }
 
CXTPRibbonGroup* pGroup = pTabGallery->AddGroup(ID_GROUP_INLINE);
  pGroup->SetControlsCentering(TRUE);
  
  
  CXTPControlGallery* pPictureGallery=new CXTPControlGallery();
  pPictureGallery->SetControlSize(CSize(200, 60));
  pPictureGallery->SetResizable();
  pPictureGallery->SetItemsMargin(0, 1, 0, 1);
  pPictureGallery->ShowLabels(FALSE);
  pPictureGallery->ShowScrollBar(TRUE);
  pPictureGallery->ShowBorders(TRUE);
  pPictureGallery->SetItems(m_pItemsPictures);
  pGroup->Add(pPictureGallery,10000);
  ---
Back to Top
lyonwhl View Drop Down
Newbie
Newbie


Joined: 14 August 2008
Location: China
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote lyonwhl Quote  Post ReplyReply Direct Link To This Post Posted: 10 November 2008 at 8:07pm

//added by lyonwhl
class CGalleryItemThumbnail : public CXTPControlGalleryItem
{
public:
 CGalleryItemThumbnail();
public:
 //static void AddThumbnailItems(CXTPControlGalleryItems* pItems);
public:
 virtual void Draw(CDC* pDC, CXTPControlGallery* pGallery, CRect rcItem, BOOL bEnabled, BOOL bSelected, BOOL bPressed, BOOL bChecked);
private:
 CString m_strPictureFile;

};

 
CGalleryItemThumbnail::CGalleryItemThumbnail()
{
 m_strPictureFile=_T("E:\\pic\\lack.bmp");
}
void CGalleryItemThumbnail::Draw(CDC *pDC, CXTPControlGallery *pGallery, CRect rcItem, BOOL bEnabled, BOOL bSelected, BOOL bPressed, BOOL bChecked)
{
 CXTPPaintManager* pPaintManager = pGallery->GetPaintManager();
 pPaintManager->DrawRectangle(pDC, rcItem, bSelected, FALSE, bEnabled, bChecked, FALSE, xtpBarTypePopup, xtpBarPopup);
 CWinImage img;
 img.load(m_strPictureFile.GetString());
 RECT rc={rcItem.left,rcItem.top,rcItem.right,rcItem.bottom};
img.draw(pDC->m_hDC,rc);
}
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: 11 November 2008 at 1:17am
Hi,
 
Guess problem that this control is disabled. Add some update handler for control and enable it.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lyonwhl View Drop Down
Newbie
Newbie


Joined: 14 August 2008
Location: China
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote lyonwhl Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2008 at 9:42pm

Hi oleq,

Thank you very much for your advice. I added a message macro,ON_UPDATE_COMMAND_UI(ID_GALLERY_THUMBNAILS,OnEnableButton),then it works.
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.031 seconds.