TButtonColor
TButtonColor
Is there some documentation or a good example of the use of the TButtonColor component? I have not been able to find much information.
Thanks,
Thanks,
Re: TButtonColor
Hello,
The documentation says:
The documentation says:
Here you have another example with two:TButtonColor wrote:Description
This Button control is internally used at Chart Editor dialogs.
It's like a normal TButton control, but includes a property to "link" this button to a Color property.
The Color is used to display a graphical filled rectangle at the right side of the button.
Clicking the button will automatically show the Color editor dialog to change the color.
Example:
Code: Select all
ButtonPen1.LinkProperty( Series1, 'SeriesColor' );
Code: Select all
uses Series;
var Series1: TLineSeries;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Series1:=Chart1.AddSeries(TLineSeries) as TLineSeries;
Series1.FillSampleValues();
Series1.Pointer.Visible:=true;
Series1.Pointer.Color:=Series1.Color;
ButtonColor1.LinkProperty(Series1, 'SeriesColor');
ButtonColor2.LinkProperty(Series1.Pointer.Brush, 'Color');
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: TButtonColor
So one does not have to enter any code for the button's onclick event? I would not have guessed that. Thanks again for your help.
Re: TButtonColor
Hi,
Exactly. You just have to link a TColor property to it.fjrohlf wrote:So one does not have to enter any code for the button's onclick event?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: TButtonColor
That works very well - but how does one set the initial color of the "symbol"? Initially it is black and it does change once one clicks on it and selects a color but I would like it to start with a specified color (i.e., the existing color of a series).
Re: TButtonColor
Hello,
Can you arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
The code I posted above does it for me here. Doesn't for you?fjrohlf wrote:That works very well - but how does one set the initial color of the "symbol"? Initially it is black and it does change once one clicks on it and selects a color but I would like it to start with a specified color (i.e., the existing color of a series).
Can you arrange a simple example project we can run as-is to reproduce the problem here?
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: TButtonColor
see attached. Unfortunately, It uses some components from TMS but you should be able to see my buttoncolor code.
- Attachments
-
- myDemo1.zip
- (5.4 KiB) Downloaded 923 times
Re: TButtonColor
Hello,
After cleaning any 3rd party reference I made the simplified example to work with this code:fjrohlf wrote:Unfortunately, It uses some components from TMS but you should be able to see my buttoncolor code.
Code: Select all
procedure TForm2.FormCreate(Sender: TObject);
var
i: integer;
Series1: TpointSeries;
seriesarray: array [1 .. 3] of TpointSeries;
buttonsarray: array [1 .. 3] of TButtonColor;
ButtonColori: TButtonColor;
begin
Chart1.View3D := false;
Chart1.Legend.Visible := false;
for i := 1 to 3 do begin
Series1 := Chart1.AddSeries(TpointSeries) as TpointSeries;
seriesarray[i] := Series1;
Series1.FillSampleValues();
ButtonColori := TButtonColor.Create(self);
buttonsarray[i] := ButtonColori;
buttonsarray[i].Parent := Self;
buttonsarray[i].Left := 15;
buttonsarray[i].Top := buttonsarray[i].Height * i + 15;
buttonsarray[i].Caption := IntToStr(i) + ' ';
buttonsarray[i].SymbolWidth := 30;
buttonsarray[i].LinkProperty(Series1,'SeriesColor');
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: TButtonColor
ok, that does work. It even works when I restore the parent as the newly created TAdvTabSheet. Thanks!
One last thing - how can i set the initial colors for the button and the series? If I use code such as
Series1.Pointer.Color := clRed;
then the series has that initial color but the button does not (they have the colors that the series would have had without the change given above). I believe the answer to this will reveal what the problem was in my original code.
One last thing - how can i set the initial colors for the button and the series? If I use code such as
Series1.Pointer.Color := clRed;
then the series has that initial color but the button does not (they have the colors that the series would have had without the change given above). I believe the answer to this will reveal what the problem was in my original code.
Re: TButtonColor
Hello,
Using a TPointSeries you should change the series color, not the pointer color:
Here the complete code that works fine for me:
Using a TPointSeries you should change the series color, not the pointer color:
Code: Select all
Series1.Color := clRed;
Code: Select all
procedure TForm2.FormCreate(Sender: TObject);
var
i: integer;
Series1: TpointSeries;
seriesarray: array [1 .. 3] of TpointSeries;
buttonsarray: array [1 .. 3] of TButtonColor;
ButtonColori: TButtonColor;
begin
Chart1.View3D := false;
Chart1.Legend.Visible := false;
for i := 1 to 3 do begin
Series1 := Chart1.AddSeries(TpointSeries) as TpointSeries;
seriesarray[i] := Series1;
Series1.FillSampleValues();
ButtonColori := TButtonColor.Create(self);
buttonsarray[i] := ButtonColori;
buttonsarray[i].Parent := Self;
buttonsarray[i].Left := 15;
buttonsarray[i].Top := buttonsarray[i].Height*i + 5;
buttonsarray[i].Caption := IntToStr(i) + ' ';
buttonsarray[i].SymbolWidth := 30;
ButtonColori.LinkProperty(Series1,'SeriesColor');
end;
Series1.Color := clRed;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |