Print Page | Close Window

How...?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=9116
Printed Date: 07 October 2024 at 1:33pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How...?
Posted By: cmm2006
Subject: How...?
Date Posted: 16 December 2007 at 4:31pm
Hi,
if I set my work days from Monday to Friday, how can I be able to tell the user every time he tries to add an event in the calendar in one of those days? (same question if I decides to change the work days to different days)
 
Note: I checked the calendarcontrol sample (Advanced Options) and I find the option de disable the creation of event on Saturday and Sunday (chkDisableInPlaceCreateEvents), it works good but when you double click it will open the 'New Event' window, and my request consist in disabling the double click also.
thank you!!!
 



Replies:
Posted By: Rafael
Date Posted: 19 December 2007 at 2:05pm
In the sample the following code is found in IsEditOperationDisabled.  If just before you do the 'mnuNewEvent_Click' in the DblClick Event, you use this code, it will determine what day you clicked and you can react accordingly.
 
<code>
 
        If DisableInPlaceCreateEvents_ForSaSu Then
            Dim dtBegin As Date, dtEnd As Date, bAllDay As Boolean
            Dim nSelDays As Long, nSelWDay As Long
                                  
            If CalendarControl.ActiveView.GetSelection(dtBegin, dtEnd, bAllDay) = False Then
                Exit Sub
            End If
           
            nSelDays = Abs(DateDiff("d", dtEnd, dtBegin))
            If dtBegin < dtEnd Then
                nSelWDay = Weekday(dtBegin)
            Else
                nSelWDay = Weekday(dtEnd)
            End If
           
            If bAllDay And nSelDays > 0 Then
                nSelDays = nSelDays - 1
            End If
           
            If nSelWDay = 1 Or (nSelWDay + nSelDays) >= 7 Then
                DisableOperation = True
            End If
 End If
 
</code>
 
The Hit test will tell you where you clicked, but not which day.  You can test that by breaking down the selection.


Posted By: Rafael
Date Posted: 19 December 2007 at 2:08pm
Instead of disable operation = true, just exit sub



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