Hi, I have found a some error when set true to CXTPControlGallery::SetScrollBarAuto.
Here is sample code. (Used in "Codejock/Sample/Ribbon/RibbonControls/MainFrm.cpp")
// Create Inline Gallery if (pTabGallery) { CXTPRibbonGroup* pGroup = pTabGallery->AddGroup(ID_GROUP_INLINE); pGroup->SetControlsCentering(TRUE);
CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->SetControlSize(CSize(192, 60)); pControlGallery->ShowLabels(FALSE); pControlGallery->ShowScrollBar(TRUE); pControlGallery->ShowBorders(TRUE); pControlGallery->SetItems(m_pItemsFontTextColor); pControlGallery->SetScrollBarAuto(TRUE); <<<<<<<<<< I just added one line code !!! pGroup->Add(pControlGallery, ID_GALLERY_STYLES); ... }
// Now ScreenShot Just only one item displayed and occurred Access Violation error when mouse move on gallery control.
// To-be ScreenShot
// CallStack
// Stange Codes I think below codes are strange...
void CXTPControlGallery::RepositionCore(BOOL bCheckScroll) { CRect rcItems = GetItemsRect();
int x = rcItems.left; int y = rcItems.top; BOOL bFirstItem = TRUE;
int nCount = GetItemCount();
// if item count is 10, m_arrRects will be set size too m_arrRects.SetSize(nCount); int nRowHeight = 0;
for (int i = 0 ; i < nCount; i++) { CXTPControlGalleryItem* pItem = GetItem(i); m_arrRects.pItem = pItem; m_arrRects.bBeginRow = FALSE;
if (pItem->IsLabel()) { ... } else { ... } // but breaked when i == 5 ... // m_arrRects[6] ~ m_arrRects[9] are will be null pointer!!! if (bCheckScroll && y + nRowHeight + rcItems.top > rcItems.Height()) { break; } }
y += nRowHeight;
m_nTotalHeight = y - rcItems.top; }
Thanks.
|