dbchart问题(50分)

  • 主题发起人 jiangxidna
  • 开始时间
J

jiangxidna

Unregistered / Unconfirmed
GUEST, unregistred user!
我用dbchart显示数据,用checkbox控制要显示的数据,用一个按钮来控制换页,代码如DBChart.NextPage。当我查询了数据,在dbchart显示了,此时我先点换页按钮,点了以后我再点checkbox,比如我用了4个checkbox来控制4个字段的数据,开始的时候他们都是选中的,然后我挨个的让他们不选中,当我点了倒数第二个的时候,报错了。错误为:
access voilation address at 00401F1D in .....
每次都在倒数第二个,真是怪事情,它好象是在哪设置了什么,不让一个字段单独显示似的
不知道哪位知道这种情况,还希望不吝赐教!
 
procedure TForm1.Button1Click(Sender: TObject);
var
ssql : string;
begin
with Unit1.Form1.ADOQuery2 do
begin
close;
SQL.clear;
ssql:=' SELECT Temperature, Humidity,'
+' Sampling_Date+'+#39+ ' '+#39 +'+Sampling_Time AS DateTime,'
+' Wind_Speed, Vane, Sampling_Date, Sampling_Time'
+' FROM Ice_WatchInfo ';
SQL.add(ssql);
Open;
MaxPointsPerPage:=24;
end;

end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
ShowSeries(0,CheckBox1.Checked);
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
ShowSeries(1,CheckBox2.Checked);
end;

procedure TForm1.ShowSeries(Const Index:Integer;Visible:Boolean);
begin
DBChart.Series[Index].Active:=Visible;
//DBChart1.Series[Index].Active:=Visible;
end;
procedure TForm1.DBChartPageChange(Sender: TObject);
begin
DBChart.UndoZoom;
if DBChart.Foot.Text.Count>0 then
begin
DBChart.Foot.Text[DBChart.Foot.Text.Count-1]:='第'+IntToStr(DBChart.Page)
+'页共'+IntToStr(DBChart.NumPages)+'页';
end else
DBChart.Foot.Text.Add('第'+IntToStr(DBChart.Page)
+'页共'+IntToStr(DBChart.NumPages)+'页');
actFirstPage.Enabled:=DBChart.Page > 1;
actNextPage.Enabled:=DBChart.Page < DBChart.NumPages;
actLastPage.Enabled:=actNextPage.Enabled;
actPriorPage.Enabled:= actFirstPage.Enabled;
end;

procedure TForm1.RzToolButton2Click(Sender: TObject);
begin
DBChart.NextPage;
end;

procedure TForm1.tbtnFirstPageClick(Sender: TObject);
begin
DBChart.Page:=1;
end;

procedure TForm1.tbtnPriorPageClick(Sender: TObject);
begin
DBChart.PreviousPage;
end;

procedure TForm1.tbtnNextPageClick(Sender: TObject);
begin
DBChart.NextPage;
end;

procedure TForm1.tbtnlastPageClick(Sender: TObject);
begin
DBChart.Page:=DBChart.NumPages;
end;
function TForm1.GetMaxPointsPerPage: Integer;
begin
Result:=DBChart.MaxPointsPerPage;
end;
procedure TForm1.SetMaxPointsPerPage(Value: Integer);
begin
DBChart.MaxPointsPerPage:=Value;
DBChartPageChange(nil);
end;
end.
这是主要代码
 
控制页的按钮和控制要显示的字段的checkbox按钮之间有没有什么冲突,当你按翻页了,此时在点checkbox按钮控制字段显示,会不会有什么冲突??????????/
 
我做了个小程序做实验,发现如果是显示一个字段的话,就报错。不知道那位仁兄遇到过如此情况!
 
要结贴 进来个人散分
 
接受答案了.
 
顶部