[SOVLED] Bug in CXTPListbox in v16.3.1 |
Post Reply |
Author | |
pjna
Newbie Joined: 30 January 2014 Status: Offline Points: 9 |
Post Options
Thanks(0)
Posted: 04 June 2014 at 9:50am |
I believe I have discovered a bug in the list box control which was not present in the previous version I have been using of the CodeJock library.
To reproduce the bug you can use the built in sample "MarkupSample". Modify the CMarkupSampleDlg::OnInitDialog function to hook up an OnClick handler and add a button to the markup list box as follows: . . . if (m_wndTabControl.GetCurSel() == 0) { AddListItem(_T("<Border BorderThickness='2' BorderBrush='DodgerBlue' Margin='2' Padding='3'><StackPanel Orientation='Horizontal'>") _T("<Border Width='32' Height='32'/>") _T("<Grid><Grid.ColumnDefinitions><ColumnDefinition Width='Auto'/><ColumnDefinition Width='*'/></Grid.ColumnDefinitions>") _T("<Grid.RowDefinitions><RowDefinition/><RowDefinition/></Grid.RowDefinitions>") _T("<TextBlock TextAlignment='Right' FontWeight='Bold' Foreground='Navy' Text='Description:'/>") _T("<TextBlock TextAlignment='Right' Grid.Row='1' FontWeight='Bold' Foreground='Navy' Text='Current Price:'/>") _T("<TextBlock Margin='6, 0, 0, 0' Grid.Column='1' Text='Digital camera'> <Hyperlink Tag='camera'>Link</Hyperlink></TextBlock>") _T("<TextBlock Margin='6, 0, 0, 0' Grid.Column='1' Grid.Row='1' Text='$321'/>") //PJ _T("<Button Name='Button1' Margin='2' Cursor='Hand'><TextBlock>Button Test</TextBlock></Button>") //PJ _T("</Grid></StackPanel></Border>")); . . . // Add handlers for hyperlinks m_wndStatic.GetMarkupContext()->AddHandler(CXTPMarkupButton::m_pClickEvent, CreateMarkupClassDelegate(this, &CMarkupSampleDlg::OnHyperlinkClick)); m_wndRadio.GetMarkupContext()->AddHandler(CXTPMarkupHyperlink::m_pClickEvent, CreateMarkupClassDelegate(this, &CMarkupSampleDlg::OnHyperlinkClick)); m_wndCheckBox.GetMarkupContext()->AddHandler(CXTPMarkupHyperlink::m_pClickEvent, CreateMarkupClassDelegate(this, &CMarkupSampleDlg::OnHyperlinkClick)); //PJ //m_wndList.GetMarkupContext()->AddHandler(CXTPMarkupHyperlink::m_pClickEvent, CreateMarkupClassDelegate(this, &CMarkupSampleDlg::OnHyperlinkClick)); m_wndList.GetMarkupContext()->AddHandler(CXTPMarkupButton::m_pClickEvent, CreateMarkupClassDelegate(this, &CMarkupSampleDlg::OnHyperlinkClick)); //PJ . . . What you will observe when you run the sample is that the cursor does not change to the hand icon when you hover over the button in the markup list box. In addition the OnClick handler is never called when you attempt to click on the button in the markup list box. I have confirmed that by making the same changes to MarkupSample in Xtreme ToolkitPro v16.2.3 which I also have installed locally that the problem does not occur. Tracing through the code I believe I have found the bug occurs because of changes introduced in CXTPListBox in v16.3.1 through the introduction of this new method: BOOL CXTPListBox::TryItemFromPoint(CPoint pt, BOOL& bOutside, int& nIndex) const { BOOL bFound = FALSE; int nCount = GetCount(); if (0 < nCount) { nIndex = ItemFromPoint(pt, bOutside); if (!(0 <= nIndex && nIndex < nCount)) { nIndex = -1; } } else { nIndex = -1; } return bFound; } The variable "bFound" is never used in this method meaning that the function always returns FALSE which means that CXTPListBox::OnMouseMove effectively does nothing: void CXTPListBox::OnMouseMove(UINT nFlags, CPoint point) { CListBox::OnMouseMove(nFlags, point); /* if (m_nStyle != xtpListBoxOffice2007) return; */ BOOL bOutside = FALSE; int nHotItem = 0; //PJ The following chunk of code will never execute in v16.3.1 because of a bug in TryItemFromPoint if (TryItemFromPoint(point, bOutside, nHotItem)) { if (bOutside) nHotItem = -1; if (nHotItem != m_nHotItem) { m_nHotItem = nHotItem; Invalidate(FALSE); if (m_nHotItem != -1) { TRACKMOUSEEVENT tme = { sizeof(TRACKMOUSEEVENT), TME_LEAVE, m_hWnd, HOVER_DEFAULT }; _TrackMouseEvent(&tme); } } } } I believe the fix should be to modify TryItemFromPoint as follows: BOOL CXTPListBox::TryItemFromPoint(CPoint pt, BOOL& bOutside, int& nIndex) const { BOOL bFound = FALSE; int nCount = GetCount(); if (0 < nCount) { nIndex = ItemFromPoint(pt, bOutside); if (!(0 <= nIndex && nIndex < nCount)) { nIndex = -1; } } else { nIndex = -1; } //BUG BUG Bug fix by PJ bFound = (nIndex != -1); return bFound; } I would appreciate you confirming that this is an real issue in v16.3.1, if my temporary fix is correct and also when there will be an official fix for this? PJ Naughter |
|
sdancer75
Groupie Joined: 08 July 2008 Location: Greece Status: Offline Points: 70 |
Post Options
Thanks(0)
|
Hi,
m_wndList.GetMarkupContext()->AddHandler(CXTPMarkupButton::m_pClickEvent, CreateMarkupClassDelegate(this, &CMarkupSampleDlg::OnHyperlinkClick)); The CXTPMarkupListBox does not support the GetMarkupContect(), so how the heck did you compiled the sample and you found a bug ? Regards, |
|
Just me!
|
|
mcmastl
Admin Group Joined: 14 April 2015 Status: Offline Points: 79 |
Post Options
Thanks(0)
|
Hello and thank you for letting us know of this issue. We have brought this up to the development team and will be looking into it. If this issue has been resolved please let us know.
|
|
Luke McMasters, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
agontarenko
Admin Group Joined: 25 March 2016 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Hello, I'm glad to inform you that the issue has been addressed and fixed. The fix is already available in current version.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |