jvcllaz: Add demo for TJvYearGrid.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6326 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2018-04-20 12:58:33 +00:00
parent f4b8e9b51c
commit c4109bd145
4 changed files with 498 additions and 0 deletions

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="YearGrid_Demo"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="JvJansLazR"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="YearGrid_Demo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="..\..\bin\YearGrid_Demo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,23 @@
program YearGrid_Demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
LclVersion, Forms, main;
{$R *.res}
begin
RequireDerivedFormResource := True;
{$IF LCL_FULLVERSION >= 1080000}
Application.Scaled := True;
{$ENDIF}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,276 @@
object Form1: TForm1
Left = 310
Height = 777
Top = 127
Width = 838
AutoSize = True
Caption = 'Form1'
ClientHeight = 777
ClientWidth = 838
OnCreate = FormCreate
LCLVersion = '1.9.0.0'
object JvYearGrid1: TJvYearGrid
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 8
Height = 248
Top = 8
Width = 734
HTMLBorder = False
HTMLFontName = 'Arial'
Year = 2018
AutoSizeOptions = [aoGrid, aoFirstColumn, aoFirstRow, aoColumns, aoRows]
FirstColWidth = 67
FirstRowHeight = 19
CellMargins.Left = 2
CellMargins.Top = 2
CellMargins.Right = 2
CellMargins.Bottom = 2
WeekendDays = [wdSaturday, wdSunday]
MonthNamesAlignment = taCenter
DayNamesAlignment = taCenter
DaysAlignment = taCenter
BorderSpacing.Around = 8
ScrollBars = ssNone
TitleStyle = tsStandard
ColWidths = (
67
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
)
RowHeights = (
19
19
19
19
19
19
19
19
19
19
19
19
19
)
end
object Panel1: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = JvYearGrid1
AnchorSideTop.Side = asrBottom
Left = 0
Height = 97
Top = 264
Width = 558
AutoSize = True
BevelOuter = bvNone
ClientHeight = 97
ClientWidth = 558
TabOrder = 1
object EdLeftMargin: TSpinEdit
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = EdTopMargin
AnchorSideTop.Side = asrBottom
Left = 16
Height = 23
Top = 31
Width = 50
BorderSpacing.Left = 16
BorderSpacing.Top = 4
OnChange = EdLeftMarginChange
TabOrder = 0
end
object EdRightMargin: TSpinEdit
AnchorSideLeft.Control = EdTopMargin
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = EdLeftMargin
Left = 136
Height = 23
Top = 31
Width = 50
BorderSpacing.Left = 4
OnChange = EdRightMarginChange
TabOrder = 1
end
object EdTopMargin: TSpinEdit
AnchorSideLeft.Control = EdLeftMargin
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 74
Height = 23
Top = 4
Width = 58
BorderSpacing.Left = 8
BorderSpacing.Top = 4
OnChange = EdTopMarginChange
TabOrder = 2
end
object EdBottomMargin: TSpinEdit
AnchorSideLeft.Control = EdTopMargin
AnchorSideTop.Control = EdLeftMargin
AnchorSideTop.Side = asrBottom
Left = 74
Height = 23
Top = 58
Width = 58
BorderSpacing.Top = 4
OnChange = EdBottomMarginChange
TabOrder = 3
end
object CbDayNamesAlignment: TComboBox
AnchorSideLeft.Control = Label1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = EdTopMargin
Left = 363
Height = 23
Top = 4
Width = 100
BorderSpacing.Left = 8
ItemHeight = 15
Items.Strings = (
'taLeftJustify'
'taRightJustify'
'taCenter'
)
OnChange = CbDayNamesAlignmentChange
Style = csDropDownList
TabOrder = 4
end
object Label1: TLabel
AnchorSideTop.Control = CbDayNamesAlignment
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Label2
AnchorSideRight.Side = asrBottom
Left = 242
Height = 15
Top = 8
Width = 113
Anchors = [akTop, akRight]
Caption = 'DayNamesAlignment'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = EdRightMargin
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbMonthNamesAlignment
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Label1
AnchorSideRight.Side = asrBottom
Left = 226
Height = 15
Top = 35
Width = 129
BorderSpacing.Left = 40
Caption = 'MonthNamesAlignment'
ParentColor = False
end
object CbMonthNamesAlignment: TComboBox
AnchorSideLeft.Control = CbDayNamesAlignment
AnchorSideTop.Control = CbDayNamesAlignment
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CbDayNamesAlignment
AnchorSideRight.Side = asrBottom
Left = 363
Height = 23
Top = 31
Width = 100
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
ItemHeight = 15
Items.Strings = (
'taLeftJustify'
'taRightJustify'
'taCenter'
)
OnChange = CbMonthNamesAlignmentChange
Style = csDropDownList
TabOrder = 5
end
object Label3: TLabel
AnchorSideTop.Control = CbDaysAlignment
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Label1
AnchorSideRight.Side = asrBottom
Left = 274
Height = 15
Top = 62
Width = 81
Anchors = [akTop, akRight]
Caption = 'DaysAlignment'
ParentColor = False
end
object CbDaysAlignment: TComboBox
AnchorSideLeft.Control = CbDayNamesAlignment
AnchorSideTop.Control = CbMonthNamesAlignment
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CbDayNamesAlignment
AnchorSideRight.Side = asrBottom
Left = 363
Height = 23
Top = 58
Width = 100
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
BorderSpacing.Bottom = 16
ItemHeight = 15
Items.Strings = (
'taLeftJustify'
'taRightJustify'
'taCenter'
)
OnChange = CbDaysAlignmentChange
Style = csDropDownList
TabOrder = 6
end
object CbFlat: TCheckBox
AnchorSideLeft.Control = CbDayNamesAlignment
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbMonthNamesAlignment
AnchorSideTop.Side = asrCenter
Left = 503
Height = 19
Top = 33
Width = 39
BorderSpacing.Left = 40
BorderSpacing.Right = 16
Caption = 'Flat'
OnChange = CbFlatChange
TabOrder = 7
end
end
end

