Hi,
I want to add custom colors to the color dialog , which appears when TColorButton is clicked. Is there any possibility to add a 'custom color string' to the TeeChart application?
Sincerely,
odissey1
TC8.02 Pro +Source/D2007
Add Custom Colors to TColorButton color dialog
Re: Add Custom Colors to TColorButton color dialog
Here is some solution:
Wishlist: it would have been nice if underlying TColorDialog in TButtonColor was published.
Any other approaches?
Regards,
odissey1
Code: Select all
//add TColorDialod component on the form and define custom colors in it
uses ..., TeCanvas;
procedure TForm1.FormCreate(Sender: TObject);
begin
TeeCustomEditColors:=TStringList.Create;
TeeCustomEditColors.Assign(ColorDialog1.CustomColors);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
TeeCustomEditColors:=nil; //must set to nil else Err
// TeeCustomEditColors.Free;//Err - do not free here
end;
Wishlist: it would have been nice if underlying TColorDialog in TButtonColor was published.
Any other approaches?
Regards,
odissey1
Re: Add Custom Colors to TColorButton color dialog
Hi odissey1,
I'm not sure to understand what are you exactly trying to achieve. Do you have a list of colors you want to be shown in the below part of the series' color picker window? O do you want to overwrite the whole color picker window?
Could you please send us a simple example project we can run as-is here showing us the solution you proposed?
Thanks in advance.
I'm not sure to understand what are you exactly trying to achieve. Do you have a list of colors you want to be shown in the below part of the series' color picker window? O do you want to overwrite the whole color picker window?
Could you please send us a simple example project we can run as-is here showing us the solution you proposed?
Thanks in advance.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Add Custom Colors to TColorButton color dialog
Hi Yeray,
>Do you have a list of colors you want to be shown in the below part of the series' color picker window?
-Yes. Please see image attached. The code above was used with TC v7.12
odissey1
>Do you have a list of colors you want to be shown in the below part of the series' color picker window?
-Yes. Please see image attached. The code above was used with TC v7.12
odissey1
- Attachments
-
- TButtonColor dialog with pre-defined custom colors
- PenDraw_05.jpg (89.87 KiB) Viewed 15380 times
Re: Add Custom Colors to TColorButton color dialog
Hi odissey1,
Here is an example of what I understood you are trying to do:
Here is an example of what I understood you are trying to do:
Code: Select all
uses series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TBarSeries.Create(self));
Chart1[0].FillSampleValues();
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
with TColorDialog.Create(self) do
begin
CustomColors.Add('ColorA=808022');
CustomColors.Add('ColorI=408090');
Execute;
Chart1[0].Color:=Color;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Add Custom Colors to TColorButton color dialog
Hi Yeray,
I have no problem adding colors to the standard TColorDialog. The one you see on the picture is an internal TColorDialog from TButtonColor, which is a TeeChart component (lime color button on top of the form). The problem is that this color dialog is not public neither published, so there is no regular access to it. The fix I posted above gives access to TCustomColorString inside TeCanvas unit, but this is not nice way to do it. I hope that Steema can change this internal TColorDialog to published, so it could be edited at design time.
odissey1
I have no problem adding colors to the standard TColorDialog. The one you see on the picture is an internal TColorDialog from TButtonColor, which is a TeeChart component (lime color button on top of the form). The problem is that this color dialog is not public neither published, so there is no regular access to it. The fix I posted above gives access to TCustomColorString inside TeCanvas unit, but this is not nice way to do it. I hope that Steema can change this internal TColorDialog to published, so it could be edited at design time.
odissey1
Re: Add Custom Colors to TColorButton color dialog
Hi odissey1,
Ok, I think now I understand your situation. And yes, for some situations your request could be useful. I've added it to the wish list to be implemented in future releases (TV52014664).
In the meanwhile you could use TButtons (with a TEdit without text, but color) with the standard TColorDialog. Something as follows:
Ok, I think now I understand your situation. And yes, for some situations your request could be useful. I've added it to the wish list to be implemented in future releases (TV52014664).
In the meanwhile you could use TButtons (with a TEdit without text, but color) with the standard TColorDialog. Something as follows:
Code: Select all
uses series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TBarSeries.Create(self));
Chart1[0].FillSampleValues();
Edit1.Text:='';
Edit1.Color:=chart1[0].Color;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
with TColorDialog.Create(self) do
begin
CustomColors.Add('ColorA=808022');
CustomColors.Add('ColorI=408090');
CustomColors.Add(ColorToString(Edit1.Color));
if Execute then
begin
Chart1[0].Color:=Color;
Edit1.Color:=Color;
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |