本人在使用elib控件中的数据显示控件dbgrideh时,按照下载控件时demo中例子,弄了一个右击菜单来实现dbgrid数据的cut,copy等操作,但我的cut等事件源码中的 if (ActiveControl is TDBGridEh)条件在竟然为false.我用的就是TDBGridEh啊,为什么?(知道的帮帮忙,我想了N天了)
procedure Tfrm_ps.menucutClick(Sender: TObject); begin if (ActiveControl is TDBGridEh) then with TDBGridEh(ActiveControl) do if CheckCutAction and (geaCutEh in EditActions) then DBGridEh_DoCutAction(TDBGridEh(ActiveControl),False); end;
我照你的意思把代码改成如下,但出现图片中的错误,请再指点一下: procedure Tfrm_ps.menucutClick(Sender: TObject); begin if ps_DBGridEh.Focused then with TDBGridEh(ActiveControl) do if CheckCutAction and (geaCutEh in EditActions) then DBGridEh_DoCutAction(TDBGridEh(ActiveControl),False); end; 还有就是我把代码改成copy后,if ps_DBGridEh.Focused then的值为false了,为什么.
procedure Tfrm_ps.menucutClick(Sender: TObject); begin if ps_DBGridEh.Focused then with ps_DBGridEh do if CheckCutAction and (geaCutEh in EditActions) then DBGridEh_DoCutAction(ps_DBGridEh, False); end;
----------------------------------------------