Print Page | Close Window

Yes! Found a ribbon bug!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=17371
Printed Date: 21 May 2024 at 1:46pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Yes! Found a ribbon bug!
Posted By: znakeeye
Subject: Yes! Found a ribbon bug!
Date 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/



Replies:
Posted By: znakeeye
Date Posted: 08 October 2010 at 3:58pm
Oleg, do you follow me on this one? Or do you need a sample?

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 22 November 2010 at 6:29am
Can you please fix this?

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: Oleg
Date Posted: 22 November 2010 at 8:38am
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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net