Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - [Solved] Event : BackgroundColor and Locked
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[Solved] Event : BackgroundColor and Locked

 Post Reply Post Reply
Author
Message
Potus View Drop Down
Newbie
Newbie
Avatar

Joined: 29 March 2012
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Potus Quote  Post ReplyReply Direct Link To This Post Topic: [Solved] Event : BackgroundColor and Locked
    Posted: 12 April 2012 at 10:48am
Hi all,
 
We have downloaded 15.2.1 Of Calendar Control and we have 2 questions before to buy it :
 
* Can you confirm me that we have only Event.Label 0 to 10 for background color of an Event ? We want more colors in our society (like it seem possible for Cells of CalendarControl).
 
* Is it possible to lock an event (only those we select in our developpement) ?
 
Regards,
Potus
Product: Xtreme SuitePro (ActiveX) version 15.2.1 Eval 30 days.
Platform: Windows Seven (64 bits)
Language: C# under Visual Studio 2008
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2012 at 9:06am
By default Event ID's 1-6 are already created yellow, blue, etc.... So if you add them be sure to start with ID 7 or greter or delete the default ones.
If m_bAddEvent Then
m_pEditingEvent.Categories.Add 7
m_pEditingEvent.Categories.Add 8
frmInbox.wndCalendarControl.DataProvider.AddEvent m_pEditingEvent
Else
frmInbox.wndCalendarControl.DataProvider.ChangeEvent m_pEditingEvent
End If
Public Sub AddCategories()
'IDs 1-6 are used for the default colors, 1 = Yellow....6 - Blue

Dim EvCat As XtremeCalendarControl.CalendarEventCategory
Set EvCat = New CalendarEventCategory
EvCat.Background = vbRed
EvCat.BorderColor = vbGreen
EvCat.Id = 1
frmInbox.wndCalendarControl.DataProvider.EventCategories.Add EvCat

Set EvCat = New CalendarEventCategory
EvCat.Background = vbBlue
EvCat.BorderColor = vbGreen
EvCat.Id = 2
frmInbox.wndCalendarControl.DataProvider.EventCategories.Add EvCat

Set EvCat = New CalendarEventCategory
EvCat.Background = vbYellow
EvCat.BorderColor = vbGreen
EvCat.Id = 3
frmInbox.wndCalendarControl.DataProvider.EventCategories.Add EvCat

Set EvCat = New CalendarEventCategory
EvCat.Background = vbGreen
EvCat.BorderColor = vbBlue
EvCat.Id = 4
frmInbox.wndCalendarControl.DataProvider.EventCategories.Add EvCat
End Sub

Back to Top
Potus View Drop Down
Newbie
Newbie
Avatar

Joined: 29 March 2012
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Potus Quote  Post ReplyReply Direct Link To This Post Posted: 23 April 2012 at 10:31am
Thanx for your response Oleg. If you look my signature, you will see I am under CSharp.
 
So, I adapted you code as below (taking from your sample code of C#.NET\CalendarControl for Normal Event) :
CalendarDataProvider pCalendarData = CalendarView1.DataProvider;
DateTime dtNow = new DateTime(DateTime.Now.Ticks);
 
// Normal Event
dtNow = DateTime.Now;
ptrEvent = pCalendarData.CreateEvent();
dtNow = dtNow.AddDays(1);
dtNow = dtNow.AddHours(1);
ptrEvent.StartTime = dtNow;
ptrEvent.EndTime = dtNow.AddHours(2);
ptrEvent.Subject = "Subject - Tomorrow Event";
ptrEvent.Location = "Location - [Color Test]";
ptrEvent.BusyStatus = CalendarEventBusyStatus.xtpCalendarBusyStatusTentative;
 
// -- New color
XtremeCalendarControl.CalendarEventCategory CalEvCat = new XtremeCalendarControl.CalendarEventCategory();
CalEvCat.Background.ColorLight = (uint)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(198, 198, 198));
CalEvCat.Background.ColorDark = (uint)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(255, 192, 192));
CalEvCat.Background.GradientFactor = 1;
CalEvCat.Name = "NewColor";
CalEvCat.Id = 11;
CalEvCat.BorderColor = (uint)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(255, 20, 75));
pCalendarData.EventCategories.Add(CalEvCat);
// -- New color
 
