Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Yes! Found a ribbon bug!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Yes! Found a ribbon bug!

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Yes! Found a ribbon bug!
    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/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 22 November 2010 at 6:29am
Can you please fix this?
PokerMemento - http://www.pokermemento.com/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
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.344 seconds.