back to gui 

wxCalendarCtrl

generated from ../src/mod_gui/control/calendar.cpp

The calendar control allows the user to pick a date. For this, it displays a window containing several parts: a control at the top to pick the month and the year (either or both of them may be disabled), and a month area below them which shows all the days in the month. The user can move the current selection using the keyboard and select the date (generating onCalendar event) by pressing return or double clicking it.

It has advanced possibilities for the customization of its display. All global settings (such as colours and fonts used) can, of course, be changed. But also, the display style for each day in the month can be set independently using wxCalendarDateAttr.

Constants

Styles

Name Description
SUNDAY_FIRST Show Sunday as the first day in the week
MONDAY_FIRST Show Monday as the first day in the week
SHOW_HOLIDAYS Highlight holidays in the calendar
NO_YEAR_CHANGE Disable the year changing
NO_MONTH_CHANGE Disable the month (and, implicitly, the year) changing
SHOW_SURROUNDING_WEEKS Show the neighbouring weeks in the previous and next months
SEQUENTIAL_MONTH_SELECTION Use alternative, more compact, style for the month and year selection controls.

Constructor

wxCalendarCtrl

wxCalendarCtrl()
 
wxCalendarCtrl(Parent, 
               Id, 
               DefaultDate, 
               Pos = wxDefaultPosition, 
               Size = wxDefaultSize, 
               Style = wxCalendarCtrl.SHOW_HOLIDAYS)
 
Name Type Default Description
Parent wxWindow The parent of wxCalendarCtrl.
Id Integer A window identifier. Use -1 when you don't need it.
DefaultDate Date The date to select when the control is shown. Use null to use the default.
Pos wxPoint wxDefaultPosition The position of the CalendarCtrl control on the given parent.
Size wxSize wxDefaultSize The size of the CalendarCtrl control.
Style Integer wxCalendarCtrl.SHOW_HOLIDAYS The wxCalendarCtrl style.

Constructs a new wxCalendarCtrl object.

Properties

Name Type Description
attr read only wxCalendarDateAttr array Get the attributes of a day. The array index must be between 1 and 31.
date Date Get/Set the current date
enableHolidayDisplay Boolean Show/hide holidays (write only)
enableMonthChange Boolean Enable/Disable month changing (write only)
enableYearChange Boolean Enable/Disable year changing (write only)
headerColourBg wxColour Get/Set the background colour of the header. See setHeaderColours and headerColourFg
headerColourFg wxColour Get/Set the foreground colour of the header. See setHeaderColours and headerColourBg
highlightColourBg wxColour Get/Set the background colour of the selected date. See setHighlightColours and highlightColourFg
highlightColourFg wxColour Get/Set the foreground colour of the selected date. See setHighlightColours and highlightColourBg
holidayColourBg wxColour Get/Set the background colour of a holiday. See setHolidayColours and holidayColourFg
holidayColourFg wxColour Get/Set the foreground colour of a holiday. See setHolidayColours and holidayColourBg
lowerDateLimit Date Get/Set the lower date limit in which selection might occur. Set to null to remove the lower limit. See upperDateLimit and setDateRange
upperDateLimit Date Get/Set the upper date limit in which selection might occur. Set to null to remove the upper limit. See lowerDateLimit and setDateRange

Methods

create

create(Parent, 
       Id, 
       DefaultDate, 
       Pos = wxDefaultPosition, 
       Size = wxDefaultSize, 
       Style = wxCalendarCtrl.SHOW_HOLIDAYS) : Boolean
 
Name Type Default Description
Parent wxWindow The parent of wxCalendarCtrl.
Id Integer A window identifier. Use -1 when you don't need it.
DefaultDate Date The date to select when the control is shown. Use null to use the default.
Pos wxPoint wxDefaultPosition The position of the CalendarCtrl control on the given parent.
Size wxSize wxDefaultSize The size of the CalendarCtrl control.
Style Integer wxCalendarCtrl.SHOW_HOLIDAYS The wxCalendarCtrl style.

Creates a calendar control.

setDateRange

setDateRange(LowerLimit = null, 
             UpperLimit = null)
 
Name Type Default Description
LowerLimit Date null The lower limit of the selection. Use null to reset this.
UpperLimit Date null The upper limit of the selection. Use null to reset this.

Set the range in which selection can occur. See lowerDateLimit and upperDateLimit

setHeaderColours

setHeaderColours(ForegroundColour, 
                 BackgroundColour)
 
Name Type Default Description
ForegroundColour wxColour The foreground colour of the header
BackgroundColour wxColour The background colour of the header

Sets the colours of the header. See headerColourFg and headerColourBg

setHighlightColours

setHighlightColours(ForegroundColour, 
                    BackgroundColour)
 
Name Type Default Description
ForegroundColour wxColour The foreground colour of the highlighted date
BackgroundColour wxColour The background colour of the highlighted date

Sets the colours of the highlighted date. See highlightColourFg and highlightColourBg

setHolidayColours

setHolidayColours(ForegroundColour, 
                  BackgroundColour)
 
Name Type Default Description
ForegroundColour wxColour The foreground colour of a holiday
BackgroundColour wxColour The background colour of a holiday

Sets the colours of a holiday. See holidayColourFg and holidayColourBg

Events

onCalendar A day is double clicked. The function gets a wxCalendarEvent as argument.
onCalendarSelChanged The selected date is changed. The function gets a wxCalendarEvent as argument.
onCalendarDay The selected day is changed. The function gets a wxCalendarEvent as argument.
onCalendarMonth The selected month is changed. The function gets a wxCalendarEvent as argument.
onCalendarYear The selected year is changed. The function gets a wxCalendarEvent as argument.
onCalendarWeekDayClicked The user clicked on the week day header. The function gets a wxCalendarEvent as argument.



Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.