Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - [SOLVED] HitTest & Header Problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED] HitTest & Header Problem

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

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED] HitTest & Header Problem
    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


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

Language: Visual Basic 6.0 SP6

Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
tomurphy View Drop Down
Groupie
Groupie
Avatar

Joined: 06 June 2008
Location: Australia
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomurphy Quote  Post ReplyReply Direct Link To This Post 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
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.160 seconds.