Delphi 备忘录框无法捕获 Return 键

发布于 2024-09-08 14:21:51 字数 263 浏览 1 评论 0原文

我有一个具有两种表单的应用程序,两者都是对话框,它们都有备忘录框,并且它们都有一个“确定”按钮,但是一个对话框的行为与另一个不同 - 如果我在备忘录区域并且我输入一些内容并且然后按 Enter 键,窗体关闭,但在另一种窗体中,它会转到备忘录中的下一行(这就是我希望它的行为方式)。

我不知道如何修复其他表单,以便在备忘录中按 Enter 键不会关闭它,而是使其转到下一行。我什至将备忘录组件从“好”表单复制到“坏”表单,它仍然这样做,还比较了表单属性,但它们是相同的!知道为什么会发生这种情况吗?

I have an application with two forms, both are dialogs and they both have memo boxes in them and they both have an OK button on them, however one dialog behaves differently from the other - if I am in the memo area and i type something and then press enter, the form closes but in the other form it goes to the next line in the memo (this is how I want it to behave).

I don't know how to fix the other form so that pressing enter inside the memo does not close it but makes it go to the next line. I even copied the memo component from the 'good' to the 'bad' form and it still does that, also compared the form properties but they are the same! Any idea why this is happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮华 2024-09-15 14:21:51

两种可能性:

1) 备忘录需要有 WantReturn 以便备忘录本身处理 RETURN 键。

2) 检查表单上任何不起作用的 KeyPress/KeyDown/KeyUp 处理程序,看看它们是否处理 RETURN 键。如果表单的 KeyPreview=TRUE,则表单的键盘处理程序将在备忘录之前执行,如果表单的键处理程序处理 RETURN,则备忘录将永远不会看到它。

Two possibilities:

1) The Memo needs to have the WantReturn in order for the memo itself to process the RETURN key.

2) Check any KeyPress/KeyDown/KeyUp handler on the form that doesn't work to see if they process a RETURN key. If the form has KeyPreview=TRUE then the form's keyboard handler will be executed BEFORE the memo's and if the form's keyhandler processes RETURN then the memo will never see it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文