Print Page | Close Window

[SOLVED] HitTest & Header Problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=18408
Printed Date: 27 November 2024 at 8:35pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED] HitTest & Header Problem
Posted By: jpbro
Subject: [SOLVED] HitTest & Header Problem
Date Posted: 19 May 2011 at 10:38am
Calling HitTest method of ReportControl while the mouse is over a header record returns no column or row information, and ht = xtpHitTestUnknown.

This is the same result as if the mouse is over the scrollbar, or at the blank area of a report. Is there any way to determine if the mouse is over the header area?

Sample: uploads/2676/ReportHitTestHeader.zip - uploads/2676/ReportHitTestHeader.zip




-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6




Replies:
Posted By: ABuenger
Date Posted: 20 May 2011 at 9:32am
Hi,

you're right. HitTest is currently only implemented for the body, but not for the header and footer rows.

Andre



-------------
Codejock support


Posted By: jpbro
Date Posted: 20 May 2011 at 9:55am
Thanks Andre, here's a workaround if anyone needs it:


Private Type RECT
   Left As Long
   Top As Long
   Right As Long
   Bottom As Long
End Type

Private Type POINTAPI
   x As Long
   y As Long
End Type

Private Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32.dll" (ByVal hwnd As Long, ByRef lpPoint As POINTAPI) As Long
Private Declare Function PtInRect Lib "user32.dll" (ByRef lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long

Private Function MouseInHeader() As Boolean
   Dim lt_Pt As POINTAPI
   Dim lt_Rect As RECT
   Dim l_Left As Long, l_Top As Long, l_Right As Long, l_Bottom As Long
   Dim l_Left2 As Long, l_Top2 As Long, l_Right2 As Long, l_Bottom2 As Long
   Dim i As Long
  
   If Me.ReportControl1.HeaderRecords.Count = 0 Then
      Exit Function
   End If
     
   GetCursorPos lt_Pt
   ScreenToClient Me.ReportControl1.hwnd, lt_Pt
  
   With Me.ReportControl1.HeaderRows
      .Row(0).GetRect l_Left, l_Top, l_Right, l_Bottom
      .Row(.Count - 1).GetRect l_Left2, l_Top2, l_Right2, l_Bottom2
   End With
  
   With lt_Rect
      .Left = l_Left
      .Top = l_Top
      .Right = l_Right
      .Bottom = l_Bottom2
   End With

   MouseInHeader = PtInRect(lt_Rect, lt_Pt.x, lt_Pt.y)
End Function


It would be nice if ReportHitTest.ht enums were added for header and footer area though!


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: ABuenger
Date Posted: 23 May 2011 at 12:27pm
Added for next release:

xtpHitTestHeaderRows
xtpHitTestBodyRows (same as xtpHitTestReportArea, I suggest to use the new name)
xtpHitTestFooterRows

Andre



-------------
Codejock support


Posted By: jpbro
Date Posted: 23 May 2011 at 1:00pm
Great, thanks a lot Andre!

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: tomurphy
Date Posted: 07 July 2011 at 9:25pm
Hi
 
Could you also add a hit test on the scrollbar and the scrollbar buttons?
 
Cheers
Tom


-------------
Cheers
Tom



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