if  N1.Caption =S1 then  
begin
  N1.Caption :=s2;
  timer1.Enabled :=false;
end;
////执行完上面的代码后,N1.Caption 为s2
if N1.Caption =S2 then  //以下代码肯定执行.因为有上面的N1.Caption :=s2;
begin
   N1.caption:=S1;
   timer1.Enabled :=true;
end;
//最后,你赋值N1.caption:=S1;    当然又显示s1的值了
如果你设置断点,就知道N1。CAPTION变了,不过没断点,变得那么快,你当然就看不出了

解决方案 »

  1.   

    我试了一下,用一个lable1控件,使label1.caption:=n1.caption,得出
     ni.caption 以变为s2了。
      

  2.   

    To knock:
    if  N1.Caption =S1 then  
    begin
      N1.Caption :=s2;
      timer1.Enabled :=false;
      exit;//退出
    end;还是没有用
      

  3.   

    if  N1.Caption =S1 then  
    begin
      N1.Caption :=s2;
      timer1.Enabled :=false;
      Exit;
    end;
    if N1.Caption =S2 then 
    begin
       N1.caption:=S1;
       timer1.Enabled :=true;
    end;
      

  4.   

    出现这个问题的原因很可能是如果PopupMenu的MenuItem的Caption中有很多个&,只有最后一个有效,即N1的Caption实际上是等于'Ocirc;Yacute;Iacute;pound;frac14;àsup2;â'并不等于S1:'ÔÝÍ£¼à²â'
      

  5.   

    To ilang:我的里的值和S1完全一样,也没有设置快截键,没有&