- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要intercept the WM_PASTE
message对于放置在 TFrame
的后代类中的 TEdit
组件。
如果不满足条件,我想启动粘贴操作。
有没有办法在帧级别做到这一点? (我的意思是,没有声明 TEdit
的后代)
最佳答案
Is there a way to do this at the frame level? (I mean, without declaring a
TEdit
's descendant)
WM_PASTE
直接发送至TEdit
窗口,TFrame
永远不会看到它,所以您必须子类化 TEdit
直接拦截消息。您可以:
有TFrame
将处理程序分配给 TEdit
的WindowProc
属性(property)。如果您只有几个TEdit
,这是一个简单的方法。 s 到子类,但越多就越复杂 TEdit
您想要子类化:
type
TMyFrame = class(TFrame)
Edit1: TEdit;
...
procedure FrameCreate(Sender: TObject);
...
private
PrevWndProc: TWndMethod;
procedure EditWndProc(var Message: TMessage);
...
end;
procedure TMyFrame.FrameCreate(Sender: TObject);
begin
PrevWndProc := Edit1.WindowProc;
Edit1.WindowProc := EditWndProc;
...
end;
procedure TMyFrame.EditWndProc(var Message: TMessage);
begin
if Message.Msg = WM_PASTE then
begin
if SomeCondition then
Exit;
end;
PrevWndProc(Message);
end;
编写并安装一个源自 TEdit
的新组件,类似于 TMemo
example you presented .
定义一个仅位于 TFrame
本地的插入器类。的单位,位于 TFrame
上方类声明,它将拦截 WM_PASTE
对于每个TEdit
在框架上:
type
TEdit = class(Vcl.StdCtrls.TEdit)
procedure WMPaste(var Message: TMessage); message WM_PASTE;
end;
TMyFrame = class(TFrame)
Edit1: TEdit;
Edit2: TEdit;
...
end;
procedure TEdit.WMPaste(var Message: TMessage);
begin
if not SomeCondition then
inherited;
end;
关于delphi - 如何拦截和抑制 TFrame 子组件的消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49304718/
我收到警告 Circular dependency detected! 在 Angular 6 中,我知道为什么会出现这个问题,但这根本不是问题。 我目前正在使用 SVG,按照我的逻辑,我会防止可能出
我试图抑制 clang/gcc 中地址清理程序发出的警告 我的源文件如下所示: int foo(){ double bar[] = {7,8}; return bar[3]; } int ma
我在微服务架构中有一个应用程序。该应用程序从不同的源获取数据,并且从其他各种应用程序获得许多不同的错误响应。某些异常(例如404-Not Found异常)可以引发并返回给最终用户,但其他异常(错误请求
我喜欢使用 readxl包裹。但是,我一直将它用作 RMarkdown 文档和一些 read_excel() 文档的一部分。读入文件时的消息在进行分析时很有用,但在尝试呈现分析时则不然。所以问题是,在
当我编译 JAXB 模式时,生成的类用通用 Javadoc 注释进行修饰。 是否有可能以某种方式抑制生成这些评论? 最佳答案 Annotation to disable JavaDocs Not if
我正在尝试运行专为 Vuze 设计的插件使用Java。为此,我使用这样的命令: /home/x/jre1.6.0_14/bin/java -Dazureus.config.path=/home/x/p
所以 - 我正在使用库 pyminizip - 这是我发现创建受密码保护的 zip 文件的唯一方法。当我使用它时,我收到一个弃用警告:“#”格式需要 PY_SSIZE_T_CLEAN。 现在,我无法控
这个问题在这里已经有了答案: Is ticklabel_format broken? (1 个回答) 关闭 2 年前。 我是 geopandas 的新手,我正在尝试用常规记数法而非科学记数法绘制带有
我从 Valgrind 得到以下日志: MPK ==5263== 4 bytes in 1 blocks are still reachable in loss record 1 of 84 ==52
有什么方法可以抑制 mediawiki 中的贬低警告吗?例如我在个人 wiki 站点的某些页面顶部收到此消息。 Deprecated: Use of MWNamespace::getSubject w
我正在使用 ScheduledThreadPoolExecutor 执行定期任务。 执行必须是周期性的,而不是固定的延迟。 我遇到了以下问题:考虑一个任务的时间为 1 分钟。如果任务需要 5 分钟才能
我是使用 RScaLAPACK 的 R 新手,每次我生成一个新的进程网格时,我都会收到一条消息。 > sla.gridInit(2) [1] "RScaLAPACK:Process Grid Init
我目前正在使用包 readr 读取文件.这个想法是使用 read_delim逐行读取以查找非结构化数据文件中的最大列数。代码输出有 parsing问题。我知道这些并将在导入后处理列类型。有没有办法关闭
所以我试图防止 fatal error 阻止我的脚本运行 所以我将错误报告设置为0: error_reporting(0); 然后我添加了一些垃圾代码.. junk code~~~~trolololo
在使用 summary() 函数(例如,stata 中的 absorb() 函数的等价物)时,是否有一种方法可以抑制线性模型中固定效应的系数。例如,我希望汇总函数只输出截距和 x,而不是因子的系数和标
如何抑制 SBT 的调试消息?它们被记录到标准输出,所以运行一个项目会产生这个: $ cat src/main/scala/Hello.scala object Hello { def main(
有没有办法抑制 Doxygen 对特定文件发出“未记录”警告?我的项目有几个自动生成的代码头,导致它抛出成百上千的错误,难以筛选。 最佳答案 如 documentation 中所述,有一个配置选项。
R的eHOF包中的HOF函数会自动生成进度条。函数中没有关闭进度条的参数。 有什么办法可以抑制函数外的进度条的生成? (我正在应用该功能数百次,目前进度条除了淹没我的屏幕外没有任何作用。) 最佳答案
随着所有 SDK 的出现,能够方便地针对多个 SDK 和平台进行构建。然而,从 3.2 跳到 3.0,甚至偶尔跳到 2.x,我经常收到涉及已更改或被取代的方法的弃用警告: warning: 'UIKe
我创建了一个 PowerShell 脚本,该脚本将为 Cisco Meraki 添加 VPN 连接。 脚本本身按预期运行,但如果发生错误,则会出现“已完成”弹出窗口,并在 PS 窗口中显示错误消息。
我是一名优秀的程序员,十分优秀!