Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Track Control -Double Click On Block
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Track Control -Double Click On Block

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


Joined: 11 January 2012
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote wsun Quote  Post ReplyReply Direct Link To This Post Topic: Track Control -Double Click On Block
    Posted: 29 March 2012 at 12:07am
Hi,
Got anyone how to show a message box when double click on block? Hope someone can help me.



Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2012 at 10:56am
Hi,

This might not be the best way but it works as a workaround for your needs:

' Add this code to a module
Private Declare Function GetDoubleClickTime Lib "user32.dll" () As Long
Private Click As String
Private DblClick As String

Public Function ReportControlDblClick() As Boolean
    If Trim$(Click) = vbNullString Then
        Click = Format$(Date, "yyyymmdd") & Format$(Time, "hhnnss") & Right(Format(Timer, "#0.000"), 3)
    Else
        DblClick = Format$(Date, "yyyymmdd") & Format$(Time, "hhnnss") & Right(Format(Timer, "#0.000"), 3)

        If DblClick - Click < GetDoubleClickTime Then
            ReportControlDblClick = True
            Click = vbNullString
            DblClick = vbNullString
        Else
            Click = Format$(Date, "yyyymmdd") & Format$(Time, "hhnnss") & Right(Format(Timer, "#0.000"), 3)
        End If
        Exit Function
    End If
   
    ReportControlDblClick = False
End Function

Next add the following code to the ReportControl:

Private Sub rpcGrid_MouseDown(Button As Integer, Shift As Integer, x As Long, y As Long)   
    If Button = vbLeftButton Then
        Dim Row As ReportRow
        Set Row = rpcGrid.HitTest(x, y).Row
            Row.Selected = True
    End If
End Sub

Private Sub rpcGrid_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)
    If Button = vbLeftButton Then
        If ReportControlDblClick Then
            Select Case rpcGrid.HitTest(x, y).ht
                Case xtpHitTestBlock
                    MsgBox rpcGrid.HitTest(x, y).Block.Caption
            End Select
        End If
    End If
End Sub

Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
wsun View Drop Down
Groupie
Groupie


Joined: 11 January 2012
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote wsun Quote  Post ReplyReply Direct Link To This Post Posted: 15 April 2012 at 10:30pm
Hi, 
I'm using Xtreme SuitePro ActiveX v15.0.1. It is not work for me when clicking on the block and it didn't run the MouseDown event.
I hope that can get some advise from all of you.

Thank you.
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 23 April 2012 at 3:44am
Hi,

Sorry for the delay in getting back to you. It looks like the MouseUp event doesn't fire if you have the .AllowBlockMove = True, setting this to False allows this to work.

In my project I use the TrackControl for display purposes only, therefore I have this set to False.
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2012 at 2:15pm
Hi,

I have had another look at the DblClick event as the method I posted wasn't that reliable.

I have found some code on these forums (I can't remember which post!) and built upon the code to create a class that adds the missing DblClick event, however doing so swallows the RowDblClick so I have had to extend the RowDblClick event too.

Here's the code: uploads/2960/cExtender.rar

How to use...

Before adding any code you must first have the SSubTimer6.dll file downloaded on your computer. This can be found on vbaccelerator at: http://www.vbaccelerator.com/home/VB/Code/Libraries/Subclassing/SSubTimer/article.asp

Step 1:
' Add the cExtender.cls to the Project then create a reference using WithEvents in the General Declarations area of the Form with the TrackControl
Dim WithEvents cExtender As cExtender

Step 2:
' Add the following code to the Form Load event
Set cExtender = New cExtender
Call cExtender.Extend(TrackControl)   ' <<< TrackControl is the name of your TrackControl

Step 3:
' Add the following code to the Form Unload event
Call cExtender.ExtendComplete(TrackControl)   ' <<< TrackControl is the name of your TrackControl

Step 4:
' You now have a DblClick event for the Block, Column & Row for Left, Middle & Right Mouse Buttons
Private Sub cExtender_BlockDblClick(Button As Integer, ByVal Block As XtremeReportControl.TrackBlock)
    Debug.Print "BlockDblClick"
End Sub

Private Sub cExtender_ColumnDblClick(Button As Integer, ByVal Column As XtremeReportControl.IReportColumn)
    Debug.Print "ColumnDblClick"
End Sub

Private Sub cExtender_RowDblClick(Button As Integer, ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem)
    Debug.Print "RowDblClick"
End Sub

Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
diegosoftlord View Drop Down
Newbie
Newbie
Avatar

Joined: 24 May 2012
Location: Resistencia
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote diegosoftlord Quote  Post ReplyReply Direct Link To This Post Posted: 24 May 2012 at 9:32am
Hi! 

        ! i'm new in the Post.- 

          You can show some example for change the label time with date format.- 
Because i Could not get it yet .-

          Thank You Very Much 
Diego Ramos
Back to Top
wsun View Drop Down
Groupie
Groupie


Joined: 11 January 2012
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote wsun Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2012 at 5:23am
Hi,

Yes, i got it. Thank you very much.
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.188 seconds.