Copyright: Visual Help Copyright® 1993 Firas Bushnaq


TPopCal Component

Properties

Methods

The Popup calendar component is a handy way for users to select a date from a visual calendar using the mouse.  No more typing date entries !
Just call the GetDate Method and the calendar does the rest.  The calendar can be displayed as a month or a full year (refer to the Mode property).


Properties

Format

Title

SeedDate

DateSelected

Top

Left

Mode


Format Property

Description

The format property is a string that will be used to format the DateSelected property when the user selects the date from the calendar.  This string can be any valid date format.  The default property value is 'mm/dd/yy'.

Example:

Popcal1.format := 'mm/dd/yyyy';


Title Property

Description

The Title property is the string you wish to use for the popup calendar's caption.

Example:

Popcal1.title := 'Acquisition Date';


SeedDate Property

Description

The seeddate property is a TDateTime property the date that the calendar will default to when the GetDate method is called.  If no seeddate is supplied the calendar defaults to the current date.  This property is essential for routines that use 'sticky' dates.  Refer to the example below.

Example:

procedure TForm1.Speedbutton1click(Sender:TObject);
begin
          Popcal1.Seeddate := LastDateentered;
          Popcal1.format := 'mm/dd/yy';
          Popcal1.GetDate;
          edit1.text := Popcal1.DateSelected;
          LastDateentered := Strtodate(Popcal1.DateSelected);
end;

The above example implements 'sticky' dates where the calendar defaults to the last date entered by the user.


DateSelected Property

Description

This is a string property that contains the date that the user selected from the popup calendar.  The string is formatted according to the Format property.

See Also:

Format Property

Example:

procedure TForm1.Speedbutton1click(Sender:TObject);
begin
          Popcal1.format := 'mm/dd/yy';
          Popcal1.GetDate;
          edit1.text := Popcal1.DateSelected;
end;


Top Property

Description

The top property determines the y coordinate of the top left corner of the popup calendar.

See Also:

Left Property


Left Property

Description

The left property determines the x coordinate of the top left corner of the popup calendar.

See Also:

Top Property


Mode Property

Description:

The mode property determines the type of display to use.  If mode is 0 the standard calendar for the month is used.  If mode is 1 a twelve month calendar is used.  The user can toggle between the monthly calendar and the full year (year at a glance) displays by hitting F1 at run time.


GetDate Method

Description

The GetDate method causes the component to display its calendar (modally) and allow the user to select a date.  The user can navigate the calendar using the arrow keys or select a date directly with the mouse.  When the user clicks on a valid date, the method stores the date selected in the DateSelected property and removes the calendar from the screen.  This is done as well when the user presses the enter key.  If the user presses the escape key, no date is stored and the calendar is removed.
After the call to GetDate, query the DateSelected property to get the date the user selected.