TsDateEdit wrong font in Popup Calendar

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #37942
    HeDiBo
    Participant

    Between 13.19 and 14.0 a change in the creation of the Popup Calendar is introduced:

    Code:
    procedure TsCustomDateEdit.PopupWindowShow;
    begin
    FreeAndNil(FPopupWindow);
    if sPopupCalendar <> nil then
    sPopupCalendar.Close;

    FPopupWindow := TsPopupCalendar.Create(Self);
    sPopupCalendar := TForm(FPopupWindow);
    with TsPopupCalendar(FPopupWindow) do begin
    Font.Assign(Self.Font); (**** DB ***)
    if Assigned(OnGetPopupFont) then
    OnGetPopupFont(Self, Font);

    The font assignment marked with (**** DB ****) was eliminated. Resulting in wrong fonts in all projects using it.

    Maybe a separate CalendarFont property is needed?

    I know I can use the OnGetPopupFont event, but that's a bit strange, isn't it?

    Maybe the code should go like this:

    Code:
    with TsPopupCalendar(FPopupWindow) do begin
    if Assigned(OnGetPopupFont)
    then OnGetPopupFont(Self, Font)
    else Font.Assign(Self.Font);
    #58368
    Support
    Keymaster

    Hello!

    Can you show a screenshot with the different fonts issue, please?

    Code:
    with TsPopupCalendar(FPopupWindow) do begin
    Font.Assign(Self.Font); (**** DB ***)
    if Assigned(OnGetPopupFont) then
    OnGetPopupFont(Self, Font);

    Developer receives actual font here (which may be changed partially).

    #58378
    HeDiBo
    Participant
    'Support' wrote:

    Hello!

    Can you show a screenshot with the different fonts issue, please?

    Code:
    with TsPopupCalendar(FPopupWindow) do begin
    Font.Assign(Self.Font); (**** DB ***)
    if Assigned(OnGetPopupFont) then
    OnGetPopupFont(Self, Font);

    Developer receives actual font here (which may be changed partially).

    No, I changed the code to this:

    Code:
    with TsPopupCalendar(FPopupWindow) do begin
    if Assigned(OnGetPopupFont)
    then OnGetPopupFont(Self, Font)
    else Font.Assign(Self.Font);

    and it worked well.

    #58384
    HeDiBo
    Participant
    'Support' wrote:

    Hello!

    Can you show a screenshot with the different fonts issue, please?

    Developer receives actual font here (which may be changed partially).

    This is the default behavior of a TsDateEdit control:

    [attachment=8901:CalendarFont.jpg]

    The calendar has become hardly readable, because the font size is not copied from the TsDateEdit control.

    This is how it should look. The font is assigned to the calendar as before:

    [attachment=8902:CalendarFontOK.jpg]

    So please, change the code to this:

    Code:
    FPopupWindow := TsPopupCalendar.Create(Self);
    sPopupCalendar := TForm(FPopupWindow);
    with TsPopupCalendar(FPopupWindow) do begin
    if Assigned(OnGetPopupFont)
    then OnGetPopupFont(Self, Font)
    else Font.Assign(Self.Font);
    #58397
    Support
    Keymaster

    Thank you for screenshots, but, I'm sorry, I can't understand the problem still.

    After assigning of font by “Font.Assign(Self.Font)”, fonts are still different in popupcalendar and in the dateedit control?

    How it may be? Maybe you can give me a small demo where I can see it?

    #58399
    HeDiBo
    Participant
    'Support' wrote:

    Thank you for screenshots, but, I'm sorry, I can't understand the problem still.

    After assigning of font by “Font.Assign(Self.Font)”, fonts are still different in popupcalendar and in the dateedit control?

    How it may be? Maybe you can give me a small demo where I can see it?

    There's a miscommunication here.

    My problem is, that in your code the “Font.Assign(Self.Font)” statement is missing wacko.gif

    So, if you change the code similar to what I proposed, the problem is solved.

    #58401
    Support
    Keymaster

    I see what you mean now.

    But your code will not work correct if control is scaled. I will find a solution in the v14.02

    #58419
    HeDiBo
    Participant
    'Support' wrote:

    I see what you mean now.

    But your code will not work correct if control is scaled. I will find a solution in the v14.02

    It works now.

    But if OnGetPopupFont is assigned the font is set twice. This is what you meant to do, isn't it?:

    Code:
    with TsPopupCalendar(FPopupWindow) do begin
    if Assigned(OnGetPopupFont) then
    OnGetPopupFont(Self, Font);
    else begin
    Font.Assign(Self.Font);
    Font.Size := Font.Size * 96 div SkinData.CommonSkinData.PPI; // Return original font size if DateEdit is scaled
    end;
    #58434
    Support
    Keymaster

    Hi!

    Sometimes developer do not need to define an own custom font, sometimes one property of existing font should be changed only.

    The default font should be specified for such cases, I think.

    #58439
    HeDiBo
    Participant
    'Support' wrote:

    Hi!

    Sometimes developer do not need to define an own custom font, sometimes one property of existing font should be changed only.

    The default font should be specified for such cases, I think.

    I see your point now. Thank you.

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