Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Cell Clicked
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Cell Clicked

 Post Reply Post Reply
Author
Message
Maui View Drop Down
Groupie
Groupie


Joined: 10 June 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote Maui Quote  Post ReplyReply Direct Link To This Post Topic: Cell Clicked
    Posted: 04 September 2005 at 9:00am

Hi,

Sorry if this sounds lazy of me but I havent used these controls in about 6 months.

I need to respond to a cell click in the report control but I can't seem to be able to find any events such as RowClicked or CellClicked where I could easily place my code.

Can anyone help me out with what I am sure is a simple question before I go and waste half a day batteling to find an answer.

Thank you.

PS Too bad we dont have a Knowledgebase so that samples like this could be added to it for everyones benifit.



Edited by Maui
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Posted: 04 September 2005 at 4:09pm
You might try using the MouseDown event.  The following code is from the ReportControl sample project:

Private Sub wndReportControl_MouseDown(Button As Integer, Shift As Integer, X As Long, Y As Long)
    Dim hitColumn As ReportColumn
    Dim hitRow As ReportRow
    Dim hitItem As ReportRecordItem
   
    'The MouseDown event is being used to illustrate how the HitTest method can be used.  The HitTest method does not have
    'to be used with a mouse event, it can be used to test any X and Y coordinate on the screen to see if the ReportControl
    'occupies these pixes and what part of the ReportControl is at the specified pixel (Group Box, Row, Item, etc).
    'If it is dertermined that a ReportControl component is at the X and Y coordinates, the HitTest method can return a
    'reference to that component (Column, Row, Record, Item, etc...).
       
    'Determines which part of the ReportControl the mouse was positioned over when clicked.
    Select Case wndReportControl.HitTest(X, Y).ht
        'If MouseDown while positioned anywhere over the Group Box (Even over Column Headers in Group Box)
        Case xtpHitTestGroupBox:
            Debug.Print "MouseDown in Group Box"
        'If MouseDown while positioned anywhere over the ColumnHeader area.  This does NOT include
        'column header in the Group Box
        Case xtpHitTestHeader:
            Debug.Print "MouseDown in Column Header Area (Not in Group Box)"
        'If MouseDown while positioned over the Report Area, this would includ, rows, columns, items, goup rows, expand buttons
        Case xtpHitTestReportArea:
            Debug.Print "MouseDown in Report Area"
        'This case will never happen, Unknown is returned when HitTest is called and the mouse is positioned
        'over an area outside of the report control
        Case xtpHitTestUnknown:
            Debug.Print "Mouse is in an Unknown Area"
    End Select
   
    'Returns a reference to the column cliked
    'Determines which column the mouse is positioned over on MouseDown, this will also be executed
    'if the column header in the Group By box is clicked.  This will be true if any item in the column
    'is clicked, not just column headers.
    Set hitColumn = wndReportControl.HitTest(X, Y).Column
    If Not hitColumn Is Nothing Then
        Debug.Print "MouseDown on Column header: " & hitColumn.Caption
    End If
   
    'Returns a reference to the row clicked
    'Determines which row the mouse was positioned over on mousedown.
    Set hitRow = wndReportControl.HitTest(X, Y).Row
    If Not hitRow Is Nothing Then
        If hitRow.GroupRow Then
            Debug.Print "MouseDown on GroupRow"
        Else
            Debug.Print "MouseDown on Row # " & hitRow.Index
        End If
    End If
   
    'Returns a reference to the item clicked
    'Determines which row the mouse was positioned over on mousedown.
    Set hitItem = wndReportControl.HitTest(X, Y).Item
    If Not hitItem Is Nothing Then
        If Not wndReportControl.PreviewMode Then
            Debug.Print "MouseDown on Item: " & hitItem.Value & " in column: " & hitColumn.Caption
        ElseIf Not (hitRow.Record.PreviewText = "") Then
            Debug.Print "MouseDown on PreviewText"
        End If
    End If
End Sub

Back to Top
Maui View Drop Down
Groupie
Groupie


Joined: 10 June 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote Maui Quote  Post ReplyReply Direct Link To This Post Posted: 06 September 2005 at 5:08am
Thank You.
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.234 seconds.