Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Calendar Query
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Calendar Query

 Post Reply Post Reply
Author
Message
dneilsen View Drop Down
Newbie
Newbie


Joined: 18 April 2006
Location: Australia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote dneilsen Quote  Post ReplyReply Direct Link To This Post Topic: Calendar Query
    Posted: 27 April 2006 at 11:57pm
Hi guys,

What I am trying to create is a control that looks like a month view of a calendar and on each day, it has an editable field that contains a value.  This control will be used for a timesheet where users can enter in daily hours.

So far I have I have created an inherited control from the  XtremeCalendarControl where each day has a single event in it and this is working quite well.

I have a few issues that I have been unable to find answers for however:

1) When the user clicks on a day I would like the event to be selected.  I know what the event is but how can I programmatically select the event?

2) When an event is selected (eg. clicked on) I would like the value contained in the event highlighted automatically.  (ie. so the user can just type the new value rather than having to delete the existing value).  Anyone know how to do this?

3) I would like to set the event label background colour to a custom colour and I have been able to do this by entering in an uint in a new label.  However.... where do these uint values come from?  eg. If I have RGB(255,0,0), what is the uint value?

4) In relation to number 3 above, is it possible to set the colour as transparent?

Any help would be appreciated.


Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 29 April 2006 at 5:18pm
Hi,

1) See method: XtremeCalendarControl.CalendarView.SelectViewEvent(ViewEvent As CalendarViewEvent, Select As Boolean)

Also look at: XtremeCalendarControl.CalendarView.Days -> ViewGroups -> ViewEvents -> ViewEvent - is CalendarViewEvent.

2) There are no standard way to do that, but I can image a following workaround for you:
When user pess the key a new event is created and subject editing is started but you can disable this in calendar options or using IsEditOperationDisabled.
Then you'll have to imitate F2 key press to start editing subject (use SendMessage(WM_KEYDOWN, ...))
Then get a focused window - this is a standard CEdit control. Use SendMessage and CEdit control messages to set a new text and cursor position.
See also: BeforeEditOperation and KeyDown events.

3) See CalendarDataProvider.LabelList collection.

4) For a moment no, only RGB(...). Might be possible is future versions.

--
WBR,
Serge
Back to Top
dneilsen View Drop Down
Newbie
Newbie


Joined: 18 April 2006
Location: Australia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote dneilsen Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2006 at 6:12pm
ok thanks, ill have another stab at it with that new information and let you know how I get on
Back to Top
dneilsen View Drop Down
Newbie
Newbie


Joined: 18 April 2006
Location: Australia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote dneilsen Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2006 at 2:49am
I am still having some major trouble with number one

It may be something I have done but it seems that the Days collection does not exist in any of the active views even though the documentation shows that it should exist.

Here is the code I am trying...


        private void TSCalendar_MouseDownEvent(object sender, _DCalendarControlEvents_MouseDownEvent e)
        {
            if(e.button == 1)
            {
                //left click mouse events
                CalendarHitTestInfo HitTest;
                HitTest = this.ActiveView.HitTest();

                if (HitTest.HitCode == CalendarHitTestCode.xtpCalendarHitTestDayArea ||
                    HitTest.HitCode == CalendarHitTestCode.xtpCalendarHitTestDayHeader)
                {
                    this.ActiveView.SetSelection(HitTest.HitDateTime, HitTest.HitDateTime, true);

                    //this.ActiveView.Days
                }
            }           


        }


The problem is, if I cannot determine the viewevent, then I cannot select it....

I must be doing something wrong here?





Back to Top
WaaZ View Drop Down
Senior Member
Senior Member


Joined: 31 January 2006
Location: United Kingdom
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaaZ Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2006 at 6:01am

Hi,

There is a mathematical function that is present to convert RGB(r,g,b) to uins as follows:

(b*256*256) + (g*256) + (r)

WaaZ

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2006 at 6:56am
Originally posted by dneilsen dneilsen wrote:


It may be something I have done but it seems that the Days collection does not exist in any of the active views even though the documentation shows that it should exist.


Days is a default property and you can access it as this.ActiveView
 
EXAMPLE:
DateTime dt = wndCalendarControl.ActiveView[0].Date;
 
NOTE:
C# does not allow access to ActiveView.Days, but VB allow both variants.

--
WBR,
Serge
Back to Top
dneilsen View Drop Down
Newbie
Newbie


Joined: 18 April 2006
Location: Australia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote dneilsen Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2006 at 6:46pm
Aha!   That did the trick.
Thanks very much sserge.

For those that may be interested in this solution here is the code


            this.SelectionChanged += new AxXtremeCalendarControl._DCalendarControlEvents_SelectionCha ngedEventHandler(TSCalendar_SelectionChanged);


        private int getViewIndex(DateTime myDate)
        {
            for(int i=0; i<this.ActiveView.DaysCount; i++)
            {
                DateTime dt = this.ActiveView.Date;
                if(dt.Day == myDate.Day && dt.Month == myDate.Month)
                    return i;
            }
            return 0;
        }

        private void TSCalendar_SelectionChanged(object sender, _DCalendarControlEvents_SelectionChangedEvent e)
        {
            switch(e.selType)
            {
                case CalendarSelectionChanged.xtpCalendarSelectionDays: &nbs p;     
                    //Select the first event in the day
                    bool fullday = true;
                    DateTime startDate = DateTime.MinValue;
                    DateTime endDate = DateTime.MinValue;
                    this.MonthView.GetSelection(ref startDate, ref endDate, ref fullday);
                    int index = getViewIndex(startDate);
                    this.ActiveView.SelectViewEvent(this.ActiveView[index][0], true);
                    break;

                case CalendarSelectionChanged.xtpCalendarSelectionEvents:
                    //Force edit of the selected event and mark the data
                    System.Windows.Forms.SendKeys.Send("{F2}");
                    System.Windows.Forms.SendKeys.Send("+{END}");
                    break;
            }

        }




Back to Top
dwise View Drop Down
Newbie
Newbie


Joined: 23 January 2008
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote dwise Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2008 at 4:01am
Small addition, another way to select an event by it's key:
 
Private Sub SelectEventInView(ByRef prmCalendar As XtremeCalendarControl.CalendarControl, prmAgendaId As Long)
   
    Dim objViewGroup As XtremeCalendarControl.CalendarViewGroup
    Dim objViewEvent As XtremeCalendarControl.CalendarViewEvent
   
    For Each objViewGroup In prmCalendar.ActiveView(0).ViewGroups
        For Each objViewEvent In objViewGroup.ViewEvents
            If objViewEvent.Event.id = prmAgendaId Then
                objViewEvent.Selected = True
            End If
        Next
    Next
   
End Sub
 
Note: apparantly this only works if the view is set to week or day view.
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.172 seconds.