TColorDialog.CustomColors fails to save new colors
Original Reporter info from Mantis: Clover
-
Reporter name: David Gray
Original Reporter info from Mantis: Clover
- Reporter name: David Gray
Description:
The TColorDialog supports the definition of custom colors but fails to save them. All changes are lost when the dialog is closed.
Steps to reproduce:
In Windows, create a form with a TColorDialog and a button to execute it.
Run the program and open the TColorDialog.
Click on an empty custom color box and define a new color.
Click "Add to custom colors".
Close the TColorDialog.
Open the dialog again, all custom colors are still all undefined.
The Mac color dialog does not suffer from this problem.
Additional information:
The following change to procedure TWin32WSColorDialog.ShowModal fixes this:
Change:
if UserResult then
TColorDialog(ACommonDialog).Color := CC^.RGBResult;
To:
if UserResult then
begin
TColorDialog(ACommonDialog).Color := CC^.RGBResult;
for i := 0 to 15 do
if i < TColorDialog(ACommonDialog).CustomColors.Count then
TColorDialog(ACommonDialog).CustomColors[i] := Format('Color%s=%x', [Chr(Ord('A')+i), CC^.lpCustColors[i]])
else
TColorDialog(ACommonDialog).CustomColors.Add (Format('Color%s=%x', [Chr(Ord('A')+i), CC^.lpCustColors[i]]));
end;
Mantis conversion info:
- Mantis ID: 23960
- OS: Any
- OS Build: Any
- Build: 40119
- Platform: Windows
- Version: 1.0.6
- Fixed in version: 1.1 (SVN)
- Fixed in revision: r40493 (#277b7822)