Show unavailable dates in TsDateEdit

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #37856
    HeDiBo
    Participant

    If OnAcceptDate event sets CanAccept to False, you would expect that this is shown visually in the calendar..

    That does not happen, the date is just not clickable..

    I suppose I'll have to do something in OnGetCellParams. Which skin enabled colors should I use for Font and Background?

    #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 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.