Yes! Found a ribbon bug! |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 04 October 2010 at 2:30pm |
XTP 13.4.1, Windows 7. I had to struggle a bit to catch this one!
I have a CDateTimeCtrl inside a CXTPControlCustom control.
1) Minimize the ribbon.
2) Click on the datepicker dropdown button. The well-known date-picker popup is shown.
3) Now select a date. WM_LBUTTONDOWN will be captured - and trigger a call to SetPopuped(-1).
Clearly this is wrong! I didn't click what I expect "outside ribbon". What happened here, is that your mouse-hook interpreted this WM_LBUTTONDOWN as a "click in void". We need an extra check somewhere in CXTPMouseManager::PreTranslateMouseEvents.
Here's the error:
if ((nHtCode != HTERROR) && ((nHtCode == HTCLIENT) || ::IsChild(pCommandBar->GetSafeHwnd(), hWndMouse)))
{
hWndMouse equals HTNOWHERE. And the IsChild-call fails due to this:
GetParent(hWndMouse) == "DropDown" <-- bummer!
GetParent("DropDown") == "XTPPopupBar"
Thus, what you need is to iterate upwards, and see if you ever hit that XTPPopupBar window!
Something like this:
BOOL CXTPCommandBar::IsWindowRelated(HWND hWnd)
{
HWND hWndParent = ::GetParent(hWnd);
while (hWndParent)
{
if (hWndParent == m_hWnd)
return TRUE;
hWndParent = ::GetParent(hWndParent);
}
return FALSE;
}
if ((nHtCode != HTERROR) && ((nHtCode == HTCLIENT) || pCommandBar->IsWindowRelated(hWndMouse))))
{
Please provide a fix a la codejock style so that I can update my source code a.s.a.p!
Thanks! |
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Oleg, do you follow me on this one? Or do you need a sample?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Can you please fix this?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Thanks finally fixed. Actually you made very good reserch and we did it with your way: BOOL CXTPMouseManager::IsRelated(HWND hWndParent, HWND hWnd) const { while (hWnd) { if (hWnd == hWndParent) return TRUE; hWnd = ::GetParent(hWnd); } return FALSE; } ... if ((nHtCode != HTERROR) && ((nHtCode == HTCLIENT) || ::IsChild(pCommandBar->GetSafeHwnd(), hWndMouse) || IsRelated(pCommandBar->GetSafeHwnd(), hWndMouse)))
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
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 |