View Issue Details

IDProjectCategoryView StatusLast Update
0001947JEDI VCL00 JVCL Componentspublic2004-09-25 01:01
ReporterdeanhAssigned Toobones 
PrioritynormalSeveritytweakReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.00 RC 1 
Summary0001947: Enhancements for Calender TJvTFDays
DescriptionChanges to JvTFDays
===================

These changes peform the following functions.

1) The addition of a new time entry is aborted if the user presses escape.

2) New property for FancyHeader to only show the '00' minutes. This emulates outlook's behaviour.

3) Few changes to clean up the dithering of the background.

4) Hide the blank area that sometimes appears at the bottom of the Calendar when scrolling right down to the bottom.

5) Remove the focus rectangle as this is not shown in outlook.

It may be easier for me to apply the changes to the latest version from the CVS. Basically, the only things that have
changed from the version that I have is formatting and changing of RsEInvalidPrimeTimeStartTime to
@RsEInvalidPrimeTimeStartTime in the raising of exceptions.

Diff Changes:
=============

Add the following declaration to the private portion of TJvTFInPlaceApptEditor.

    FQuickCreate: Boolean;

Add the following declaration to the public portion of TJvTFInPlaceApptEditor.

    property QuickCreate: Boolean read FQuickCreate write FQuickCreate;

Add the following declarations to the private portion of TJvTFDaysFancyRowHdrAttr.

    FOnlyShow00Minutes: boolean;

    procedure SetOnlyShow00Minutes(Value: Boolean);

Add the following declarations to the public portion of TJvTFDaysFancyRowHdrAttr.

    property OnlyShow00Minutes: Boolean read FOnlyShow00Minutes write SetOnlyShow00Minutes
       default True;

Add the following code to the routine "constructor TJvTFInPlaceApptEditor.Create(AOwner: TComponent);"

   BorderStyle := bsNone;
   FQuickCreate := False; // Add this line

Add the following code to the routine "procedure TJvTFInPlaceApptEditor.DoExit;"

    if not FCancelEdit then
      TJvTFDays(Parent).FinishEditAppt
    else if FQuickCreate then // Add this line
      // Free the appointment // Add this line
      FLinkedAppt.Free; // Add this line

Add the following code to the routine "constructor TJvTFDaysFancyRowHdrAttr.Create(AOwner: TJvTFDays);"

  FMinorFont.OnChange := FontChange;
  FMajorFont.OnChange := FontChange;

  FOnlyShow00Minutes := True; // Add this line

Add the following routine after the routine "procedure TJvTFDaysFancyRowHdrAttr.SetTickColor(Value: TColor);"

procedure TJvTFDaysFancyRowHdrAttr.SetOnlyShow00Minutes(Value: Boolean);
begin
  if Value <> FOnlyShow00Minutes then
  begin
    FOnlyShow00Minutes := Value;
    Change;
  end;
end;

Change the following code in "procedure TJvTFDays.DrawDataCell(aCanvas: TCanvas; ColIndex, RowIndex: Integer);"

  if IsWeekend(ColIndex) and (CellColor = WeekendColor) then
    Windows.StretchBlt(aCanvas.Handle, aRect.Left, aRect.Top, RectWidth(aRect),
      RectHeight(aRect), FWeekendFillPic.Canvas.Handle,
      0, 0, FWeekendFillPic.Width,
      FWeekendFillPic.Height, SRCCOPY)

To:

  if IsWeekend(ColIndex) and (CellColor = WeekendColor) then
  begin
      if FDitheredBackground then
        DrawDither(ACanvas, ARect, CellColor, clWhite)
      else
      begin
        Windows.StretchBlt(aCanvas.Handle, aRect.Left, aRect.Top, RectWidth(aRect),
          RectHeight(aRect), FWeekendFillPic.Canvas.Handle,
          0, 0, FWeekendFillPic.Width,
          FWeekendFillPic.Height, SRCCOPY)
      end;
  end

Change the following code in "procedure TJvTFDays.DrawDataCell(aCanvas: TCanvas; ColIndex, RowIndex: Integer);"

  else if (CellColor <> Color) then
  begin
    aCanvas.Brush.Color := CellColor;
    aCanvas.FillRect(aRect);
  end;

To:

  else if (CellColor <> Color) then
  begin
    aCanvas.Brush.Color := CellColor;
    aCanvas.FillRect(aRect);
  end
  else
  begin
    if FDitheredBackground then
      DrawDither(ACanvas, ARect, CellColor, clWhite)
  end;

Comment out the following code in "procedure TJvTFDays.DrawDataCell(aCanvas: TCanvas; ColIndex, RowIndex: Integer);"

// if (ColIndex = FocusedCol) and (RowIndex = FocusedRow) and Focused then
// begin
// FocusRect := aRect;
// Windows.InflateRect(FocusRect, -1, -1);
// Dec(FocusRect.Bottom);
// Dec(FocusRect.Right);
// ManualFocusRect(aCanvas, FocusRect);
// end;

Comment out the following code in "procedure TJvTFDays.DrawRowHdr(aCanvas: TCanvas; Index: Integer);"

// if (Index = FocusedRow) and Focused then
// begin
// Windows.InflateRect(aRect, -2, -2);
// ManualFocusRect(aCanvas, aRect);
// Windows.InflateRect(aRect, 2, 2);
// end;

Comment out the following code in "procedure TJvTFDays.DrawFancyRowHdrs(aCanvas: TCanvas);"

// if FirstMajor or (PrevHour = 0) or (PrevHour = 12) then
// if PrevHour < 12 then
// aLabel := aLabel + 'a'
// else
// aLabel := aLabel + 'p';

