请教:
procedure TSetEquipmentTimeForm.Edit1Exit(Sender: TObject);var
        i:integer;//判断世纪设置是否正确
begin        i:=strtoint(edit1.Text);
        if   (edit2.SetFocus)  or (edit3.SetFocus) or(Button1.SetFocus)  and  (i<20)   then
              begin
                     showmessage('世纪设置错误');
                     edit1.SetFocus;
               end;
              
end;当我从光标从 edit1 出来,如果是 edit2 或者  edit3 或者 Button1 获得 句本(我不知道是不是叫句本,也就是说,我把光标 移入 edit2 或者  edit3   或者 双击 Button1)
则运行
showmessage('世纪设置错误');
edit1.SetFocus;如果是别的 控件获的 剧本(也就是我 我把光标 移入 edit5  或者 双击 Button2 )则
不进行判断!
各位大哥,这样的功能能实现吗?
谢谢各位大哥!

解决方案 »

  1.   

    个人认为你还不如在edit1失去焦点的时候判断呢!还有不是剧本,是句柄。
      

  2.   

    同意楼上procedure TSetEquipmentTimeForm.Edit1Exit(Sender: TObject);var
            i:integer;//判断世纪设置是否正确
    begin        i:=strtoint(edit1.Text);
            if   (edit2.Focused)  or (edit3.Focused) or(Button1.Focused)  and  (i<20)   then
                  begin
                         showmessage('世纪设置错误');
                         edit1.SetFocus;
                   end;
                  
    end;
      

  3.   

    比如,在edit1的exit事件里面判断你的世纪。你试试先
      

  4.   

    真是太感谢各位大哥了!
     fox100 的方法很好啊!
    揭贴!