Print Page | Close Window

How to enable Scrollbar in Ribbon Bar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=12646
Printed Date: 28 February 2025 at 3:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to enable Scrollbar in Ribbon Bar
Posted By: lyonwhl
Subject: How to enable Scrollbar in Ribbon Bar
Date 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.



Replies:
Posted By: Oleg
Date Posted: 10 November 2008 at 11:31am
Hi,
Show some code.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: lyonwhl
Date 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);
  ---


Posted By: lyonwhl
Date 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);
}


Posted By: Oleg
Date 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


Posted By: lyonwhl
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net