Page 1 of 1
Where does SelectedSeries get updated in src?
Posted: Tue Apr 18, 2006 10:18 pm
by 9234539
hi,
In TeeLisB.pas, I looked at this function, but couldn't figure out how the SelectedSeries get updated, the only thing I can figure out is that "inherited" might get the ItemIndex updated. Please help.
Code: Select all
procedure TChartListBox.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited; // 7.01
HideEditor;
if ItemIndex<>-1 then
begin
tmp:=SeriesAtMousePos(p);
...
Many thanks, want to know this badly.
Fang
p.s sorry for this newbie question
Posted: Wed Apr 19, 2006 8:29 am
by narcis
Hi Fang,
It is a property which has "get" and "set" methods so it is updated in GetSelectedSeries and SetSelectedSeries.
Posted: Wed Apr 19, 2006 11:40 am
by 9234539
o, I know that.
But I don't see them get called either. Only here it's been referenced
Code: Select all
procedure TChartListBox.UpdateSeries;
begin
FillSeries(SelectedSeries);
end;
But I don't see why mousedown will trigger this.
Posted: Fri Apr 28, 2006 3:43 pm
by Pep
Hi Fang,
you can see it here, in the TeeListB.pas :
Code: Select all
Procedure TChartListBox.SetSelectedSeries(Value:TChartSeries);
begin
ItemIndex:=Items.IndexOfObject(Value);
if ItemIndex<>-1 then Selected[ItemIndex]:=True;
{$IFDEF CLX}
DoRefresh;
{$ENDIF}
end;
Posted: Fri Apr 28, 2006 4:33 pm
by 9234539
Hi Pep, NarcĂs,
this may sounds very obvious to you, but I just don't get the picture where this selectedseries get updated from mousedown or mouseclick event. It'll be great if you can point me where is the line which calls selectedseries in mousedown event. Ex. user click or press the mouse, which line tells the seletedseries to change, I can't see that. ( I know if I call selectedseries, it'll be set. )
Best Regards
Thank you very much.
Fang
p.s so far you guys are telling me what's the implementation of selectedseries , it's some mis-understanding here.
Posted: Mon May 08, 2006 2:13 pm
by Pep
Hi Fang,
this Function is the one which returns the Series that is selected :
Code: Select all
Function TChartListBox.GetSeries(Index:Integer):TChartSeries;
begin
if (Index<>-1) and (Index<Items.Count) then
result:=TChartSeries(Items.Objects[Index])
else
result:=nil;
end;
And, it's called in the LBSeriesDrawItem method, at the following line :
tmpSeries:=Series[Index];