碰到个好怪的问题,晕死了。请大家给予帮助问题如下:       我做了个界面,用 stringgrid 做为输入界面,有个 隐藏的 edit .基本控件如下:
   
        stringgrid
    edit
    bitbtn(原来储存的按钮)    stringgrid : 13列,2行时,那个隐藏的 edit 显示出来后,可以输入中文
                              13列,3行时,那个隐藏的 edit 显示出来后,就没有办法输入中文了。可以输入 英文及数字       涉及到的代码如下:procedure TF_CaiGouDan.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin      if stringgrid1.Cells[0,currentRow]='' then
        exit;
      if currentCol in [4,5,7,11,12] then
        begin
          randomEdit.Top :=stringgrid1.CellRect(currentCol,currentRow).Top +stringgrid1.Top+2 ;
          randomEdit.Left :=stringgrid1.CellRect(currentCol,currentRow).Left +stringgrid1.Left+2 ;
          randomEdit.Width :=stringgrid1.CellRect(currentCol,currentRow).Right -stringgrid1.CellRect(currentCol,currentRow).Left ;          randomEdit.Text :='';          if currentCol=4 then
            FourColLeft:=randomEdit.Left ; //记住 第四列 的左边位置,为了当 edit 到了一行的最后,再按 enter 键时
                                           // 跳到 下一行 的第四列(如果有货号存在)          if stringgrid1.Cells[currentCol,currentRow]<>'' then
            randomEdit.Text :=stringgrid1.Cells[currentCol,currentRow];          randomEdit.Visible :=True;
          randomEdit.SetFocus ;
          exit;
        end
      else
        randomEdit.Visible :=False;
end;procedure TF_CaiGouDan.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);//取得当前行和列的值
begin
  currentRow:=ARow;
  currentCol:=ACol;
end;procedure TF_CaiGouDan.randomEditExit(Sender: TObject);//当 edit 退出时
begin
  stringgrid1.Cells[currentCol,currentRow]:=randomEdit.Text ;
  if currentCol in [4,5,7] then
    fuzhi;  // 是个计算的 procedure 。
end;

解决方案 »

  1.   

    想知道,到底在哪个步骤上,搞的 中文无法输入进去了。想知道 stringgrid 的事件顺序到底是什么样的,哪个在先触发,哪个在后触发
      

  2.   

    我本来的 stringgrid 弄了 30行,后来发觉 中文 无法输入后,改成了 2行,奇怪了,居然可以输入中文了。   于是,我又增加了 一行,也就是 3行 了,中文就无法在 edit 中输入了。(edit 不管在哪一行中,都无法输入了)
      

  3.   

    我觉得最好是edit可见。不要频繁改动它的属性。
    放在stringgrid上面,就当作一个输入项也好。