Print Page | Close Window

Track Control -Double Click On Block

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=19620
Printed Date: 27 November 2024 at 8:39am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Track Control -Double Click On Block
Posted By: wsun
Subject: Track Control -Double Click On Block
Date 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.






Replies:
Posted By: Xander75
Date 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)


Posted By: wsun
Date 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.


Posted By: Xander75
Date 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)


Posted By: Xander75
Date 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 - 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 - 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)


Posted By: diegosoftlord
Date 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


Posted By: wsun
Date Posted: 11 June 2012 at 5:23am
Hi,

Yes, i got it. Thank you very much.



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