zoukankan
html css js c++ java
古老话题:如何实现应用程序中的”回车”成TAB?
如何实现应用程序中的”回车”成TAB?
其实方法有很多种,但哪一种才是最简洁、最灵活的呢?
下面的方法就是博主最常使用的方法:
一、在你的数据模块中,添加如下代码:
interface 。。。。。。 type TMessageHandler = class //使得回车消息转换成Tab消息 class procedure AppMessage(var Msg:TMsg;var Handled:Boolean); end; implementation class procedure TMessageHandler.AppMessage(var Msg: TMsg; var Handled: Boolean); begin if Msg.message=WM_KEYDOWN then if (Msg.wParam=VK_RETURN ) and ( (Screen.ActiveForm.ActiveControl is TEdit) or (Screen.ActiveForm.ActiveControl is TComboBox) or (Screen.ActiveForm.ActiveControl is TCheckBox) or (Screen.ActiveForm.ActiveControl is TRadioButton) //可以添加需要的控件 ) then begin Msg.wParam:=VK_TAB; end else if (Msg.wParam=VK_RETURN) and ( (Screen.ActiveForm.ActiveControl is TDBGrid) ) then begin with Screen.ActiveForm.ActiveControl do begin if Selectedindex<(FieldCount-1) then Selectedindex:=Selectedindex+1{ 移动到下一字段} else Selectedindex:=0; end; end; end;
二、为了使得整个应用程序都能够实现主要的功能,在主窗体的OnCreate事件中添加如下代码:
procedure TfmMain.FormCreate(Sender: TObject); begin Application.OnMessage:=TMessageHandler.AppMessage; end;
到此为止,你的应用程序已经实现了这个Enter->Tab的转换.
谢祥选【小宇飞刀(xieyunc)】
查看全文
相关阅读:
ajax标准写法
javascript序列化表单追加参数
javascript获取url参数的方式
jmeter实现跨线程组传递参数
代码扫描工具SonarQube+Scanner的基本安装与应用
给定一个非空正整数的数组,把数值与出现的次数存在一个新的字典中,并按照出现的次数排序
定义一个函数,实现整数列表中偶数在左边,奇数在右边(不借助其它列表)
python-leetcode1在一个整数数组中找出两数之和等于目标值,并把两数下标存在list中返回
python根据key对字典进行排序
python实现对浮点型的四舍五入
原文地址:https://www.cnblogs.com/xieyunc/p/9126611.html
最新文章
JS对select动态添加options操作(主流浏览器兼容)
img 标签 访问图片 返回403 forbidden问题
ios移动端部分手机不支持background-attachment: fixed 的解决办法
自动化测试接入飞书告警
解决Python 使用pip安装库时出现的超时错误
Charles 断点修改Response
抓包工具-Charles基础使用(二)
抓包工具-Charles基础使用(一)
Jmeter简单压测之服务器监控
谷歌浏览器油猴插件的使用
热门文章
博客园个性化样式设置(二)
博客园个性化样式设置(一)
python 中open文件路径的选择
Java定时任务工具详解之Timer篇
IP地址,子网掩码,默认网关
javascript进度条实现
MySQL绿色版mysql-5.7.17-winx64简洁安装教程
微信公众号支付入坑-02
微信公众号支付入坑-01
ajax实现文件上传,多文件上传,追加参数
Copyright © 2011-2022 走看看