1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
|
{
*****************************************************************************
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
Authors: Werner Pamler, Alexander Klenin
Usage:
- Add the ChartListbox to a form with a TChart
- Connect the chart to the listbox by setting the chart property of the
TChartlistbox. The ChartListbox will be populated with the series in the
chart and will automatically track changes of the series.
- Check/uncheck series in the ChartListbox to show/hide them in the chart.
As usual, checking is done by mouse clicks or by pressing the space bar.
- Play with the properties to modify the standard behavior, e.g. set
CheckStyle to cbsRadioButton in order to get a radiobutton behavior, i.e. to
allow only one visible series.
}
unit TAChartListbox;
{$MODE objfpc}{$H+}
{$IFDEF DARWIN}
{$DEFINE USE_BITMAPS}
{$ENDIF}
interface
uses
Classes, Controls, StdCtrls, Types,
TAChartUtils, TACustomSeries, TALegend, TAGraph;
type
TChartListbox = class;
TChartListboxIndexEvent = procedure (
ASender: TObject; AIndex: Integer) of object;
TChartListboxAddSeriesEvent = procedure (
ASender: TChartListbox; ASeries: TCustomChartSeries;
AItems: TChartLegendItems; var ASkip: Boolean
) of object;
TCheckBoxesStyle = (cbsCheckbox, cbsRadiobutton);
TChartListOption = (cloShowCheckboxes, cloShowIcons, cloRefreshOnSourceChange);
TChartListOptions = set of TChartListOption;
const
SHOW_ALL = [cloShowCheckboxes, cloShowIcons];
type
TChartListbox = class(TCustomListbox)
private
FChart: TChart;
FCheckBoxSize: TSize;
FCheckStyle: TCheckBoxesStyle;
FDown: Boolean;
FHot: Boolean;
FLegendItems: TChartLegendItems;
FListener: TListener;
FOnAddSeries: TChartListboxAddSeriesEvent;
FOnCheckboxClick: TChartListboxIndexEvent;
FOnItemClick: TChartListboxIndexEvent;
FOnPopulate: TNotifyEvent;
FOnSeriesIconDblClick: TChartListboxIndexEvent;
FOptions: TChartListOptions;
FSeriesIconClicked: Integer;
function GetChecked(AIndex: Integer): Boolean;
function GetSeries(AIndex: Integer): TCustomChartSeries;
function GetSeriesCount: Integer;
procedure EnsureSingleChecked(AIndex: Integer = -1);
procedure SetChart(AValue: TChart);
procedure SetChecked(AIndex: Integer; AValue: Boolean);
procedure SetCheckStyle(AValue: TCheckBoxesStyle);
procedure SetOnAddSeries(AValue: TChartListboxAddSeriesEvent);
procedure SetOnPopulate(AValue: TNotifyEvent);
procedure SetOptions(AValue: TChartListOptions);
protected
procedure DblClick; override;
procedure DrawItem(
AIndex: Integer; ARect: TRect; AState: TOwnerDrawState); override;
procedure KeyDown(var AKey: Word; AShift: TShiftState); override;
procedure MouseDown(AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer); override;
procedure MouseEnter; override;
procedure MouseLeave; override;
procedure MouseUp(AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer); override;
protected
procedure CalcRects(
const AItemRect: TRect; out ACheckboxRect, ASeriesIconRect: TRect);
procedure ClickedCheckbox(AIndex: Integer); virtual;
procedure ClickedItem(AIndex: Integer); virtual;
procedure ClickedSeriesIcon(AIndex: Integer); virtual;
function CreateLegendItems: TChartLegendItems;
procedure Notification(AComponent: TComponent; AOperation: TOperation); override;
procedure Populate;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function FindSeriesIndex(ASeries: TCustomChartSeries): Integer;
procedure MeasureItem(AIndex: Integer; var AHeight: Integer); override;
procedure RemoveSeries(ASeries: TCustomChartSeries);
procedure SeriesChanged(ASender: TObject);
property Checked[AIndex: Integer]: Boolean read GetChecked write SetChecked;
property Series[AIndex: Integer]: TCustomChartSeries read GetSeries;
property SeriesCount: Integer read GetSeriesCount;
published
property Chart: TChart read FChart write SetChart;
property CheckStyle: TCheckBoxesStyle
read FCheckStyle write SetCheckStyle default cbsCheckbox;
property Options: TChartListOptions
read FOptions write SetOptions default SHOW_ALL;
published
property OnAddSeries: TChartListboxAddSeriesEvent
read FOnAddSeries write SetOnAddSeries;
property OnCheckboxClick: TChartListboxIndexEvent
read FOnCheckboxClick write FOnCheckboxClick;
property OnItemClick: TChartListboxIndexEvent
read FOnItemClick write FOnItemClick;
property OnPopulate: TNotifyEvent read FOnPopulate write SetOnPopulate;
property OnSeriesIconDblClick: TChartListboxIndexEvent
read FOnSeriesIconDblClick write FOnSeriesIconDblClick;
published
property Align;
// property AllowGrayed;
property Anchors;
property BidiMode;
property BorderSpacing;
property BorderStyle;
property Color;
property Columns;
property Constraints;
property DragCursor;
property DragMode;
property Enabled;
property ExtendedSelect;
property Font;
property IntegralHeight;
// property Items;
property ItemHeight;
property MultiSelect;
property OnChangeBounds;
property OnClick;
// property OnClickCheck;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawItem;
property OnEndDrag;
property OnEnter;
property OnExit;
// property OnItemClick;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnShowHint;
property OnStartDrag;
property OnUTF8KeyPress;
property ParentBidiMode;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Sorted;
// property Style;
property TabOrder;
property TabStop;
property TopIndex;
property Visible;
end;
procedure Register;
implementation
uses
Graphics, Math, LCLIntf, LCLType, SysUtils, Themes,
TACustomSource, TADrawerCanvas, TADrawUtils, TAEnumerators, TAGeometry;
type
TThemedStatesUsed = {%H-}tbRadioButtonUnCheckedNormal..tbCheckboxCheckedDisabled;
{$IFDEF USE_BITMAPS}
var
ThemedBitmaps: Array[TThemedStatesUsed] of TBitmap;
function CreateBitmap(AThemedButton: TThemedButton; ABkColor: TColor): TBitmap;
var
s: TSize;
details: TThemedElementDetails;
begin
Result := ThemedBitmaps[AThemedButton];
if Assigned(Result) and (Result.Canvas.Pixels[0, 0] = ABkColor) then
exit;
FreeAndNil(Result);
Result := TBitmap.Create;
details := ThemeServices.GetElementDetails(AThemedButton);
s := ThemeServices.GetDetailSize(details);
Result.SetSize(s.CX, s.CY);
Result.Canvas.Brush.Color := ABkColor;
Result.Canvas.FillRect(0, 0, Result.Width, Result.Height);
ThemeServices.DrawElement(Result.Canvas.Handle, details, Rect(0, 0, Result.Width, Result.Height));
ThemedBitmaps[AThemedButton] := Result;
end;
procedure InitBitmaps;
var
tb: TThemedButton;
begin
for tb in TThemedStatesUsed do
ThemedBitmaps[tb] := nil;
end;
procedure FreeBitmaps;
var
tb: TThemedButton;
begin
for tb in TThemedStatesUsed do
FreeAndNil(ThemedBitmaps[tb]);
end;
{$ENDIF}
{ TChartListbox }
constructor TChartListbox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Style := lbOwnerDrawFixed;
FListener := TListener.Create(@FChart, @SeriesChanged);
FOptions := SHOW_ALL;
end;
destructor TChartListbox.Destroy;
begin
FreeAndNil(FListener);
FreeAndNil(FLegendItems);
inherited;
end;
procedure TChartListbox.CalcRects(
const AItemRect: TRect; out ACheckboxRect, ASeriesIconRect: TRect);
{ based on the rect of a listbox item, calculates the locations of the
checkbox and of the series icon }
const
MARGIN = 4;
var
x: Integer;
begin
ACheckBoxRect := ZeroRect;
ASeriesIconRect := ZeroRect;
x := AItemRect.Left + MARGIN;
if cloShowCheckboxes in Options then begin
ACheckBoxRect := Rect(0, 0, FCheckboxSize.CX, FCheckboxSize.CY);
OffsetRect(ACheckboxRect, x, (AItemRect.Top + AItemRect.Bottom - FCheckboxSize.CY) div 2);
if cloShowIcons in Options then
x += ACheckboxRect.Right;
end
else begin
if cloShowIcons in Options then
x += AItemRect.Left;
end;
if cloShowIcons in Options then
ASeriesIconRect := Rect(
x, AItemRect.Top + 2, x + FChart.Legend.SymbolWidth, AItemRect.Bottom - 2);
end;
procedure TChartListbox.ClickedCheckbox(AIndex: Integer);
begin
Checked[AIndex] := not Checked[AIndex];
if Assigned(OnCheckboxClick) then
OnCheckboxClick(Self, AIndex);
end;
procedure TChartListbox.ClickedItem(AIndex: Integer);
begin
if Assigned(OnItemClick) then
OnItemClick(Self, AIndex);
end;
procedure TChartListbox.ClickedSeriesIcon(AIndex: Integer);
begin
if Assigned(OnSeriesIconDblClick) then
OnSeriesIconDblClick(Self, AIndex);
end;
function TChartListbox.CreateLegendItems: TChartLegendItems;
{ creates the a TLegendItems list and populates it with information for
all series contained in the Chart. In case of MultiLegend items, only
a single legend item is used }
var
skip: Boolean;
s: TCustomChartSeries;
begin
Result := TChartLegendItems.Create;
try
if FChart = nil then exit;
for s in CustomSeries(Chart) do begin
if Assigned(OnAddSeries) then begin
skip := false;
FOnAddSeries(Self, s, Result, skip);
if skip then continue;
end;
s.GetSingleLegendItem(Result);
end;
except
FreeAndNil(Result);
raise;
end;
end;
procedure TChartListbox.DblClick;
begin
inherited DblClick;
if FSeriesIconClicked <> -1 then
ClickedSeriesIcon(FSeriesIconClicked);
end;
function GetThemedButtonOffset(Hot, Pressed, Disabled: Boolean): Integer;
begin
Result := 0;
if Disabled then
Result := 3
else if Hot then
Result := 1
else if Pressed then
Result := 2;
end;
procedure TChartListbox.DrawItem(
AIndex: Integer; ARect: TRect; AState: TOwnerDrawState);
{ draws the listbox item }
const
THEMED_BASE: array [TCheckboxesStyle, Boolean] of TThemedButton = (
(tbCheckBoxUncheckedNormal, tbCheckBoxCheckedNormal),
(tbRadioButtonUnCheckedNormal, tbRadioButtonCheckedNormal)
);
var
id: IChartDrawer;
rcb, ricon: TRect;
x: Integer;
tb: TThemedButton;
tbBase, tbOffs: Integer;
{$IFDEF USE_BITMAPS}
bmp: TBitmap;
{$ELSE}
ted: TThemedElementDetails;
{$ENDIF}
begin
if Assigned(OnDrawItem) then begin
OnDrawItem(Self, AIndex, ARect, AState);
exit;
end;
if (FChart = nil) or not InRange(AIndex, 0, Count - 1) then
exit;
Canvas.FillRect(ARect);
if cloShowCheckboxes in Options then begin
tbBase := ord(THEMED_BASE[FCheckStyle, Checked[AIndex]]);
tbOffs := GetThemedButtonOffset(FHot, FDown, false);
tb := TThemedButton(ord(tbBase) + tbOffs);
{$IFDEF USE_BITMAPS}
bmp := CreateBitmap(tb, Canvas.Brush.Color);
FCheckboxSize := Size(bmp.Width, bmp.Height);
{$ELSE}
ted := ThemeServices.GetElementDetails(tb);
FCheckboxSize := ThemeServices.GetDetailSize(ted);
{$ENDIF}
end;
CalcRects(ARect, rcb, ricon);
if cloShowCheckboxes in Options then begin
{$IFDEF USE_BITMAPS}
Canvas.Draw(rcb.Left, rcb.Top, bmp);
{$ELSE}
ThemeServices.DrawElement(Canvas.Handle, ted, rcb);
{$ENDIF}
x := rcb.Right;
end
else
x := ARect.Left;
Canvas.Brush.Style := bsClear;
if cloShowIcons in Options then begin
id := TCanvasDrawer.Create(Canvas);
id.Pen := Chart.Legend.SymbolFrame;
FLegendItems[AIndex].Draw(id, ricon);
end
else
Canvas.TextOut(x + 2, ARect.Top, FLegendItems.Items[AIndex].Text);
end;
procedure TChartListbox.EnsureSingleChecked(AIndex: Integer);
var
i: Integer;
ser: TCustomChartSeries;
begin
if (FCheckStyle <> cbsRadioButton) or not (cloShowCheckboxes in Options) then
exit;
if FLegendItems = nil then
exit;
FListener.OnNotify := nil;
try
for i := 0 to FLegendItems.Count - 1 do begin
ser := GetSeries(i);
if ser = nil then continue;
if (AIndex < 0) and ser.Active then
AIndex := i
else
ser.Active := AIndex = i;
end;
finally
FListener.OnNotify := @SeriesChanged;
end;
end;
function TChartListbox.FindSeriesIndex(ASeries: TCustomChartSeries): Integer;
{ searches the internal legend items list for the specified series }
begin
for Result := 0 to FLegendItems.Count - 1 do
if GetSeries(Result) = ASeries then exit;
Result := -1;
end;
function TChartListbox.GetChecked(AIndex: Integer): Boolean;
{ report the checked status. This is determined by the visibility of the
series with the given index. }
var
ser: TBasicChartSeries;
begin
ser := GetSeries(AIndex);
Result := (ser <> nil) and ser.Active;
end;
function TChartListbox.GetSeries(AIndex: Integer): TCustomChartSeries;
{ extracts, for the given index, the series from the internal
legend items list. }
var
legitem: TLegendItem;
begin
legitem := FLegendItems[AIndex];
if (legitem <> nil) and (legitem.Owner is TCustomChartSeries) then
Result := TCustomChartSeries(legitem.Owner)
else
Result := nil;
end;
function TChartListbox.GetSeriesCount : Integer;
{ determines the number of series displayed in the listbox.
Note that this may be different from the Chart.SeriesCount if
RemoveSeries has been called }
begin
Result := FLegendItems.Count;
end;
procedure TChartListbox.KeyDown(var AKey: Word; AShift: TShiftState);
{ allows checking/unchecking of items by means of pressing the space bar }
begin
if
(AKey = VK_SPACE) and (AShift = []) and
(cloShowCheckboxes in Options) and (ItemIndex >= 0)
then begin
ClickedCheckbox(ItemIndex);
AKey := VK_UNKNOWN;
end
else
inherited KeyDown(AKey, AShift);
end;
// Item height is determined as maximum of:
// checkbox height, text height, ItemHeight property value.
procedure TChartListbox.MeasureItem(AIndex: Integer; var AHeight: Integer);
begin
inherited MeasureItem(AIndex, AHeight);
AHeight := Max(CalculateStandardItemHeight, AHeight);
if cloShowCheckboxes in Options then
AHeight := Max(AHeight, GetSystemMetrics(SM_CYMENUCHECK) + 2);
end;
{ standard MouseDown handler: checks if the click occured on the checkbox,
on the series icon, or on the text.
The visibility state of the item's series is changed when clicking on the
checkbox, and an event OnCheckboxClick is generated.
An event OnSeriesIconClick is generated when double-clicking on the
series icon; the method stores the series list index here.
An event OnItemClick is generated when the click occured neither on the
checkbox nor the series icon.
}
procedure TChartListbox.MouseDown(
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer);
var
rcb, ricon: TRect;
index: Integer;
p: TPoint;
begin
FDown := true;
FSeriesIconClicked := -1;
try
if AButton <> mbLeft then exit;
p := Point(AX, AY);
index := GetIndexAtXY(AX, AY);
if index < 0 then exit;
CalcRects(ItemRect(index), rcb, ricon);
if (cloShowCheckboxes in Options) and IsPointInRect(p, rcb) then
ClickedCheckbox(index)
else if (cloShowIcons in Options) and IsPointInRect(p, ricon) then
// Remember clicked index for the double click event.
FSeriesIconClicked := index
else
ClickedItem(index);
finally
inherited MouseDown(AButton, AShift, AX, AY);
end;
end;
procedure TChartListbox.MouseEnter;
begin
FHot := true;
inherited;
end;
procedure TChartListbox.MouseLeave;
begin
FHot := false;
inherited;
end;
procedure TChartListBox.MouseUp(
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer);
begin
FDown := false;
inherited;
end;
procedure TChartListbox.Notification(AComponent: TComponent; AOperation: TOperation);
begin
if (AOperation = opRemove) and (AComponent = FChart) then
FChart := nil;
inherited Notification(AComponent, AOperation);
end;
procedure TChartListbox.Populate;
{ populates the listbox with all series contained in the chart. Use the event
OnPopulate if you don't omit special series from the listbox (RemoveSeries) }
var
li: TLegendItem;
list: TFPList;
ser: TCustomChartSeries;
i, idx: Integer;
begin
Items.BeginUpdate;
list := TFPList.Create;
try
// In case of multiselect, the selected items would get lost here.
// Store series belonging to selected items in temporary list
for i:=0 to Items.Count-1 do
if Selected[i] then begin
li := TLegendItem(Items.Objects[i]);
if (li <> nil) and (li.Owner is TCustomChartSeries) then begin
ser := TCustomChartSeries(li.Owner);
list.Add(ser);
end;
end;
Items.Clear;
if (FChart = nil) or (FChart.Series = nil) then exit;
FreeAndNil(FLegendItems);
FLegendItems := CreateLegendItems;
Chart.Legend.SortItemsByOrder(FLegendItems);
for li in FLegendItems do begin
// The caption is owner-drawn, but add it anyway for user convenience.
idx := Items.AddObject(li.Text, li);
// Restore selected state from temporary list
if (li.Owner is TCustomChartSeries) then begin
ser := TCustomChartSeries(li.Owner);
if list.IndexOf(ser) <> -1 then Selected[idx] := true;
end;
end;
if Assigned(OnPopulate) then
OnPopulate(Self);
finally
list.Free;
Items.EndUpdate;
end;
end;
procedure TChartListbox.RemoveSeries(ASeries: TCustomChartSeries);
{ removes the series from the listbox, but keeps it in the chart }
var
index: Integer;
begin
index := FindSeriesIndex(ASeries);
if index = -1 then exit;
FLegendItems.Delete(index);
Items.Delete(index);
Invalidate;
end;
procedure TChartListbox.SeriesChanged(ASender: TObject);
{ Notification procedure of the listener. Responds to chart broadcasts
by populating the listbox with the chart's series }
begin
if
(ASender is TCustomChartSource) and
not (cloRefreshOnSourceChange in Options)
then
exit;
Populate;
{ in case of radiobutton mode, it is necessary to uncheck the other
series; there can be only one active series in this mode }
if
(ASender is TCustomChartSeries) and (ASender as TCustomChartSeries).Active
then
EnsureSingleChecked(FindSeriesIndex(ASender as TCustomChartSeries))
else
EnsureSingleChecked;
end;
procedure TChartListbox.SetChart(AValue: TChart);
{ connects the ListBox to the chart }
begin
if FChart = AValue then exit;
if FListener.IsListening then
FChart.Broadcaster.Unsubscribe(FListener);
FChart := AValue;
if FChart <> nil then
FChart.Broadcaster.Subscribe(FListener);
SeriesChanged(Self);
end;
procedure TChartListbox.SetChecked(AIndex: Integer; AValue: Boolean);
{ shows/hides the series with the specified index of its listbox item.
In case of radiobutton style, all other series are hidden if AValue=true }
var
ser: TCustomChartSeries;
begin
ser := GetSeries(AIndex);
if (ser = nil) or (ser.Active = AValue) then exit;
// Do not listen to this change since we know what changed.
FListener.OnNotify := nil;
try
ser.Active := AValue;
finally
FListener.OnNotify := @SeriesChanged;
end;
if AValue then
EnsureSingleChecked(FindSeriesIndex(ser));
Invalidate;
end;
procedure TChartListbox.SetCheckStyle(AValue: TCheckBoxesStyle);
{ selects "checkbox" or "radiobutton" styles. In radiobutton mode, only
one series can be visible }
begin
if FCheckStyle = AValue then exit;
FCheckStyle := AValue;
EnsureSingleChecked;
Invalidate;
end;
procedure TChartListbox.SetOnAddSeries(AValue: TChartListboxAddSeriesEvent);
begin
if TMethod(FOnAddSeries) = TMethod(AValue) then exit;
FOnAddSeries := AValue;
Populate;
end;
procedure TChartListbox.SetOnPopulate(AValue: TNotifyEvent);
begin
if TMethod(FOnPopulate) = TMethod(AValue) then exit;
FOnPopulate := AValue;
Populate;
end;
procedure TChartListbox.SetOptions(AValue: TChartListOptions);
begin
if FOptions = AValue then exit;
FOptions := AValue;
EnsureSingleChecked;
Invalidate;
end;
procedure Register;
begin
RegisterComponents(CHART_COMPONENT_IDE_PAGE, [TChartListbox]);
end;
{$IFDEF USE_BITMAPS}
initialization
InitBitmaps;
finalization
FreeBitmaps;
{$ENDIF}
end.
|