Calendar Works home page

Overview

Components
TcwDayView
TcwWeekView
TcwMonthView
TcwManager
TcwEvents
TcwMemoryEvents

Classes
TcwEvent
TcwEventIterator

Additional Information
Constants & Types
Miscellaneous routines
HTML Reference
FAQ's Frequently asked questions
Tips & Tricks

Help File
Download help file

Feedback
Report a bug with this manual

How do you rate this manual?
Great
OK
Poor

Comments


Best viewed with
Microsoft Internet Explorer
TcwMonthView

Unit: cwMonth

Ancestor: TCustomgwGrid

Properties
Date, DayTitleColor, DayTitleFont, DayTitleFormats, DayTitleSize, FocusStyle, Manager, MonthsHorizontally, MonthsVertically, MonthTitleColor, MonthTitleFont, MonthTitleFormats, MonthTitleSize, MultiSelection, NonDayColor, OriginDate, SelectionStyle, StartOfWeek, WeekdayColor, WeekdayFont, WeekendColor, WeekendFont, WrapDays,
Inherited from TCustomgwGrid
Align, Anchors, BorderStyle, Cell, Column, ColumnCount, ColumnIndex, Ctl3D, DragCursor, DragMode, PopupMenu, Row, RowCount, RowIndex, Scrollbars, Visible,

Methods
GetCell,

Events
OnInitialize,
Inherited from TCustomgwGrid
OnAnchorClick, OnBeforeDraw, OnClick, OnDblClick, OnDeSelectCell, OnDragOver, OnDragDrop, OnEnter, OnEnterCell, OnExit, OnExitCell, OnKeyDown, OnKeyPress, OnKeyUp, OnMouseDown, OnMouseMove, OnMouseUp, OnSelectCell, OnSelectionComplete, OnStartDrag, OnEndDrag,



Properties
Date

property Date : FDate;

Description Use Date to change the selected date.

See also OriginDate

Example Select New Years Day 1999

// Display month of January
cwMonthView1.OriginDate := EncodeDate(1999, 1, 1);

// Now select 1st of January
cwMonthView1.Date := EncodeDate(1999, 1, 1);

DayTitleColor

property DayTitleColor : TColor;

Description Use DayTitleColor to change the background color for the day titles (Monday, Tuesday, Wednesday etc).

Example Display day titles with a gray background

cwMonthView1.DayTitleColor := clGray;

DayTitleFont

property DayTitleFont : TFont;

Description Use DayTitleFont to change the font used to display the day titles.

Example Display day titles in a bold font

cwMonthView1.DayTitleFont.Style := [fsBold];

DayTitleFormats

property DayTitleFormats : string;

DayTitleSize

property DayTitleSize : integer;

Description Use DayTitleSize to change the height of the row displaying day titles. You can hide day titles by specifying 0 as the size.

Example Hide day titles

cwMonthView1.DayTitleSize := 0;

FocusStyle

property FocusStyle : TSelectionStyle;

See also Grid options

Manager

property Manager : TcwManager;

See also TcwManager

MonthsHorizontally

property MonthsHorizontally : integer;

Description Use MonthsHorizontally to change the number of months displayed across the month view component.

Example Display 2 months across

cwMonthView1.MonthsAcross := 2;

MonthsVertically

property MonthsVertically : integer;

Description Use MonthsVertically to change the number of months displayed down the month view component.

Example Display 3 months down

cwMonthView1.MonthsAcross := 3;

MonthTitleColor

property MonthTitleColor : TColor;

Description Use MonthTitleColor to change the background color of the month title.

Example Display month title with a blue background

cwMonthView1.MonthTitleColor := clBlue;

MonthTitleFont

property MonthTitleFont : TFont;

Description Use MonthTitleFont to change the font used to display the month title.

Example Display month title with a white text

cwMonthView1.MonthTitleFont.Color := clWhite;

MonthTitleFormats

property MonthTitleFormats : string;

MonthTitleSize

property MonthTitleSize : integer;

Description Use MonthTitleSize to change the height of the row displaying the month title. You can hide the month title by specifying 0 as the size.

Example Hide the month title

cwMonthView1.MonthTitleSize := 0;

MultiSelection

property MultiSelection : boolean;

See also Grid options

NonDayColor

property NonDayColor : TColor;

Description Use NonDayColor to change the background color of cells which do not have dates.

Example Display non day cells with a gray

cwMonthView1.NonDayColor := clGray;

OriginDate

property OriginDate : FDate;

Description Use OriginDate to specify the first month to display in the month view component.

See also Date

Example Display the month of March 1999

cwMonthView1.OriginDate := EncodeDate(1999, 3, 1);

SelectionStyle

property SelectionStyle : TSelectionStyle;

See also Grid options

StartOfWeek

WeekdayColor

property WeekdayColor : TColor;

Description Use WeekdayColor to change the background color of week days (Monday through to Friday).

Example Display week days with a white background

cwMonthView1.WeekdayColor := clWhite;

WeekdayFont

property WeekdayFont : TFont;

Description Use WeekdayFont to change the font used to display week days (Monday through to Friday).

WeekendColor

property WeekendColor : TColor;

Description Use WeekendColor to change the background color of weekends (Saturday and Sunday).

Example Display weekends with a yellow background

cwMonthView1.WeekendColor := clYellow;

WeekendFont

property WeekendFont : TFont;

Description Use WeekendFont to change the font used to display week ends (Saturday and Sunday).

WrapDays

property WrapDays : boolean;

Description Set WrapDays to true to display each month in a compact 5 row format. Setting WrapDays to false will display each month using 6 rows.


Methods
GetCell

function GetCell(Date : TDate) : TcwMonthViewCell;

Description Use GetCell to retrieve the cell that represents a given date.

If the date is not currently displayed on the monthview component GetCell will return nil.


Example Change the background color of 1st January 1999 to red

var
   Cell : TcwMonthViewCell;
begin
   Cell := cwMonthView1.GetCell(EncodeDate(1999, 1, 1));
   if Cell <> nil then
      Cell.Color := clRed;
end;


Events
OnInitialize

Description OnInitialize is called whenever any of the following properties are changed :-

DayTitleColor, DayTitleFont, DayTitleSize, MonthsHorizontally, MonthsVertically, MonthTitleColor, MonthTitleFont, MonthTitleSize, NonDayColor, WeekdayColor, WeekdayFont, WeekendColor, WeekendFont or WrapDays.

It is also called if the MonthView is "scrolled" by changing the date.

If you wish to customize the appearance of your MonthView component do so within this event.


Example Append "Public Holiday" to the cell displaying January 1st 1999

procedure TcwMonthView1.OnInitialise(Sender : TObject);
var
   Cell : TcwMonthViewCell;
begin
   Cell := cwMonthView1.GetCell(EncodeDate(1999, 1, 1));
   if Cell <> nil then
      Cell.Text := Cell.Text + ' Public Holiday';
end;



Copyright © 1998-2007 Innova Software ALL RIGHTS RESERVED
All trademarks are the property of their respective owners.
Webmaster webmaster@innovasoftware.com