- This topic has 9 replies, 2 voices, and was last updated 6 years, 1 month ago by HeDiBo.
-
AuthorPosts
-
September 12, 2018 at 1:38 pm #37942HeDiBoParticipant
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);September 17, 2018 at 10:47 am #58368SupportKeymasterHello!
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).
September 17, 2018 at 3:18 pm #58378HeDiBoParticipant'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.
September 19, 2018 at 10:54 am #58384HeDiBoParticipant'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);September 21, 2018 at 9:45 am #58397SupportKeymasterThank 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?
September 21, 2018 at 9:49 am #58399HeDiBoParticipant'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
So, if you change the code similar to what I proposed, the problem is solved.
September 21, 2018 at 10:33 am #58401SupportKeymasterI 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
September 26, 2018 at 1:11 pm #58419HeDiBoParticipant'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;September 29, 2018 at 6:00 pm #58434SupportKeymasterHi!
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.
September 30, 2018 at 9:42 am #58439HeDiBoParticipant'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.
-
AuthorPosts
- You must be logged in to reply to this topic.