You've already forked lazarus-ccr
tvplanit: Add demo for TVpCalendar.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8451 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
185
components/tvplanit/examples/calendar/main.pas
Normal file
185
components/tvplanit/examples/calendar/main.pas
Normal file
@ -0,0 +1,185 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
|
||||
Spin,
|
||||
VpBaseDS, VpMisc, VpIniDs, VpContactGrid, VpCalendar;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
cbActiveDayBorderColor: TColorButton;
|
||||
cbActiveDayTextColor: TColorButton;
|
||||
cbDayNamesColor: TColorButton;
|
||||
cbDaysColor: TColorButton;
|
||||
cbBackgroundColor: TColorButton;
|
||||
cbInactiveDaysColor: TColorButton;
|
||||
cbMonthAndYearColor: TColorButton;
|
||||
cbWeekendColor: TColorButton;
|
||||
cbEventDaysColor: TColorButton;
|
||||
cbBorder: TCheckBox;
|
||||
cbActiveDayColor: TColorButton;
|
||||
cgOptions: TCheckGroup;
|
||||
cbWeekStarts: TComboBox;
|
||||
lblWeekStarts: TLabel;
|
||||
lblDayNameWidth: TLabel;
|
||||
Panel1: TPanel;
|
||||
rgColorScheme: TRadioGroup;
|
||||
seDayNameWidth: TSpinEdit;
|
||||
VpCalendar1: TVpCalendar;
|
||||
VpControlLink1: TVpControlLink;
|
||||
VpIniDatastore1: TVpIniDatastore;
|
||||
procedure cbActiveDayBorderColorColorChanged(Sender: TObject);
|
||||
procedure cbActiveDayTextColorColorChanged(Sender: TObject);
|
||||
procedure cbBackgroundColorColorChanged(Sender: TObject);
|
||||
procedure cbDayNamesColorColorChanged(Sender: TObject);
|
||||
procedure cbDaysColorColorChanged(Sender: TObject);
|
||||
procedure cbInactiveDaysColorColorChanged(Sender: TObject);
|
||||
procedure cbMonthAndYearColorColorChanged(Sender: TObject);
|
||||
procedure cbEventDaysColorColorChanged(Sender: TObject);
|
||||
procedure cbWeekendColorColorChanged(Sender: TObject);
|
||||
procedure cbWeekStartsChange(Sender: TObject);
|
||||
procedure cgOptionsItemClick(Sender: TObject; Index: integer);
|
||||
procedure cbBorderChange(Sender: TObject);
|
||||
procedure cbActiveDayColorColorChanged(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure rgColorSchemeClick(Sender: TObject);
|
||||
procedure seDayNameWidthChange(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
VpBase;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
option: TVpCalDisplayOption;
|
||||
begin
|
||||
if VpIniDatastore1.Resources.Count > 0 then
|
||||
VpIniDatastore1.Resource := VpIniDatastore1.Resources.Items[0];
|
||||
|
||||
for option in TVpCalDisplayOption do
|
||||
cgOptions.Checked[ord(option)] := option in VpCalendar1.Options;
|
||||
|
||||
rgColorScheme.ItemIndex := ord(VpCalendar1.Colors.ColorScheme);
|
||||
seDayNameWidth.Value := VpCalendar1.DayNameWidth;
|
||||
cbWeekStarts.ItemIndex := ord(VpCalendar1.WeekStarts);
|
||||
end;
|
||||
|
||||
procedure TForm1.rgColorSchemeClick(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.ColorScheme := TVpCalColorScheme(rgColorScheme.ItemIndex);
|
||||
|
||||
cbActiveDayColor.ButtonColor := VpCalendar1.Colors.ActiveDay;
|
||||
cbActiveDayBorderColor.ButtonColor := VpCalendar1.Colors.ActiveDayBorder;
|
||||
cbActiveDayTextColor.ButtonColor := VpCalendar1.Colors.ActiveDayText;
|
||||
cbDayNamesColor.ButtonColor := VpCalendar1.Colors.DayNames;
|
||||
cbDaysColor.ButtonColor := VpCalendar1.Colors.Days;
|
||||
cbInactiveDaysColor.ButtonColor := VpCalendar1.Colors.InactiveDays;
|
||||
cbMonthAndYearColor.ButtonColor := VpCalendar1.Colors.MonthAndYear;
|
||||
cbEventDaysColor.ButtonColor := VpCalendar1.Colors.EventDays;
|
||||
cbWeekendColor.ButtonColor := VpCalendar1.Colors.Weekend;
|
||||
cbBackgroundColor.ButtonColor := VpCalendar1.Colors.Background;
|
||||
end;
|
||||
|
||||
procedure TForm1.seDayNameWidthChange(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.DayNameWidth := seDayNameWidth.Value;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbBorderChange(Sender: TObject);
|
||||
begin
|
||||
if cbBorder.Checked then
|
||||
VpCalendar1.BorderStyle := bsSingle
|
||||
else
|
||||
VpCalendar1.BorderStyle := bsNone;
|
||||
end;
|
||||
|
||||
procedure TForm1.cgOptionsItemClick(Sender: TObject; Index: integer);
|
||||
var
|
||||
options: TVpCalDisplayOptions;
|
||||
i: Integer;
|
||||
begin
|
||||
options := [];
|
||||
for i := 0 to cgOptions.Items.Count-1 do
|
||||
if cgOptions.Checked[i] then
|
||||
Include(options, TVpCalDisplayOption(i));
|
||||
VpCalendar1.Options := options;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbActiveDayColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.ActiveDay := cbActiveDayColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbDayNamesColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.DayNames := cbDayNamesColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbBackgroundColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.Background := cbBackgroundColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbActiveDayBorderColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.ActiveDayBorder := cbActiveDayBorderColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbActiveDayTextColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.ActiveDayText := cbActiveDayTextColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbInactiveDaysColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.InactiveDays := cbInactiveDaysColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbMonthAndYearColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.MonthAndYear := cbMonthAndYearColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbEventDaysColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.EventDays := cbEventDaysColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbDaysColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.Days := cbDaysColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbWeekendColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.Colors.Weekend := cbWeekendColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbWeekStartsChange(Sender: TObject);
|
||||
begin
|
||||
VpCalendar1.WeekStarts := TVpDayType(cbWeekStarts.ItemIndex);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user