Hi, i was populating a teechart based on if a certain subitem contained a value (got some help from here).
the code was this (which works):
now what i would like is, i have a new column in the listview, if the string in this subitem (11) says 'Yes' then i want the chart to update, if it says 'No' i dont want it to do anything. This new column is basically a easier way for the user to choose if they want the SubItem[7] to be shown on the chart or not, i cant seem to get it to work. here is what i have so far and hope someone can help me:
Please help me, thanks!!
the code was this (which works):
Code:
procedure TfrmMain.UpdateWeightSeries;
var
i: Integer;
aStringList: TStringList;
begin
aStringList:= TStringList.Create;
try
with WeightSeries do
begin
Clear; //clear previous entries otherwise it will keep adding
{loop through each entry in the fitness table and:
-> get the value entered in all weight subitem boxes
-> add to the fitness chart the number of weeks based on if weight has a value}
for i:= 0 to lvwFitnessTable.Items.Count -1 do
begin
if lvwFitnessTable.Items[i].SubItems.Count > 7 then
begin
if lvwFitnessTable.Items[i].SubItems[7] <> '' then
begin
{add weight values to stringlist}
aStringList.Add(lvwFitnessTable.Items[i].SubItems[7]);
{add to the chart, we can now count actual weeks via aStringList.Count}
Add(StrToFloat(lvwFitnessTable.Items[i].SubItems[7]), IntToStr(aStringList.Count), clMedGray);
end;
end;
end;
end;
finally
aStringList.Free;
end;
end;
now what i would like is, i have a new column in the listview, if the string in this subitem (11) says 'Yes' then i want the chart to update, if it says 'No' i dont want it to do anything. This new column is basically a easier way for the user to choose if they want the SubItem[7] to be shown on the chart or not, i cant seem to get it to work. here is what i have so far and hope someone can help me:
Code:
procedure TfrmMain.UpdateWeightSeries;
var
i: Integer;
aStringList: TStringList;
begin
aStringList:= TStringList.Create;
try
with WeightSeries do
begin
Clear; //clear previous entries otherwise it will keep adding
{loop through each entry in the fitness table and:
-> get the value entered in all subitem weight boxes
-> add to the fitness chart the number of weeks based on if weight has a value, and subitem[11] says 'Yes'}
for i:= 0 to lvwFitnessTable.Items.Count -1 do
begin
if lvwFitnessTable.Items[i].SubItems.Count > 7 then
begin
if lvwFitnessTable.Items[i].SubItems[7] <> '' then
begin
[b]if lvwFitnessTable.Items[i].SubItems[11] = 'Yes' then {did user request to monitor this entry?}
begin
{add weight values to stringlist}
aStringList.Add(lvwFitnessTable.Items[i].SubItems[7]);
{add to the chart, we can now count actual weeks via aStringList.Count}
Add(StrToFloat(lvwFitnessTable.Items[i].SubItems[7]), IntToStr(aStringList.Count), clMedGray);
end;[/b]
end;
end;
end;
end;
finally
aStringList.Free;
end;
end;
Please help me, thanks!!