ptrEvent.Label = (int)Label.NewColor;
pCalendarData.AddEvent(ptrEvent);

CalendarView1.Populate();

NB: In CSharp, I can't directly modify BackGroundColor as you do In Vb. 
 
I have assing in enum Label (frmEventProperties) this NewColor (with 11), but there is somewhere an mistake I don't see. Could you help me ?
 
I am sure I am near the solution, sorry If it's an big stupid thing I have missed (I am not expert and so alone on this project in my society).
 
And what about the second question (lock event) you can tell me if the property exists?
 
Best Regards,
Potus
Product: Xtreme SuitePro (ActiveX) version 15.2.1 Eval 30 days.
Platform: Windows Seven (64 bits)
Language: C# under Visual Studio 2008
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 23 April 2012 at 3:46pm
I think Oleg misunderstood, here is code you need for labels:

            CalendarEventLabels listLabels = wndCalendarControl.DataProvider.LabelList();
            // Use to remove all built in labels and add your own
            /*
            listLabels.RemoveAll();
            listLabels.AddLabel(0, 0, "None category");
            listLabels.AddLabel(1, 0xff0000, "Blue category");
            listLabels.AddLabel(2, 0x00ff00, "Green category");
            listLabels.AddLabel(3, 0x0000ff, "Red category");
            */
            // Use to add labels to existing default list (0-10)
            /*
            RGB(255,255,255) None 0 
            RGB(255,148,132)  Important 1 
            RGB(132,156,231)  Business 2 
            RGB(165,222, 99) Personal 3 
            RGB(231,231,214) Vacation 4 
            RGB(255,181,115)  Must Attend 5 
            RGB(132,239,247)  Travel Required 6 
            RGB(214,206,132)  Needs Preparation 7 
            RGB(198,165,247)  Birthday 8 
            RGB(165,206,198)  Anniversary 9 
            RGB(255,231,115)  Phone Call 10 
            */
            listLabels.AddLabel(11, 0x000001, "Black Category");
            listLabels.AddLabel(12, 0xff0000, "Blue category");
            listLabels.AddLabel(13, 0x00ff00, "Green category");
            listLabels.AddLabel(14, 0x0000ff, "Red category"); 


// Create 4 normal events

// Normal Event 1
CalendarEvent ptrEvent = pCalendarData.CreateEvent();
ptrEvent.StartTime = dtNow;
ptrEvent.EndTime = dtNow.AddHours(1);
ptrEvent.Subject = "Event &Now [Tentative Meeting]";
ptrEvent.Location = "MSB - Room 204";
//ptrEvent->SetReminderMinutesBeforeStart(10);
ptrEvent.BusyStatus = CalendarEventBusyStatus.xtpCalendarBusyStatusTentative;
ptrEvent.MeetingFlag = true;
                        ptrEvent.Label = 11;

pCalendarData.AddEvent(ptrEvent); 
wndCalendarControl.Populate();
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 23 April 2012 at 3:56pm
for locking you can modify this code to check which event, etc...now it locks all edit operations:

Private Sub CalendarControl_BeforeEditOperation(ByVal OpParams As XtremeCalendarControl.CalendarEditOperationParameters, CancelOperation As Boolean) 
CancelOperation = True 
Exit Sub 

... 

Private Sub CalendarControl_IsEditOperationDisabled(ByVal OpParams As XtremeCalendarControl.CalendarEditOperationParameters, DisableOperation As Boolean) 
DisableOperation = True 
Exit Sub 
Back to Top
Potus View Drop Down
Newbie
Newbie
Avatar

Joined: 29 March 2012
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Potus Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2012 at 11:26am
Perfect Super Mario, I am continuing my investigations on this control
Product: Xtreme SuitePro (ActiveX) version 15.2.1 Eval 30 days.
Platform: Windows Seven (64 bits)
Language: C# under Visual Studio 2008
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.