Calendar Query |
Post Reply |
Author | |
dneilsen
Newbie Joined: 18 April 2006 Location: Australia Status: Offline Points: 19 |
Post Options
Thanks(0)
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. |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
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 |
|
dneilsen
Newbie Joined: 18 April 2006 Location: Australia Status: Offline Points: 19 |
Post Options
Thanks(0)
|
ok thanks, ill have another stab at it with that new information and let you know how I get on
|
|
dneilsen
Newbie Joined: 18 April 2006 Location: Australia Status: Offline Points: 19 |
Post Options
Thanks(0)
|
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...
The problem is, if I cannot determine the viewevent, then I cannot select it.... I must be doing something wrong here? |
|
WaaZ
Senior Member Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
Post Options
Thanks(0)
|
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 |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
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 |
|
dneilsen
Newbie Joined: 18 April 2006 Location: Australia Status: Offline Points: 19 |
Post Options
Thanks(0)
|
Aha! That did the trick.
Thanks very much sserge. For those that may be interested in this solution here is the code
|
|
dwise
Newbie Joined: 23 January 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
|
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.
|
|
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 |