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
TcwDayView

Unit: cwDay

Ancestor: TCustomgwGrid

Properties
CellColor, CellFont, CellHeight, CellWidth, Days, DayCount, DayTitleColor, DayTitleFont, DayTitleFormats, DayTitleSize, EndHour, FocusStyle, GroupBy, HourColor, HourFont, HourSize, Interval, Manager, MinuteColor, MinuteFont, MinuteSize, MultiSelection, Orientation, Resource, ResourceCount, ResourceIDs, ResourceTitles, ResourceTitleColor, ResourceTitleFont, ResourceTitleSize, SelectionStyle, StartHour, StretchHorizontally, StretchVertically,
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
CellColor

property CellColor : TColor;

Description Use CellColor to change the background color for "timeslot" cells.

CellFont

property CellFont : TFont;

Description Use CellFont to change the font used to display "timeslot" cells.

CellHeight

property CellHeight : integer;

Description Use CellHeight to change the height of "timeslot" cells.

This will only have an effect if StretchVertically is false.


CellWidth

property CellWidth : integer;

Description Use CellWidth to change the width of "timeslot" cells.

This will only have an effect if StretchHorizontally is false.


Days

property Days[DayNumber : Integer] : TDate;

Description Use Days to specify the actual days displayed. DayNumber must be in the range 0 to DayCount - 1

See also DayCount

DayCount

property DayCount : integer;

Description Use DayCount to change the number of days displayed in the day view

See also Days
ResourceCount

DayTitleColor

property DayTitleColor : TColor;

Description Use DayTitleColor to change the background color for day titles.

Example Display day titles with a gray background

cwDayView1.DayTitleColor := clGray;

DayTitleFont

property DayTitleFont : TFont;

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

Example Display day titles in a bold font

cwDayView1.DayTitleFont.Style := [fsBold];

DayTitleFormats

property DayTitleFormats : string;

DayTitleSize

property DayTitleSize : integer;

Description Use DayTitleSize to change the height of the row (or width of the column if orientation oHorizontal) displaying day titles.

You can hide day titles by specifying 0 as the size.


Example Hide day titles

cwWeekView1.DayTitleSize := 0;

EndHour

property EndHour : integer;

Description Use EndHour to specify the last hour displayed.

Hours are in 24 hr format so 9am is 9, 4pm is 16, etc.


Example Show times upto (but not including) 5pm

cwDayView1.EndHour := 16;

FocusStyle

property FocusStyle : TSelectionStyle;

See also Grid options

GroupBy

property GroupBy : TcwdvGroupBy;

Description Use GroupBy to determine whether the day view is arranged by resource or date

Example Group by date
begin
   cwDayView1.GroupBy := gbDate;
end;
         
Grouped by date
Grouped by date

Example Group by resource
begin
   cwDayView1.GroupBy := gbResource;
end;
         
Grouped by resource
Grouped by resource

HourColor

property HourColor : TColor;

Description Use HourColor to change the background color for the hour column (or row if orientation is oHorizontal).

HourFont

property HourFont : TFont;

Description Use HourFont to change the font used for the hour column (or row if orientation is oHorizontal).

HourSize

property HourSize : integer;

Description Use HourSize to change the width of the column (or height of the row if orientation is oHorizontal) displaying hour labels.

You can hide hour labels by specifying 0 as the size.


Interval

property Interval : integer;

Description Use Interval to change "timeslot" interval. Timeslots can be in 5, 6, 10, 12, 15, 20, 30 or 60 minute intervals

Manager

property Manager : TcwManager;

See also TcwManager

MinuteColor

property MinuteColor : TColor;

Description Use MinuteColor to change the background color for the minute column (or row if orientation is oHorizontal).

MinuteFont

property MinuteFont : TFont;

Description Use MinuteFont to change the font used for the minute column (or row if orientation is oHorizontal).

MinuteSize

property MinuteSize : integer;

Description Use MinuteSize to change the width of the column (or height of the row if orientation is oHorizontal) displaying minute labels.

You can hide minute labels by specifying 0 as the size.


MultiSelection

property MultiSelection : boolean;

See also Grid options

Orientation

property Orientation : TOrientation;

Description Use Orientation to change the orientation (vertical or horizontal) of the DayView component.

After changing the orientation you may want to adjust the following properties CellHeight, CellWidth, HourSize, MinuteSize, StretchHorizontally and StretchVertically.


