Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Problem with CCustomItemSlider in PropertyGrid.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with CCustomItemSlider in PropertyGrid.

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


Joined: 31 March 2008
Location: Brazil
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ronney Quote  Post ReplyReply Direct Link To This Post Topic: Problem with CCustomItemSlider in PropertyGrid.
    Posted: 08 July 2013 at 2:01pm
Since version 16.1.0 I'm having an issue with CCustomItemSlider, from Property Grid sample: When the user clicks on the bar, it becomes black and It's not possible to drag the slider cursor also. The problem occurs on the sample program also.


al Studio asserts with a message about heap corruption. 
Back to Top
Ronney View Drop Down
Newbie
Newbie


Joined: 31 March 2008
Location: Brazil
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ronney Quote  Post ReplyReply Direct Link To This Post Posted: 08 July 2013 at 4:28pm
I figured out how to use CXTPPropertyGridItem::AddSliderControl(). But it solves the problem partially. The 'black issue' does not appears anymore, but I still cannot drag the cursor.

If I insist dragging, the software crashes, falling in the condition bellow, the same with the PropertyGrid sample program:

Output:

HEAP[playlist.exe]: HEAP: Free Heap block 05CE0D28 modified at 05CE0DF4 after it was freed
Windows has triggered a breakpoint in playlist.exe.

This may be due to a corruption of the heap, which indicates a bug in playlist.exe or any of the DLLs it has loaded.


Callstack:

  ntdll.dll!_RtlpBreakPointHeap@4()  + 0x20 bytes
  ntdll.dll!@RtlpAllocateHeap@24()  + 0x33167 bytes
  ntdll.dll!_RtlAllocateHeap@12()  + 0x11f70 bytes
  ntdll.dll!_RtlDebugAllocateHeap@12()  + 0xcc bytes
  ntdll.dll!@RtlpAllocateHeap@24()  + 0x32ff9 bytes
  ntdll.dll!_RtlAllocateHeap@12()  + 0x11f70 bytes
  user32.dll!_UserRtlAllocMem@4()  + 0x16 bytes
  user32.dll!_MBToWCSEx@24()  + 0x118ce bytes
  user32.dll!_DrawTextExA@24()  + 0x3a bytes
  user32.dll!_DrawTextA@20()  + 0x3d bytes
> Playlist.exe!CDC::DrawTextA(const char * lpszString, int nCount, tagRECT * lpRect, unsigned int nFormat)  Line 596 + 0x15 bytes C++
  Playlist.exe!CXTPPropertyGridPaintManager::FillPropertyGrid(CDC * pDC)  Line 283 + 0x14 bytes C++
  Playlist.exe!CXTPPropertyGrid::OnPaint()  Line 497 C++
  Playlist.exe!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult)  Line 2460 C++
  Playlist.exe!CXTPPropertyGrid::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult)  Line 1615 + 0x13 bytes C++
  Playlist.exe!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam)  Line 2137 + 0x17 bytes C++


Back to Top
Ronney View Drop Down
Newbie
Newbie


Joined: 31 March 2008
Location: Brazil
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ronney Quote  Post ReplyReply Direct Link To This Post Posted: 08 July 2013 at 5:44pm
SOLVED:
Comparing the source code with version 15.3.1, I found the line "m_pGrid->Refresh()" out of place:

void CXTPPropertyGridItem::OnMarkupChanged()
{
// update markup

XTPMarkupReleaseElement(m_pMarkupValue);

if (!m_pGrid || !m_pGrid->m_pGrid)
return;

if (m_pGrid->m_pGrid->GetMarkupContext() && GetMarkupTemplate().GetLength())
{
CString final_markup = GetMarkupTemplate();
final_markup.Replace(XTP_PG_ITEMVALUE_TO_REPLACE_IN_MARKUP, GetValue());

m_pMarkupValue = XTPMarkupParseText(m_pGrid->m_pGrid->GetMarkupContext(), final_markup);
}

m_pGrid->Refresh(); // to force call MeasureItem, markup should be changed
}


Previously it was inside the last 'if':

void CXTPPropertyGridItem::OnMarkupChanged()
{
// update markup

XTPMarkupReleaseElement(m_pMarkupValue);

if (!m_pGrid || !m_pGrid->m_pGrid)
return;

if (m_pGrid->m_pGrid->GetMarkupContext() && GetMarkupTemplate().GetLength())
{
CString final_markup = GetMarkupTemplate();
final_markup.Replace(XTP_PG_ITEMVALUE_TO_REPLACE_IN_MARKUP, GetValue());

m_pMarkupValue = XTPMarkupParseText(m_pGrid->m_pGrid->GetMarkupContext(), final_markup);

m_pGrid->Refresh(); // to force call MeasureItem, markup should be changed
}
}

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.063 seconds.