Lazarus

Programming => General => Topic started by: bonmario on December 09, 2019, 07:36:25 pm

Title: Bug in Font.Color in Windows?
Post by: bonmario on December 09, 2019, 07:36:25 pm
Hi,

step to reproduce (Windows only):
- create a new project
- put a TMemo on form
- Memo1.Font.Color is "clDefault" (this is correct)
- on property "Font", click on the button "..."
- the color is clBlack
so, if you change for example ONLY the font name, when you click on the ok button "Ok", the property "Memo1.Font.Color" is changed in "clBlack"

If you save the project, compile it on Linux and run with dark theme, the "Memo1.Font.Color" is black, unreadable with dark theme !!!

This is a bug?

Thanks in advance, Mario
Title: Re: Bug in Font.Color in Windows?
Post by: wp on December 09, 2019, 07:46:06 pm
This is a bug?
Yes, but your bug. When you mix hard-coded colors with system, theme-dependent colors that's what is to be expected. In general, be very careful when changing colors because it is not clear what will happen (depending on the widgetset colors may not change at all - look at the Restrictions page of the object inspector or the Restriction Browser)
Title: Re: Bug in Font.Color in Windows?
Post by: bonmario on December 09, 2019, 08:07:56 pm
Ok, thanks.

So, if i want change ONLY font name (for example setting it to "Courier new") without change their color i must:
- Click on the "..." button
- Change font to "Courier new"
- Click on the "Ok" button
- change property "Memo1.Font.Color" in clDefault

It's correct?

Thanks, Mario
Title: Re: Bug in Font.Color in Windows?
Post by: ASerge on December 09, 2019, 09:26:39 pm
An example patch is included. This patch fixes the assignment for Name, Height, Color, CharSet if it's were set to "default".
Title: Re: Bug in Font.Color in Windows?
Post by: JuhaManninen on December 09, 2019, 11:03:09 pm
An example patch is included. This patch fixes the assignment for Name, Height, Color, CharSet if it's were set to "default".
Thanks! I applied it in r62369. Please test everybody.
Title: Re: Bug in Font.Color in Windows?
Post by: bonmario on December 10, 2019, 08:30:02 am
An example patch is included. This patch fixes the assignment for Name, Height, Color, CharSet if it's were set to "default".

Tried now, for me it's Ok.

Thanks, Mario
TinyPortal © 2005-2018