TMemo Ctrl + A
http://delphi.about.com/od/adptips2004/a/bltip0804_4.htm
Here's how to implement the code for the CTRL+A key combination ("Select All") for TMemo or TDBMemo:
~~~~~~~~~~~~~~~~~~~~~~~~~
Just drop a memo (Memo1:TMemo) on a form (Form1:TForm) and handle the OnKeyDown event for Memo1 as:
procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState) ;
begin
if (Key = Ord('A')) and (ssCtrl in Shift) then
begin
TMemo(Sender).SelectAll;
Key := 0; //这里即使为0,Windows系统还是能继续接到按键的信息,然后就会导致 BEEP 声音(win7是当当的声音),因为这里只是 KeyDown。
end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Note: here's how to check the state of CTRL, ALT and SHIFT keys.
http://stackoverflow.com/questions/8466747/automatically-allowing-ctrla-to-select-all-in-a-tmemo
|
In Delphi 7's TMemo control, an attempt to do the key combo
Is there a trick so that I don't have to do this procedure? And if not, then does this procedure look OK? |
|||||||||||||||||||||
|
|
This is more elegant:
|
|||||||||||||||||||||
|
Your Answer
How to add the "Select All (CTRL+A)" functionality to TMemo/TDBMemo
Question: How to add the "Select All (CTRL+A)" functionality to TMemo/TDBMemo.
Answer:
To implement the code for the CTRL+A key combination ("Select All") for TMemo, TDBMemo or any of it's descendants implement the following code on the OnKeyDownEvent:
procedure OnKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState) ;
begin
if (Key = Ord('A')) and (ssCtrl in Shift) then
begin
TMemo(Sender).SelectAll;
Key := 0;
end;
end;
from: http://delphi.cjcsoft.net//viewthread.php?tid=45347
if (Key = Ord('c')) or (Key = Ord('C')) then
ShowMessage('Ctrl+C');
end;
先判断是否按下ctrl才是正确的次序。
TMemo Ctrl + A的更多相关文章
- Delphi 记事本 TMemo
Windows记事本记事本 描述: 用Delphi模仿的Windows记事本 界面和功能都和Windows的记事本一样,是用Memo实现的而不是RichEdit 可以执行以下功能 文件 ...
- Delphi TMemo 可以显示、编辑多行文本
多行编辑框组件(TMemo)TMemo组件可以显示.编辑多行文本,是一个标准的Windows多行编辑组件.对一些比较多的文本内容可以利用TMemo组件来显示.编辑. 1.TMemo组件的典型用法 TM ...
- Windows cmd 长时间不输出新内容 直到按下ctrl + c 取消或者回车的解决办法
换了一台新电脑, 在使用 ant 拷贝大量文件的时候 cmd 窗口过了很久没有继续输出新的内容,远远超过平时的耗时, 以为已经卡死 按下 ctrl + c 取消, 这时并没有取消, 而是输出了新内容, ...
- [No00008B]远程桌面发送“Ctrl+Alt+Delete”组合键调用任务管理器
向远程桌面发送"Ctrl+Alt+Delete"组合键的两种方法 1.在本地按下Ctrl+Alt+End,可以成功发送"Ctrl+Alt+Delete"组合键! ...
- Linux下的ctrl常用组合键
在linux的命令模式下使用ctrl组合键能让操作更便捷. ctrl + k -- 剪切光标及其后边的内容: ctrl + u -- 剪切光标之前的内容: ctrl + y -- 在光标处粘贴上两个命 ...
- 鼠标上下滑动总是放大缩小页面,按住ctrl+0
鼠标上下滑动总是放大缩小页面,可能是ctrl键失灵了,幸好键盘有两个ctrl键,按住ctrl+0,页面就正常了,吓死宝宝了,~~~~(>_<)~~~~
- eclipse中ctrl+h默认打开是JavaSearch,怎么设置成默认打开是FileSearch
window->preferences->General->keys. 找到File Search(有搜索框的,可以搜索),然后在下方 Binding按下ctrl +h .
- CapsLock与ctrl的键位修改
windows下修改方式: linux下修改方式: 在用户目录下新建文档命名为keychange.sh 编辑以下内容: remove Lock = Caps_Lock remove Control = ...
- windows 中去除Ctrl+Alt+Del才能登录
安装windows 7后登录的时候有一样很麻烦的步骤是需要先按Ctrl+Alt+Del,才能输入用户密码进行登录.这里笔者介绍一下如何取消这个东西. 点击“开始菜单”,点击“控制面板”. [管理工具] ...
随机推荐
- Java命令使用 jmap,jps,jstack,jstat,jhat,jinfo
Jmap:可以获得运行中的jvm的堆的快照,从而可以离线分析堆,以检查内存泄漏,检查一些严重影响性能的大对象的创建,检查系统中什么对象最多,各种对象所占内存的大小等等 Jmap是一个可以输出所有内存中 ...
- 项目中同一个dll的x86和x64同时引用
<ItemGroup Condition=" '$(Platform)' == 'x86' "> <Reference Include="System. ...
- BZOJ2724 [Violet]蒲公英 分块
题目描述 经典区间众数题目 然而是权限题,所以题目链接放Luogu的 题解 因为太菜所以只会$O(n*\sqrt{n}+n*\sqrt{n}*log(n))$的做法 就是那种要用二分的,并不会clj那 ...
- 初始 DQN 程序 所遇到的问题
初始 DQN 程序 所遇到的问题 最近在看 DQN,但是想试试别人放出来的 code,但是发现,额,各种问题,在此记录,以备不时之需! 问题1. wangxiao@GTX980:~/Documents ...
- UVa 1411 Ants(分治)
https://vjudge.net/problem/UVA-1411 题意:n只蚂蚁和n颗苹果树,一一配对并且不能交叉. 思路:这就是巨人与鬼的问题.用分治法就行了. #include<ios ...
- Hadoop 部分截图
- VS 常见快捷键有哪些
自动对齐点[编辑]-[高级]-[设置选定内容的格式]或者按Ctrl + K 然后再按Ctrl + F 就好了 你可以在常用快捷键自定义 窗口中进行查看1.进入工具-选项 对话框2.选择[环境]-[键盘 ...
- 什么是分布式锁?Redis实现分布式锁详解
在很多场景中,我们为了保证数据的最终一致性,需要很多的技术方案来支持,比如分布式事务.分布式锁等.那具体什么是分布式锁,分布式锁应用在哪些业务场景.如何来实现分布式锁呢?今天继续由陈睿|mikeche ...
- How to implement connection pool in spark streaming
在spark streaming的文档里,有这么一段: def sendPartition(iter): # ConnectionPool is a static, lazily initialize ...
- 『cs231n』作业2选讲_通过代码理解Dropout
Dropout def dropout_forward(x, dropout_param): p, mode = dropout_param['p'], dropout_param['mode'] i ...