Print Page | Close Window

Month Calendar Double Click

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=12703
Printed Date: 17 June 2024 at 3:11am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Month Calendar Double Click
Posted By: tomurphy
Subject: Month Calendar Double Click
Date Posted: 17 November 2008 at 6:54pm
Hi
 
I am using version 12.0.0 and am finding a mouse double click anywhere in the month calendar control calls OnDblClick.  Shouldn't this only be called when double clicking on an actual day??
 
Cheers
Tom
 
CodeJock Com Suite 12.0.0
Visual Dataflex 14.0



Replies:
Posted By: Oleg
Date Posted: 18 November 2008 at 3:53am
Hi,
It works like Calendar Control from Microsoft common controls.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: tomurphy
Date Posted: 18 November 2008 at 5:55am
Thanks for the reply Oleg, I take it that means there's nothing you or I do can do?
 
Cheers
Tom


Posted By: Oleg
Date Posted: 18 November 2008 at 6:26am
yes :(

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jpbro
Date Posted: 18 November 2008 at 1:46pm
I looked around the web to see if I could find any information on MonthView messages, and luckily I discovered one called MCM_HITTEST that looked promising. After a bit of digging & experimentation, I came up with this code that should do what you require (only count the double-click when on a date, or on the Today link):


Option Explicit

Private Type POINTAPI
   x As Long
   y As Long
End Type

Private Type SYSTEMTIME
   wYear As Integer
   wMonth As Integer
   wDayOfWeek As Integer
   wDay As Integer
   wHour As Integer
   wMinute As Integer
   wSecond As Integer
   wMilliseconds As Integer
End Type

Private Type MCHITTESTINFO
   Size As Long
   Point As POINTAPI
   HitItem As Long
   HitDate As SYSTEMTIME
End Type

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long

Private Const MCM_FIRST As Long = &H1000
Private Const MCM_HITTEST As Long = (MCM_FIRST + 14)

Private Const MCHT_CalendarDate As Long = &H20001
Private Const MCHT_CalendarToday As Long = &H30000

Private Sub MonthCalendar1_DblClick()
   Dim l_Pt As POINTAPI
   Dim l_Hit As MCHITTESTINFO
  
   GetCursorPos l_Pt
   ScreenToClient Me.MonthCalendar1.hwnd, l_Pt
  
   With l_Hit
      .Size = LenB(l_Hit)
      .Point.x = l_Pt.x
      .Point.y = l_Pt.y
   End With
   SendMessage Me.MonthCalendar1.hwnd, MCM_HITTEST, 0, l_Hit
  
   Select Case l_Hit.HitItem
   Case MCHT_CalendarDate
      MsgBox "Double-clicked a date on the calendar: " & Format$(Me.MonthCalendar1.Value, "Long Date")
   Case MCHT_CalendarToday
      MsgBox "Double-clicked the ""Today"" link", vbOKOnly
   End Select
End Sub



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

Language: Visual Basic 6.0 SP6



Posted By: tomurphy
Date Posted: 18 November 2008 at 6:23pm
Thanks for that mate I'll give it a go!
 
Cheers,
Tom


Posted By: ijwelch
Date Posted: 18 November 2008 at 8:09pm
Maybe CJ can add HitTest method.


Posted By: tomurphy
Date Posted: 18 November 2008 at 9:24pm
For the 12.1 release?


Posted By: jpbro
Date Posted: 18 November 2008 at 9:29pm
Glad to help tom...

Here's where I found the MonthView constants in case anyone is interested:

http://notmyspace.info/run/Include/DateTimeConstants.au3 - http://notmyspace.info/run/Include/DateTimeConstants.au3


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

Language: Visual Basic 6.0 SP6




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