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)】
查看全文
相关阅读:
QQ空间爬虫--获取好友信息
分层最短路-2018南京网赛L
安装SSH,配置SSH无密码登陆
树形DP--求树上任意两点间距离和
JTS基本概念和使用
odps编写UDF的实现
oozie安装总结
同步工具的选择
转:hive面试题
转:hive-列转行和行转列
原文地址:https://www.cnblogs.com/xieyunc/p/2793625.html
最新文章
sql语句读取所有父子标签
对一个存储过程语法的解读
一个oracle存储过程
字符串时间日期转为Date格式和long格式
海量数据相似度计算之simhash和海明距离
Pointers and Strings
VC知识库
c# 简单又好用的四舍五入方法
PDF
CLR Profiler
热门文章
sql server的sql 语句中的列名包含[]时候,把]替换成]]就可以
(转)c#中判断是不是数字和字母
Excel 电子表格文件格式剖析
DockManager
安卓--组建通信
安卓--ListView
安卓--布局设计-计算器
JavaWeb中MVC的使用--以管理系统举例
求解热传导方程matlab
2018沈阳网赛F--上下界网络流
Copyright © 2011-2022 走看看