ComponentOne True DBInput Pro 8.0
Features of the TDBCalendar Control

The TDBCalendar control gives you complete control over the calendar's appearance and behavior, including the number of months to display, visual and attribute styles, holidays and weekends, navigation, and selection. This section describes the following features:

Attribute Styles (TDBCalendar)

The calendar provides a collection property called AttribStyles, which allows users to define any kind of attribute styles based on the drawing styles. The color of the text, as well as font attributes such as bold and underline, can be set as an attribute style. Later, the user just needs to specify which attribute style is to be use when a selection is made.

Use the Add method in the AttribStyles collection to add a new style, and the Remove method will remove a attribute style from the collection. (Please refer to the “AttribStyle object properties” section for details of each property setting.)

For more information see AttribStylesCollection Properties.

Drawing Styles (TDBCalendar)

Drawing styles can be added to the calendar by using the StyleSets collection property. This collection provides an Add or AddObj method which adds new drawing styles, and a Remove method that removes drawing styles from the collection. A drawing style (StyleSet) can define the background color, text color, 3D border width, and so on of an area. The control also provides drawing features that allow outline, grid lines, and separators can be drawn into the calendar. The LineColors() and LineStyles() properties are provided to draw a line with a particular color in a specified area.

For more information see StyleSet Object Properties.

Holidays and Weekends (TDBCalendar)

The calendar control supports rest days, such as Sunday, by using the WeekRests() property. The WeekRests() property actually defines which week of the month for a particular weekday will be the weekend. The WeekRests() property is a property array, starting from Sunday - elements 1 through 7 hold each weekday's information.

Rest days can be treated in two ways: as weekends and as holidays. Weekends are simply defined by designating which weekdays will become rest days, such as Sundays or Saturdays, and holidays are designated by defining a particular day as a rest day.

The calendar control handles holidays in groups such as national holidays, company holidays, personal vacations, and so on. A holiday style can be added to the control by using the Add method in the HolidayStyles collection; individual holidays can be added to the style using the Days collection.

For more information see HolidayStyle Object Properties.

Holiday Colors (TDBCalendar)

All holidays can be displayed in colors specified with the HolidayColor property.

Margin Spaces (TDBCalendar)

The control provides the MarginLeft, MarginTop, MarginRight, MarginBottom, and MarginTitle properties to set a margin space from the edge of the control and spacing between the title bar and the week title. However, when multiple calendar months are displayed in the control (the maximum is twelve), the spacing between the calendar months is not applied with these properties settings. In these cases, use the MarginWidth and MarginHeight properties.

For more information see TDBCalendar Control Properties.

Multiple-Month Display (TDBCalendar)

You can display as many as twelve months at a time, using the MonthCols and MonthRows properties.

For more information see TDBCalendar Control Properties.

Navigation (TDBCalendar)

The calendar provides custom buttons, scrollbar, and Outlook style navigation.

When the ShowNavigator property of the control is set to 0- None, the control will not provide any visual navigating features.

When the ShowNavigator property is set to either 1- Buttons or 2- Scrollbar, a navigation bar provided by the control will be displayed. Navigating through the months can be achieved by clicking on the inner buttons of the Button navigator or the single arrow buttons of the Scrollbar navigator. Year navigation can be achieved by clicking on the outer buttons of the Button navigator or the double arrow buttons of the Scrollbar navigator. The Scrollbar navigator also provides a button to jump to the current date. Clicking on the scrollbar pane of the Scrollbar navigator will cause scrolling to the next/previous view.

When either one of these navigators are being used, they can be positioned on any side of the control by using the NavOrientation property. Also, when the scrollbar navigator is being used, the user can decide whether to display the scroll tip window, which shows the current position of year and month.

When the ShowNavigator property is set to 3- Outlook style, two arrow buttons will be visible on the title bar. The calendar will move back when the left button (previous month) is clicked, and forward when the right button (next month) is clicked.

When multiple columns of months are displayed in the control, the navigating arrows will appear only on the leftmost calendar, and the right arrow on the rightmost calendar. Year navigation can be done by clicking on the title bar and popping up a list to select year and month, or by clicking on the arrow buttons with the Ctrl key pressed down.

For more information see TDBCalendar Control Properties.

Selection (TDBCalendar)

When a date is selected in the calendar, you need some way to distinguish visually those dates that have been selected and those dates that have not. The control provides a simple way of handling this by using attribute styles. All that is needed is to add an attribute style and set the necessary settings, then apply the attribute style to the control. The SelAttribute property determines which attribute style should be used.

For more information see TDBCalendar Control Properties.

Trailing Days (TDBCalendar)

The calendar provides a property called ShowTrailing, which determines if trailing days of the previous or next month should be shown in the calendars. When the ShowTrailing property is set to True, the control uses an attribute style that is specified in the TrailAttribute property.

For more information see TDBCalendar Control Properties.

Shortcut Keys (TDBCalendar)

The control provides shortcut keys so that the calendar navigation can be efficient using the keyboard. The shortcut keys can be divided into two groups: the programmatic shortcut keys and fixed shortcut keys. The programmatic shortcut keys can be defined using the Key:controls object property provided by the control. The following sample shows how the key for retrieving the system date can be programmed.

Example Title
Copy Code
' Keys to use for retrieving the system date.

Calendar.Key.Now = "{F3},+{A}"

The [F3] key and [CTRL]+[A] keys can be used to retrieve the current system date. The following table provides other programmatic keys available in the control:

Key Object

Description

Clear

Shortcut key to use for clearing the selection.

NextCtrl

Shortcut key to use for moving to the next control.

Now

Shortcut key to use for moving to “Today”.

PrevCtrl

Shortcut key to use for moving to the previous control.

Fixed shortcut keys are already pre-defined in the control, such as moving to the previous/next month, previous/next year, and so on. The following table provides all the fixed keys supported in the control:

Keys

Description

[up]

Move to the previous week.

[down]

Move to the next week.

[left]

Move to the previous day.

[right]

Move to the next day.

[home]

Move to the first day in the week.

[ctrl]+[home]

Move to the first day of the displayed month.

[end]

Move to the last day in the week.

[ctrl]+[end]

Move to the last day of the displayed month.

[pageup]

Move to the previous month.

[pagedown]

Move to the next month.

[ctrl]+[pageup]

Move to the previous year.

[ctrl]+[pagedown]

Move to the next year.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback