Calendar header |
Post Reply |
Author | ||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 06 January 2007 at 4:50pm |
|||
I have several resources in my calendar.
The banner/header (not sure if this is the 'official' name) at the top of the day's schedule only reads the day of the week and not day/date etc.
How can I change this?
|
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
Hi,
It depends on the width of the window. If there is enough space to display long day header, it displays it. Otherwise, it tries to work with Middle day header format, then Short, and the Shortest at last. In any case you can set custom format strings for day header date formats. See CalendarDayView properties DayHeaderFormatLong DayHeaderFormatMiddle DayHeaderFormatShort DayHeaderFormatShortest As I understand you use office 2003 theme ? Example:
-- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
I am acutally using 2007 theme and I can't seem to get above code to work.
I am viewing as a dayView (one single day) so I don't think space is an issue. I have a screen shot available. ....
|
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
Ok, you can try another way:
See GetItemText notification. Set : CalendarControl.AskItemTextFlags = xtpCalendarItemText_DayViewDayHeader See enum XTPCalendarGetItemText -- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
not having much success.... can you provide a bit more info..
|
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
Take a look at our VB sample, frmMain: CalendarControl_GetItemText event handler.
Also uncomment string CalendarControl.AskItemTextFlags = -1 in Form_Load method. Then you'll see. -- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
It appears to not be working in 2007 Theme.... I am still just getting the Day of the week.
|
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
Show me the code you're using in CalendarControl_GetItemText event handler.
-- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
Straight from your sample:
Private Sub CalendarControl_GetItemText(ByVal Params As XtremeCalendarControl.CalendarGetItemTextParams)
If Params.Item = xtpCalendarItemText_EventSubject Then Params.Text = "*Custom subject* " & Params.Text ElseIf Params.Item = xtpCalendarItemText_EventLocation Then Params.Text = "ScheduleID = " & Params.ViewEvent.Event.ScheduleID ElseIf Params.Item = xtpCalendarItemText_EventBody Then Params.Text = "custom BODY text." ElseIf Params.Item = xtpCalendarItemText_DayViewDayHeader Or _ Params.Item = xtpCalendarItemText_WeekViewDayHeader Or _ Params.Item = xtpCalendarItemText_MonthViewDayHeader _ Then Params.Text = "Date:" & Params.ViewDay.Date ElseIf Params.Item = xtpCalendarItemText_DayViewDayHeaderLeft Or _ Params.Item = xtpCalendarItemText_WeekViewDayHeaderLeft Or _ Params.Item = xtpCalendarItemText_MonthViewDayHeaderLeft _ Then 'Params.Text = Day(Params.ViewDay.Date) Params.Text = Day(Params.ViewDay.Date) ElseIf Params.Item = xtpCalendarItemText_DayViewDayHeaderCenter Or _ Params.Item = xtpCalendarItemText_WeekViewDayHeaderCenter Or _ Params.Item = xtpCalendarItemText_MonthViewDayHeaderCenter _ Then Params.Text = WeekdayName(Weekday(Params.ViewDay.Date), , vbSunday) ElseIf Params.Item = xtpCalendarItemText_DayViewDayHeaderRight Or _ Params.Item = xtpCalendarItemText_WeekViewDayHeaderRight Or _ Params.Item = xtpCalendarItemText_MonthViewDayHeaderRight _ Then Params.Text = Year(Params.ViewDay.Date) ElseIf Params.Item = xtpCalendarItemText_MonthViewWeekDayHeader Then Params.Text = Params.Text & " - " & Params.Weekday ElseIf Params.Item = xtpCalendarItemText_EventToolTipText Then Params.Text = "(" & Params.ViewEvent.Event.Location & ") " & _ Params.ViewEvent.Event.Subject & _ " [" & Params.ViewEvent.Event.Id & "]" End If End Sub |
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
So, it works as designed
If you want to see another header, customize this code as you wish. -- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
I actually didn't alter that code at all, it came straight 'out of the box'
Can you tell me then, does this feature work on the 2007 theme?
If so, then I am missing something and don't need to create custom code...
the header I am talking about is here: at the top of the calendarcontrol:
|
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
Yes, thIs feature works fine for Office 2007 theme.
Will try to help you... You have to understand the code in GetItemText handler. Please read it once more and remove lines which you don't need. Look at these lines:
You receive Week day name because WeekdayName() returns it
Just set
Well, instead this of course write what you need ps: Use following flags for Office 2007 theme: xtpCalendarItemText_DayViewDayHeaderLeft xtpCalendarItemText_DayViewDayHeaderCenter xtpCalendarItemText_DayViewDayHeaderRight When your code start working, set only flags which are actually used to AskItemTextFlags for optimization (instead of -1, which is useful for debug). Example:
-- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
Serge,
Got it! Thanks for your patience!!
|
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
Actually one last quick question....
is there a way to change the font/font size of this header?
|
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
For Office2007 theme look at the similar event handler BeforeDrawThemeObject and the message xtpCalendarBeforeDraw_DayViewDay. Take a look at our regular sample for more details. -- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
would it be a line like this:
pTheme2007.DayView.Day.Header.TextCenter.Normal.Font.Bold = True
pTheme2007.DayView.Day.Header.TextCenter.Normal.Font.SIZE = 12 |
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
yes, you're correct.
-- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
I am referencing the screen shot I pasted above.
So those lines of code do not seem to change the font/font size of the day of the week (Sunday which is currently showing) but rather is changing the size/font of the schedule headers (i.e. ARI, MEH, etc) that are at the bottom of that screen shot fragment......
|
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
For this caption you should reference the following piece of code in the sample:
-- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
that's not helpful at all, that is just the code from your sample and doesn't change font or font size, just the color of the header... please re-read my post!!!
|
||||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|||
Note that it's different for Normal days, Selected days, etc, and it should be set separately. The following piece of code works just fine:
Also to adjust header height somewhere after you set theme Office 2007 change height like
do not set this in BeforeDrawThemeObject because this setting applyed on Populate call. Also if you do not need dynamically chahge your font by some condition use static customization, like for height:
Also to understand theme customization look our VB Sample, menu Calendar -> Customize office 2007 Theme -- WBR, Serge |
||||
scbdpm
Groupie Joined: 05 January 2007 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
|||
this is perfect! thank you!
|
||||
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 |