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,才能输入用户密码进行登录.这里笔者介绍一下如何取消这个东西. 点击“开始菜单”,点击“控制面板”. [管理工具] ...
随机推荐
- Linux内核分析--系统调用【转】
本文转载自:http://www.cnblogs.com/paperfish/p/5308505.html 前言:以下笔记除了一些讲解视频中的概念记录,图示.图示中的补充文字.总结.分析.小结部分均是 ...
- Unity3D学习笔记(九):摄像机
3D数学复习 using System.Collections; using System.Collections.Generic; using UnityEngine; public class w ...
- java多线程编程模式
前言 区别于java设计模式,下面介绍的是在多线程场景下,如何设计出合理的思路. 不可变对象模式 场景 1. 对象的变化频率不高 每一次变化就是一次深拷贝,会影响cpu以及gc,如果频繁操作会影响性能 ...
- 如何每日增量加载数据到Hive分区表
如何每日增量加载数据到Hive分区表 hadoop hive shell crontab 加载数据 数据加载到Hive分区表(两个分区,日期(20160316)和小时(10))中 每日加载前一天的日志 ...
- [Pytorch]Pytorch中tensor常用语法
原文地址:https://zhuanlan.zhihu.com/p/31494491 上次我总结了在PyTorch中建立随机数Tensor的多种方法的区别. 这次我把常用的Tensor的数学运算总结到 ...
- org.apache.jasper.JasperException: /WEB-INF/view/../../../common/common1.jsp (line: 7, column: 1) Page directive must not have multiple occurrences of pageencoding
本文为博主原创,未经允许,不得转载: 先还原错误: org.apache.jasper.JasperException: /WEB-INF/view/../../../../common/common ...
- python 处理命令行参数--转载
标题写了那么久,现在现在才有时间,整理下自己的思路.首先先总结下自己对sys模块的理解.手册上对sys的描述是系统参数和系统函数,这里的系统实际上是python解释器.这个模块提供了用户可以访问的解释 ...
- 网易云音乐综合爬虫python库NetCloud v1版本发布
以前写的太烂了,这次基本把之前的代码全部重构了一遍.github地址是:NetCloud.下面是简单的介绍以及quick start. NetCloud--一个完善的网易云音乐综合爬虫Python库 ...
- Codeforces Beta Round #94 div 2 B
B. Students and Shoelaces time limit per test 2 seconds memory limit per test 256 megabytes input st ...
- Redis的两种连接方式
1.简单连接 import redis conn = redis.Redis(host=) conn.set('foo', 'Bar') print(conn.get('foo')) a = inpu ...