Hi,
The end of last week I was looking for a drop-down ribbon calendar and cam across this post. It inspired me to come up with my own solution as I wanted to have a couple of drop-down calendars, that could be used for something like, Start Date and End Date in conjunction with a "Run Report" button.
I ended up creating the following as an initial test:
cal1.JPG
cal2.JPG
The sample has two calendars in but, it could easily be 1, 3, 4, 5, etc....
The xml for a single calendar is as follows:
PHP Code:
<box id="box_cal1" boxStyle="horizontal">
<labelControl id="lblCalName_cal1"
getLabel="getCalendarLabel"
getVisible="getCalendarLabelVisibility"
tag="rxgal_cal1"/>
<buttonGroup id="butGrp_cal1">
<button id="butPrevYear_cal1"
imageMso="OutlinePromoteToHeading"
onAction="rxbut_PrevYear"
tag="rxgal_cal1"
screentip="Previous Year"/>
<button id="butPrevMonth_cal1"
imageMso="OutlinePromote"
onAction="rxbut_PrevMonth"
tag="rxgal_cal1"
screentip="Previous Month"/>
<gallery id="rxgal_cal1"
getLabel="rxgal_getLabel"
columns="7"
rows="7"
getItemCount="rxgal_getItemCount"
getItemLabel="rxgal_getItemLabel"
onAction="rxgal_Click"
showItemLabel="true"
tag="rxgal_cal1"
getScreentip="rxgal_getScreentip"
getSupertip="rxgal_getSupertip">
<button id="butYesterday_cal1"
imageMso="ProposeNewTime"
label="Yesterday"
onAction="rxbut_Yesterday"
tag="rxgal_cal1"/>
<button id="butToday_cal1"
imageMso="AccessListEvents"
label="Today"
onAction="rxbut_Today"
tag="rxgal_cal1"/>
<button id="butTomorrow_cal1"
imageMso="RecoverInviteToMeeting"
label="Tomorrow"
onAction="rxbut_Tomorrow"
tag="rxgal_cal1"/>
</gallery>
<button id="butNextMonth_cal1"
imageMso="OutlineDemote"
onAction="rxbut_NextMonth"
tag="rxgal_cal1"
screentip="Next Month"/>
<button id="butNextYear_cal1"
imageMso="OutlineDemoteToBodyText"
onAction="rxbut_NextYear"
tag="rxgal_cal1"
screentip="Next Year"/>
</buttonGroup>
</box>
To add further calendars, copy and paste the above and do a quick Find & Replace on "_cal1" to replace it with "_cal2", "_cal3", etc.
There is a sub routine called "InitialiseCalendars", that needs changing for each calendar you add. Below is the routine as required for the screenshots above. It allows you to set the default date, the label, label visibilty, screentip and supertip per calendar. The default dates are required, everything else is optional.
Code:
Sub InitialiseCalendars()
Const sKEY_CAL1 As String = "rxgal_cal1"
Const sKEY_CAL2 As String = "rxgal_cal2"
Set colDates = New Dictionary
Set colCalendarLabels = New Dictionary
Set colCalLabelVisible = New Dictionary
Set colCalScreentips = New Dictionary
Set colCalSupertips = New Dictionary
'Set default Dates
'The key must match the Ribbon ID for the gallery control that represents the calendar
colDates.Add sKEY_CAL1, Date
colDates.Add sKEY_CAL2, Date
colCalendarLabels.Add sKEY_CAL1, "Start:"
colCalendarLabels.Add sKEY_CAL2, "End:"
colCalLabelVisible.Add sKEY_CAL1, True
colCalLabelVisible.Add sKEY_CAL2, True
colCalScreentips.Add sKEY_CAL1, "Start Date"
colCalScreentips.Add sKEY_CAL2, "End Date"
colCalSupertips.Add sKEY_CAL1, "The start date from which you want to run the report."
End Sub
Attached is the XLAM file example, I'd love you feedback on way to improve it.
It hasn't been extensively tested and has only been tested on 2007 (SP2 I think).
Dex
Bookmarks