Comment out the following code in "procedure TJvTFDays.DrawMinor(aCanvas: TCanvas; aRect: TRect; RowNum: Integer;
  const LabelStr: string; TickLength: Integer; Selected: Boolean);". Only do this is you don't want the focus rectangle.

// if (RowNum = FocusedRow) and Focused then
// begin
// Windows.InflateRect(MinorRect, -2, -2);
// MinorRect.Left := MinorRect.Right - aCanvas.TextWidth(LabelStr) - 2;
// ManualFocusRect(aCanvas, MinorRect);
// end;

Add the following lines to the Variable declaration in "function TJvTFDays.GetMinorLabel(RowNum: Integer): string;"

var
  iFirstHourRow: Integer; // Add this line
  aTimeFormat: string;
  tRowTime: TTime; // Add this line

Change the following code in "function TJvTFDays.GetMinorLabel(RowNum: Integer): string;"

  Result := FormatDateTime(aTimeFormat, RowToTime(RowNum));
end;

To:

  // Get the Row Time
  tRowTime := RowToTime(RowNum);

  if (FancyRowHdrAttr.OnlyShow00Minutes and (ExtractMins(tRowTime) = 0)) or
     (not FancyRowHdrAttr.OnlyShow00Minutes) then
  begin
    if (not FancyRowHdrAttr.Hr2400) and (Granularity < 60) then
    begin
      // Get the first row with a 00 hour
      iFirstHourRow := TopRow;
      while (iFirstHourRow < BottomRow) and (ExtractMins(RowToTime(iFirstHourRow)) <> 0) do
        Inc(iFirstHourRow);
      if (tRowTime = 0) then
        Result := 'am'
      else if (tRowTime = 0.50) then
        Result := 'pm'
      else if (RowNum = iFirstHourRow) and (ExtractMins(tRowTime) = 0) then
      begin
        if (tRowTime < 0.50) then
          Result := 'am'
        else
          Result := 'pm'
      end
      else
        Result := FormatDateTime(aTimeFormat, tRowTime);
    end
    else
      Result := FormatDateTime(aTimeFormat, tRowTime);
  end
  else
    Result := '';
end;

Change the following code in "procedure TJvTFDays.CheckSBParams;"

  if vsbVert in VisibleScrollBars then
    with FVScrollBar do
    begin
      Max := RowCount - 1;
      LargeChange := FullVisibleRows;
    end;

To:

  if vsbVert in VisibleScrollBars then
    with FVScrollBar do
    begin
      Max := RowCount - 2;
      LargeChange := FullVisibleRows;
    end;

Add the following line to "procedure TJvTFDays.QuickEntry(Key: Char);"

      SetSelAppt(Appt);
      EditAppt(SelStart.X, SelAppt);
       // Put the Key in the editor and set the caret
      FEditor.Text := Key;
      FEditor.SelStart := 1;
      FEditor.QuickCreate := True; // Add this line

Add the following as the first line of "procedure TJvTFDays.EditAppt(Col: Integer; Appt: TJvTFAppt);"

begin
  FEditor.QuickCreate := False; // Add this line
  EnsureCol(Col);

Comment out the following block of code in "procedure TJvTFDays.DrawColGroupHdr(aCanvas: TCanvas; Index: Integer;
  IsGroupHdr: Boolean);"

// if not IsGroupHdr and (Index = FocusedCol) and Focused then
// begin
// CalcRect := aRect;
// Windows.InflateRect(CalcRect, -2, -2);
// ManualFocusRect(aCanvas, CalcRect);
// {
// If Windows.IsRectEmpty(TxtRect) Then
// Windows.InflateRect(TxtRect, 5, 5);
// ManualFocusRect(aCanvas, TxtRect);
// }
// end;
Additional InformationE-Mail me if you want the full file.
TagsNo tags attached.

Activities

obones

2004-08-31 10:54

administrator   ~0005125

Can you add this file as an attachment to this bug?

Thanks a lot for your help

2004-08-31 11:23

 

JvTFDays.zip (72,272 bytes)

deanh

2004-08-31 11:23

reporter   ~0005126

File added as an attachment

user72

2004-09-05 06:40

  ~0005187

I've comitted the updates to CVS. Thanks! I've added a ShowFocus:Boolean property tocontrol the focus rect drawing. I would also like to know why the "FirstMajor" code was removed?

deanh

2004-09-05 11:36

reporter   ~0005193

The 'am' and 'pm' are now added in the GetMinorLabel function which is the way it is done in Outlook. In the old code, an 'a' or a 'p' was added to the Major title to signify the 'am' or 'pm'.

user72

2004-09-12 10:45

  ~0005222

Last edited: 2004-09-12 10:45

Should FirstMajor be removed from TJvTFDaysPrinter.DrawFancyRowHdrs as well, then?

edited on: 09-12-04 10:45

user72

2004-09-25 01:01

  ~0005259

No reply in a long time, so assuming all is OK

Issue History

Date Modified Username Field Change
2004-07-07 10:13 deanh New Issue
2004-07-08 04:56 obones Status new => assigned
2004-07-08 04:56 obones Assigned To => obones
2004-08-31 10:54 obones Note Added: 0005125
2004-08-31 10:54 obones Status assigned => feedback
2004-08-31 11:23 deanh File Added: JvTFDays.zip
2004-08-31 11:23 deanh Note Added: 0005126
2004-09-05 06:40 user72 Note Added: 0005187
2004-09-05 11:36 deanh Note Added: 0005193
2004-09-12 10:45 user72 Note Added: 0005222
2004-09-12 10:45 user72 Note Edited: 0005222
2004-09-25 01:01 user72 Status feedback => resolved
2004-09-25 01:01 user72 Resolution open => fixed
2004-09-25 01:01 user72 Note Added: 0005259