Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - [SOLVED]Access viloation on CXTPControlGallery
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED]Access viloation on CXTPControlGallery

 Post Reply Post Reply
Author
Message
jhlee.8804 View Drop Down
Newbie
Newbie


Joined: 01 December 2015
Status: Offline
Points: 8
Post Options Post Options   Thanks (1) Thanks(1)   Quote jhlee.8804 Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED]Access viloation on CXTPControlGallery
    Posted: 07 December 2015 at 10:34am
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.
Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 260
Post Options Post Options   Thanks (0) Thanks(0)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post Posted: 22 July 2016 at 9:25am
Hello,

I'm glad to inform you that the issue has been fixed. The fix will be available in the next beta or final release.
(svn revision 17840)

Regards,
Artem Gontarenko
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.156 seconds.