Show unavailable dates in TsDateEdit

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40442
    Support
    Keymaster

    The OnGetCellParams event has a constant list of parameters which can't be changed because existing projects will have a problem with compatibility in this case.

    The OnAcceptDate event occurs after a clicking and allows to disable an accepting of the custom date.

    I think, will be better solution to call the “OnAcceptDate” event twice – before painting of cell and after clicking.

    Cells may be marked as unallowed in this case… How you think?

    #40445
    HeDiBo
    Participant
    'Support' wrote:

    The OnGetCellParams event has a constant list of parameters which can't be changed because existing projects will have a problem with compatibility in this case.

    The OnAcceptDate event occurs after a clicking and allows to disable an accepting of the custom date.

    I think, will be better solution to call the “OnAcceptDate” event twice – before painting of cell and after clicking.

    Cells may be marked as unallowed in this case… How you think?

    I've done it as follows:

    Code:
    procedure TFr_Planner.deDateStartGetCellParams( Sender: TObject;
    Date: TDateTime;
    AFont: TFont;
    var Background: TColor );
    var
    Accepted: Boolean;
    begin
    deDateStartAcceptDate( Sender, Date, Accepted ); // Call the OnAcceptDate event
    if Accepted then Exit;
    AFont.Style := [];
    AFont.Color := SysColorToSkin(clGrayText, sFrameAdapter1.SkinData.SkinManager);
    BackGround := SysColorToSkin(clBtnShadow, sFrameAdapter1.SkinData.SkinManager);
    end;

    The font and background setting could have been an optional part of de TsDateEdit control.

    One possible implementation is a property DimUnacceptedCells. Paint the cell as above upon receiving Accepted = False in the OnAcceptDate event. No change in parameters for OnGetCellParams

    #58092
    HeDiBo
    Participant

    You're implementation of DimUnacceptedCells is perfect 👌

    #58175
    HeDiBo
    Participant

    You changed the default for DimUnacceptedCells. This may be unexpected for some. A warning about this should have been in the release notes.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.