Resource

property Resource : integer;

Description Use Resource to determine the resource column (or row if Orientation is oHorizontal) that is selected.

Please note Resource refers the resource number (0 to ResourceCount - 1) and not the resource ID.

Setting Resource has no effect if ResourceCount is zero


ResourceCount

property ResourceCount : integer;

Description Use ResourceCount to change the number of resources displayed in the day view

Please note If you do not want to display any resources set ResourceCount to 0.

See also ResourceTitles
ResourceIDs

Example Configure a day view to display December 25th 1999 and January 1st 2000 for three resources, Dr Jones, Dr Smith and Dr Crayn.
begin
   with cwDayView1 do begin

      // Suspend screen updates to prevent "flicker"
      BeginUpdate;

      // Configure dates
      DayCount := 2;
      Days[0] := EncodeDate(1999, 12, 25);
      Days[1] := EncodeDate(2000, 1, 1);

      // Configure Resources
      ResourceCount := 3;
      ResourceTitles[0] := 'Dr Jones';
      ResourceIDs[0] := '93'; // Doctor Jones is resource 93
      ResourceTitles[1] := 'Dr Smith';
      ResourceIDs[1] := '12'; // Doctor Smith is resource 12
      ResourceTitles[2] := 'Dr Crayn';
      ResourceIDs[2] := '37'; // Doctor Crayn is resource 37

      // Group by date
      GroupBy := gbDate;

      // Resume screen updates
      EndUpdate;

   end;
end;
Day view with multiple resources
Day view with multiple resources

ResourceIDs

property ResourceIDs[ResourceNumber : integer] : string;

Description User ResourceIDs to specify the unique identifer of each resource being displayed.

ResourceNumber must be in the range 0 to ResourceCount - 1


See also ResourceCount

ResourceTitles

property ResourceTitles[ResourceNumber : integer] : string;

Description Use ResourceTitles to change the title of each resource.

ResourceNumber must be in the range 0 to ResourceCount - 1


See also ResourceCount

ResourceTitleColor

property ResourceTitleColor : TColor;

Description Use ResourceTitleColor to change the background color for resource titles.

ResourceTitleFont

property ResourceTitleFont : TFont;

Description Use ResourceTitleFont to change the font used to display resource titles.

ResourceTitleSize

property ResourceTitleSize : integer;

Description Use ResourceTitleSize to change the height of the row (or width of the column if orientation oHorizontal) displaying resource titles.

You can hide resource titles by specifying 0 as the size.


SelectionStyle

property SelectionStyle : TSelectionStyle;

See also Grid options

StartHour

property StartHour : integer;

Description Use StartHour to specify the first hour displayed.

Hours are in 24 hr format so 9am is 9, 4pm is 16, etc.


Example Show times starting at 9am

cwDayView1.StartHour := 9;

StretchHorizontally

property StretchHorizontally : boolean;

Description Set StretchHorizontally to true to stretch (or compress) "timeslot" cells so that all cells are visible horizontally.

When StretchHorizontally is false timeslot cells will have a width of CellWidth.


StretchVertically

property StretchVertically : boolean;

Description Set StretchVertically to true to stretch (or compress) "timeslot" cells so that all cells are visible vertically.

When StretchVertically is false timeslot cells will have a height of CellHeight.



Methods
GetCell

function GetCell(DateTime : TDateTime; Resource : integer) : TcwDayViewCell;

Description Use GetCell to find the cell which represents a given date, time and resource.

Please note Nil will be returned if there is no cell which represents the given date, time and resource

Please note Resource refers the resource number (0 to ResourceCount - 1) and not the resource ID. If you are not using resources (ie ResourceCount is 0) set Resource to 0

Example Get cell that represents 9:30am on 25th December 1999
var
   Cell : TcwDayViewCell;
begin
   Cell := DayView1.GetCell(EncodeDate(1999, 12, 25) +
                            EncodeTime(9, 30, 0, 0),
                            0);
   if Cell <> nil then begin

      // Do something with the cell here

   end;
end;


Events
OnInitialize

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

CellColor, CellFont, DayTitleColor, DayTitleFont, DayTitleSize, EndHour, HourColor, HourFont, HourSize, Interval, MinuteColor, MinuteFont, MinuteSize, Orientation, or StartHour.

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



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