DateClick, DateDblClick, DayClick, SelChange Events

Purpose

Occurs when a date or day on the control is clicked or double clicked.

Syntax

Sub MonthView_DateClick([index%], DateClicked As Date)

Sub MonthView_DateDblClick([index%], DateClicked As Date)

Sub MonthView_DayClick([index%], DayOfWeek%)

Sub MonthView_SelChange([index%], StartDate As Date, EndDate As Date)

index:An integer that uniquely identifies a form or control if it's in a form or control array.

Description

The DateClick event and DateDblClick event can be used to respond to the user clicking on a particular date. The DateClicked or DateDblClicked can be used to determine which date was clicked. Note: As at the time of writing (Win8/10), DateDblClick does not work; all that happens is that the DateClick event is called twice. A workaround has been included in the example below.

DayClick occurs when a day of the week is clicked, which is passed in the parameter DayOfWeek.

The SelChange event occurs when the user selects a new date or range of dates and has these parameters:

StartDate - The first date in the selection.

EndDate - The last date in the selection.

Example

OpenW 1, 0, 0, 242, 200 : Win_1.Caption = "Monthview"

Debug.Show

~SetWindowPos(Debug.hWnd, 0, 300, 0, 400, 400, 0)

Ocx MonthView mvw : mvw.MultiSelect = True

Do : Sleep : Until Me Is Nothing

Debug.Hide

 

Sub mvw_DateClick(DateClicked As Date)

// Workaround for DateDblClick

Static tim#

If Timer - tim# < 0.2 Then mvw_DateDblClick(DateClicked) : Exit Sub

tim# = Timer

Trace DateClicked

EndSub

 

Sub mvw_DateDblClick(DateDblClicked As Date)

Trace DateDblClicked

EndSub

 

Sub mvw_DayClick(DayOfWeek%)

Trace DayOfWeek

EndSub

 

Sub mvw_SelChange(StartDate As Date, EndDate As Date)

Trace StartDate : Trace EndDate

Trace mvw.Value

EndSub

See Also

MonthView

{Created by Sjouke Hamstra; Last updated: 17/12/2015 by James Gaite}