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)】
查看全文
相关阅读:
第一次作业-编译原理概述
node 升级版本,指定的版本
v-show,v-if切换组件echarts显示不全的问题
js点击特效动画,小人动画
路由懒加载
echarts tree 点击动态添加子集实例
echarts中数据过多加入滚动条,相关属性dataZoom介绍
解决echarts x轴标签文字过多导致显示不全
element-ui 单选框点击整个行为选中状态
Eclipse上Maven环境配置使用
原文地址:https://www.cnblogs.com/xieyunc/p/9126611.html
最新文章
办公自动化项目从无到有-第二篇登录注册
办公自动化项目从无到有-第一篇项目搭建
商城项目团购之定时任务
商城项目后台表格的模板化处理办法
商城项目的订单管理模块的实现
商城项目的购物车模块的实现------总结
商城项目的购物车模块的实现------通过session实现
商城项目的购物车模块的实现------通过数据库实现
【论文阅读】TextSnake: A Flexible Representation for Detecting Text of Arbitrary Shapes
【论文阅读】CornerNet: Detecting Objects as Paired Keypoints
热门文章
Choosing Ice Cream
F Runway Planning
计蒜客-不合格米线
UVA-201 Squares
1018—Communication System
2664 Prerequisites?
2339Rock, Scissors, Paper
2612Mine Sweeper
poj 1528
POJ 2234
Copyright © 2011-2022 走看看