delphi GridEh 去掉光标

  //去掉手输  -号 表示去掉   +号表示增加
    grdAllot.Options:=grdAllot.Options-[dgEditing];

无法取得光标焦点

 

 

procedure Tmain.grdAllotDrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
begin
     if InExt(Column.FieldName,[OrderName,StockName]) then    //判断 当前选择的字段名,对应的另外两个,设置颜色
     begin
      grdAllot.Canvas.Brush.Color :=clyellow;
      grdAllot.DefaultDrawColumnCell(Rect,DataCol,Column,State);
     end;
end;

//在Grideh中 输入后,键盘 弹起,触发,这个可以里面可以函数方法 ,比如,统计 所有的尺码的合计

procedure Tmain.grdAllotKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  ShowMessage('触发到这了')
//grdAllot.DataSource.DataSet.FindField('GoodsID').FocusControl;
end;

TDBGridEh组件的OptionsEh选项中有一项:dghDialogFind,默认值为True


    TDBGridEh组件的OptionsEh选项中有一项:dghDialogFind,默认值为True。此属性使表格在运行状态下,用户只需按下Ctrl + F热键,即可调出一个现成的查找对话框来,而无须程序员写其他任何查找相关的代码了。
  EhLib提供的这个功能实在巧妙,它可省了程序员的不少功夫,而且用来在表格中对数据定位,其功能也相当完善。
  有些时候,开发者还可能需要用代码来实现Ctrl + F热键的调用。大致可有二种可行的方法:
  1、笨方法--模拟Ctrl + F按键事件,使用Windows API函数Keybd_Event()如下所示:
  Keybd_Event(VK_CONTROL,Byte(0),0,0);
  Keybd_Event(Byte(70),Byte(0),0,0);
  Keybd_Event(Byte(70),Byte(0),KeyEventF_KEYUP,0);
  Keybd_Event(VK_CONTROL,Byte(0),KeyEventF_KEYUP,0);
  2、引用EhLib包的DBGridEhFindDlgs单元提供的标准方法ExecuteDBGridEhFindDialog():
  调用示例:ExecuteDBGridEhFindDialog(TDBGridEh组件名,'','',nil,True); 
  该方法声明如下:
  procedure ExecuteDBGridEhFindDialog(Grid: TCustomDbGridEh; Text, FieldName: String; ColumnFields: TColumnFieldsArrEh; Modal: Boolean); 
  参数Grid用以指定一个特定的TDBGridEh组件;Text用以指定一个特定查找文本(可为空串'');FieldName用以指定一个特定的查找字段名(可为空串'');ColumnFields用以指定一个查找字段列表的动态数组(可置为nil,表示默认为全部Columns);Modal用以指定对话框是否以模态打开。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值