Y
yylg
Unregistered / Unconfirmed
GUEST, unregistred user!
有一段程序:<br>type<br> TCtr = record<br> v: real;<br> used:boolean;<br> v_used:^TCheckBox;<br> v_set:^TComboBox;<br> end;<br>...<br>var <br> F_zldy: TF_zldy;<br> ValueChanged:Boolean;<br> OptionsValue:array [0..8,0..31] of real =( 。。。预定义的值,省略。。。);<br> pCtr:array [0..8] of TCtr;<br>...<br>procedure TF_zldy.FormCreate(Sender: TObject);<br>begin<br> LinkCtr;<br> InitValue;<br> InitCtr;<br>end;<br><br>//这里用指针指向相应的控件,如c_used0(TCheckBox)和cb_set0(TComboBox)等,以便以后统一管理<br>procedure TF_zldy.LinkCtr;<br>begin<br> with pCtr[0] do begin v_used:=@c_used0; v_set:=@cb_set0; end;<br> with pCtr[1] do begin v_used:=@c_used1; v_set:=@cb_set1; end;<br> with pCtr[2] do begin v_used:=@c_used2; v_set:=@cb_set2; end;<br> with pCtr[3] do begin v_used:=@c_used3; v_set:=@cb_set3; end;<br> with pCtr[4] do begin v_used:=@c_used4; v_set:=@cb_set4; end;<br> with pCtr[5] do begin v_used:=@c_used5; v_set:=@cb_set5; end;<br> with pCtr[6] do begin v_used:=@c_used6; v_set:=@cb_set6; end;<br> with pCtr[7] do begin v_used:=@c_used7; v_set:=@cb_set7; end;<br> with pCtr[8] do begin v_used:=@c_used8; v_set:=@cb_set8; end;<br>end;<br><br>procedure TF_zldy.InitValue;<br>begin<br> ValueChanged := false;<br>end;<br><br>procedure TF_zldy.InitCtr;<br>var i,j:integer;<br> SL: TStrings;<br>begin<br> With Qry_zldy.SQL do<br> begin<br> Clear;<br> Add(...用Select打开一张表...);<br> end;<br> Qry_zldy.Open ;<br><br> with Qry_zldy do<br> begin<br> for i:=0 to 8 do<br> begin<br> with pCtr do<br> begin<br> v_set^.itemindex := fieldbyname('s'+inttostr(i)).AsInteger;<br> v_used^.checked := fieldbyname('u'+inttostr(i)).Asboolean;<br>//问题就出现在这里,当执行了这一句后,ValueChanged 的值自动被改变成了所取的字段的值了,如True,我试着换变量名,换变量定义的位置,都不行!!!<br> end;<br> end<br> end;<br>end;<br><br>是我使用指针的方法不对,还是编译器有毛病?请高手们指教。<br><br>我的Email: YYLG@sdu.edu.cn