anchor.diff:    end;
   
   
  +{@VFD_NEWFORM_DECL}
  +
   
   implementation
   
  
positive.code:     FSelectedColor: TfpgColor;
      FSingleClickSelect: boolean;
      FMonthsPopupMenu: TfpgPopupMenu;
      function    GetDateElement(Index: integer): Word;
      procedure   PopulateDays;
      procedure   CalculateMonthOffset;
  
negative.code: 
  
  {@VFD_NEWFORM_IMPL}
  
  procedure TYearSelectForm.YearClicked(Sender: TObject);
  begin
    FYear := StrToInt(TfpgHyperlink(Sender).Text);
    Close;
  end;
  
  procedure TYearSelectForm.SetYear(const AValue: Word);
  
    function IsInRange(const AYear: word): boolean;
    begin
      // always one year less on either side (min and max) so we don't go over
      // any possible month limits.
      Result := (AYear > MinYear) and (AYear < MaxYear);
    end;
  
  begin
    if FYear = AValue then exit;
    FYear := AValue;
    if FOriginalYear = 0 then
      FOriginalYear := FYear;
    Label1.Text := IntToStr(FYear-4);
    Label1.Enabled := IsInRange(FYear-4);
    Label2.Text := IntToStr(FYear-3);
    Label2.Enabled := IsInRange(FYear-3);
    Label3.Text := IntToStr(FYear-2);
    Label3.Enabled := IsInRange(FYear-2);
    Label4.Text := IntToStr(FYear-1);
    Label4.Enabled := IsInRange(FYear-1);
    Label5.Text := IntToStr(FYear);
    if FYear = FOriginalYear then
      Label5.FontDesc := '#Label2'
    else
      Label5.FontDesc := '#Label1';
    Label5.Enabled := IsInRange(FYear);
    Label6.Text := IntToStr(FYear+1);
    Label6.Enabled := IsInRange(FYear+1);
    Label7.Text := IntToStr(FYear+2);
    Label7.Enabled := IsInRange(FYear+2);
    Label8.Text := IntToStr(FYear+3);
    Label8.Enabled := IsInRange(FYear+3);
    Label9.Text := IntToStr(FYear+4);
    Label9.Enabled := IsInRange(FYear+4);
    Label10.Text := IntToStr(FYear+5);
    Label10.Enabled := IsInRange(FYear+5);
  end;
  
  procedure TYearSelectForm.Minus10Clicked(Sender: TObject);
  begin
    SetYear(FYear-10);
  end;
  
  procedure TYearSelectForm.Plus10Clicked(Sender: TObject);
  begin
    SetYear(FYear+10);
  end;
  
  procedure TYearSelectForm.HandlePaint;
  begin
  //  inherited HandlePaint;
    Canvas.BeginDraw;
    Canvas.Clear(BackgroundColor);
    Canvas.SetColor(clWindowBackground);
    Canvas.DrawRectangle(0, 0, Width, Height);  // black rectangle border
    Canvas.DrawButtonFace(1, 1, Width-1, Height-1, []);  // 3d rectangle inside black border
    Canvas.EndDraw;
  end;
  
  constructor TYearSelectForm.CreateCustom(AOwner: TComponent; const MinYear, MaxYear: Word);
  begin
    Create(AOwner);
    FYear := 0;
    FOriginalYear := 0;
    FMinYear := MinYear;
    FMaxYear := MaxYear;
    WriteLn(FMinYear, ' ', FMaxYear);
  end;
  
  procedure TYearSelectForm.AfterConstruction;
  begin
    inherited AfterConstruction;
    AfterCreate;
  end;
  
  procedure TYearSelectForm.AfterCreate;
  begin
    {%region 'Auto-generated GUI code' -fold}
    {@VFD_BODY_BEGIN: YearSelectForm}
    Name := 'YearSelectForm';
    SetPosition(439, 401, 130, 122);
  //  WindowTitle := 'YearSelectForm';
  //  Hint := '';
  //  Sizeable := False;
  
    btnMinus10 := TfpgButton.Create(self);
    with btnMinus10 do
    begin
      Name := 'btnMinus10';
      SetPosition(4, 4, 24, 24);
      Text := '';
      FontDesc := '#Label1';
      Hint := '';
      ImageMargin := -1;
      ImageName := 'sys.sb.left';
      ImageSpacing := 0;
      TabOrder := 1;
      OnClick := @Minus10Clicked;
    end;
  
    btnPlus10 := TfpgButton.Create(self);
    with btnPlus10 do
    begin
      Name := 'btnPlus10';
      SetPosition(104, 4, 24, 24);
      Text := '';
      FontDesc := '#Label1';
      Hint := '';
      ImageMargin := -1;
      ImageName := 'sys.sb.right';
      ImageSpacing := 0;
      TabOrder := 2;
      OnClick := @Plus10Clicked;
    end;
  
    Bevel1 := TfpgBevel.Create(self);
    with Bevel1 do
    begin
      Name := 'Bevel1';
      SetPosition(64, 32, 2, 85);
      Hint := '';
      Style := bsLowered;
    end;
  
    Label1 := TfpgHyperlink.Create(self);
    with Label1 do
    begin
      Name := 'Label1';
      SetPosition(8, 32, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label2 := TfpgHyperlink.Create(self);
    with Label2 do
    begin
      Name := 'Label2';
      SetPosition(8, 48, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label3 := TfpgHyperlink.Create(self);
    with Label3 do
    begin
      Name := 'Label3';
      SetPosition(8, 64, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label4 := TfpgHyperlink.Create(self);
    with Label4 do
    begin
      Name := 'Label4';
      SetPosition(8, 80, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label5 := TfpgHyperlink.Create(self);
    with Label5 do
    begin
      Name := 'Label5';
      SetPosition(8, 96, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label6 := TfpgHyperlink.Create(self);
    with Label6 do
    begin
      Name := 'Label6';
      SetPosition(76, 32, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label7 := TfpgHyperlink.Create(self);
    with Label7 do
    begin
      Name := 'Label7';
      SetPosition(76, 48, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label8 := TfpgHyperlink.Create(self);
    with Label8 do
    begin
      Name := 'Label8';
      SetPosition(76, 64, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label9 := TfpgHyperlink.Create(self);
    with Label9 do
    begin
      Name := 'Label9';
      SetPosition(76, 80, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    Label10 := TfpgHyperlink.Create(self);
    with Label10 do
    begin
      Name := 'Label10';
      SetPosition(76, 96, 44, 16);
      Alignment := taCenter;
      FontDesc := '#Label1';
      Hint := '';
      Text := 'Label';
      TextColor := clText1;
      HotTrackFont := '#Label1';
      OnClick := @YearClicked;
    end;
  
    {@VFD_BODY_END: YearSelectForm}
    {%endregion}
  end;
  
  
  procedure TfpgPopupCalendar.PopulateDays;
  var
  