How...? |
Post Reply |
Author | |
cmm2006
Senior Member Joined: 26 September 2006 Status: Offline Points: 118 |
Post Options
Thanks(0)
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!!!
|
|
Rafael
Newbie Joined: 26 November 2007 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
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>
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.
|
|
Rafael
Newbie Joined: 26 November 2007 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
Instead of disable operation = true, just exit sub
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |