CwMonthCalendar
CwMonthCalendar visually represents a calendar.
Several protocols exist to control calendar’s value; the other group of protocols specifies the appearance and behavior of the calendar.
Protocol
Manipulating Value
day
answer the current day of the calendar
day: aDate
set the current day of the calendar
maxDate
Answer the maximum (latest) allowable date in the receiver.
The default is to have no latest limit.
maxDate: aDate
Set the maximum (latest) allowable date in the receiver.
maxSelectionCount
Answer the maximum number of days the receiver can select.
The default is 1.
maxSelectionCount:
Set the maximum number of days the receiver can select.
minDate
Answer the minimum (earliest) allowable date in the receiver.
The default is to have no earliest limit.
minDate: aDate
Set the minimum (earliest) allowable date in the receiver.
month
answer the current month of the calendar
month:
set the current month of the calendar
selection
Answer the selected date in the receiver. If the maxSelectionCount exceeds one, answer the selection range; that is, earliest and latest date selected. If no date is selected, answer nil.
selection: aDate
Set the selected date in the receiver.
selectionMin:max:
Set the selected range in the receiver. The selected range is selection range is a pair of dates: earliest and latest. It makes sense to set this if the maxSelectionCount exceeds one.
selectionMinMax
Answer the range of selected date in the receiver. If the maxSelectionCount exceeds one, answer the selection range; that is, earliest and latest date selected. If no range is selected, answer a pair of nils.
year
answer the current year of the calendar
year:
set the current year of the calendar
Look and Feel
boldDayList
Answer the dates in the control which are to be displayed with bold typeface. This list is only consulted if displayDayStatus is true.
The default is an empty collection.
boldDayList: aCollection
Set the dates in the control which are to be displayed with bold typeface.
displayDayStatus
Answer whether the receiver can display a day in more than one way.
The default is false.
displayDayStatus: aBoolean
Set whether the receiver can display a day in more than one way.
firstDayOfWeek
Answers the first day of the week in the receiver.
0
Monday,
4
Friday
1
Tuesday,
5
Saturday
2
Wednesday;
6
Sunday
3
Thursday
-1
Use Windows locale information
The default is to use the Windows locale information to determine the first day of the week.
firstDayOfWeek: anInteger
Sets the first day of the week in the receiver.
0
Monday,
4
Friday
1
Tuesday,
5
Saturday
2
Wednesday;
6
Sunday
3
Thursday
-1
Use Windows locale information
 
scrollBy
Answer the scroll rate in the receiver.
The default is 1.
scrollBy: anInteger
Set the scroll rate in the receiver.
today
Answer the date specified as 'today' in the receiver.
The default is to have today match the Windows date. If the default is in force, answer nil.
today: aDate
Set the date specified as 'today' in the receiver.
todayCircled
Answer true if the receiver circles today’s date.
The default is true.
todayCircled: aBoolean
Set whether the receiver circles today’s date.
todayShown
Answer true if the receiver shows today’s date at the bottom.
The default is false.
todayShown: aBoolean
Set whether the receiver shows today’s date at the bottom.
weeksNumbered
Answer true if the receiver shows week numbers.
The default is false.
weeksNumbered: aBoolean
Set whether the receiver shows week numbers.
Callbacks and Events
The month calendar has no callbacks or events specific to it.
Example
monthCalendar := CwMonthCalendar
createWidget: 'MonthCalendar' "$NON-NLS$"
parent: workWindow
argBlock: nil.
monthCalendar manageChild.
 
monthCalendar setValuesBlock: [:w |
w
leftAttachment: XmATTACHFORM;
rightAttachment: XmATTACHFORM;
topAttachment: XmATTACHFORM;
bottomAttachment: XmATTACHFORM;
width: 200;
height: 200;
month: 6;
displayDayStatus: true;
todayShown: true;
weeksNumbered: true].
monthCalendar
addCallback: XmNvalueChangedCallback
receiver: self
selector: #propogateValue:clientData:callData:
clientData: anIterestedWidget;
yourself.
Note :
When displayDayStatus is true, some day in the calendar can be shown in bold typeface. The dates to be displayed as such are specifiec in boldDayList
e.g. following code snippet
year := Date today year.
boldDayList := OrderedCollection new
add: (Date newDay: 31 monthIndex: 12 year: year - 1) ;
add: (Date newDay: 1 monthIndex: 1 year: year) ;
add: (Date newDay: 18 monthIndex: 2 year: year) ;
add: (Date newDay: 1 monthIndex: 4 year: year) ;
add: (Date newDay: 27 monthIndex: 5 year: year) ;
add: (Date newDay: 4 monthIndex: 7 year: year) ;
add: (Date newDay: 5 monthIndex: 7 year: year) ;
add: (Date newDay: 2 monthIndex: 9 year: year) ;
add: (Date newDay: 28 monthIndex: 11 year: year) ;
add: (Date newDay: 29 monthIndex: 11 year: year) ;
add: (Date newDay: 24 monthIndex: 12 year: year) ;
add: (Date newDay: 25 monthIndex: 12 year: year) ;
add: (Date newDay: 31 monthIndex: 12 year: year) ;
add: (Date newDay: 1 monthIndex: 1 year: year + 1) ;
yourself.
monthCalendar boldDayList: boldDayList
 
Last modified date: 01/29/2015