View File

@ -0,0 +1,113 @@
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Spin, StdCtrls, Grids,
ExtCtrls, JvYearGrid;
type
{ TForm1 }
TForm1 = class(TForm)
CbDayNamesAlignment: TComboBox;
CbMonthNamesAlignment: TComboBox;
CbDaysAlignment: TComboBox;
CbFlat: TCheckBox;
JvYearGrid1: TJvYearGrid;
EdLeftMargin: TSpinEdit;
EdRightMargin: TSpinEdit;
EdTopMargin: TSpinEdit;
EdBottomMargin: TSpinEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Panel1: TPanel;
procedure CbDayNamesAlignmentChange(Sender: TObject);
procedure CbDaysAlignmentChange(Sender: TObject);
procedure CbFlatChange(Sender: TObject);
procedure CbMonthNamesAlignmentChange(Sender: TObject);
procedure EdBottomMarginChange(Sender: TObject);
procedure EdLeftMarginChange(Sender: TObject);
procedure EdRightMarginChange(Sender: TObject);
procedure EdTopMarginChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.CbDayNamesAlignmentChange(Sender: TObject);
begin
JvYearGrid1.DayNamesAlignment := TAlignment(CbDayNamesAlignment.ItemIndex);
end;
procedure TForm1.CbDaysAlignmentChange(Sender: TObject);
begin
JvYearGrid1.DaysAlignment := TAlignment(CbDaysAlignment.ItemIndex);
end;
procedure TForm1.CbFlatChange(Sender: TObject);
begin
JvYearGrid1.Flat := CbFlat.Checked;
end;
procedure TForm1.CbMonthNamesAlignmentChange(Sender: TObject);
begin
JvYearGrid1.MonthNamesAlignment := TAlignment(CbMonthNamesAlignment.ItemIndex);
end;
procedure TForm1.EdBottomMarginChange(Sender: TObject);
begin
JvYearGrid1.CellMargins.Bottom := EdBottomMargin.Value;
end;
procedure TForm1.EdLeftMarginChange(Sender: TObject);
begin
JvYearGrid1.CellMargins.Left := EdLeftMargin.Value;
end;
procedure TForm1.EdRightMarginChange(Sender: TObject);
begin
JvYearGrid1.CellMargins.Right := EdRightMargin.Value;
end;
procedure TForm1.EdTopMarginChange(Sender: TObject);
begin
JvYearGrid1.CellMargins.Top := EdTopMargin.Value;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
EdLeftMargin.Value := JvYearGrid1.CellMargins.Left;
EdRightMargin.Value := JvYearGrid1.CellMargins.Right;
EdTopMargin.Value := JvYearGrid1.CellMargins.Top;
EdBottomMargin.Value := JvYearGrid1.CellMargins.Bottom;
CbDayNamesAlignment.ItemIndex := ord(JvYearGrid1.DayNamesAlignment);
CbMonthNamesAlignment.ItemIndex := ord(JvYearGrid1.MonthNamesAlignment);
CbDaysAlignment.ItemIndex := ord(JvYearGrid1.DaysAlignment);
CbFlat.Checked := JvYearGrid1.Flat;
end;
initialization
{$IFDEF WINDOWS}
GetLocaleFormatSettings(1033, FormatSettings);
{$ENDIF}
end.