FormShortCut MainForm 和 二级FORM

发现,主FORM 定义的快捷键,在二级FORM里也有效。

反过来,就无效。

这样的话,就要考虑 快捷键的冲突问题 了,本来以为不同的FORM 是独立的。

http://codeverge.com/embarcadero.delphi.vcl.using/shortcuts-of-the-main-form-acces/1076501

John Schmidt wrote:

> Hi,
>
> I experience problems when using keys in nonmodal shown SDI forms of
> the application if they are used as shortcuts in the main form. Iif
> the sub-form is shown modal than all works fine. How can I work
> around this ‘feature‘? - It‘s URGENT! - Thanks!

The behaviour is actually intentional, it is for the support of typical
SDI apps where only the main form has a menu that is "shared" by the
child forms (an app like the IDE itself). Quite a bit of the VCL
behaviour is dictated by the requirements of the IDE...

To fix this problem you have to override the main form‘s IsShortcut
method, like this:

  public
    function IsShortCut(var Message: TWMKey): Boolean; override;

function TMainform.IsShortcut( Var Message: TWMKey ): Boolean;
begin
  if Screen.Activeform <> self then
    Result := false
  else
    Result := inherited IsShortcut(Message);
end;    

This way the main form will only process shortcuts when it itself is
the active form.

--
Peter Below (TeamB)
Don‘t be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://codenewsfast.com
http://groups.google.com
时间: 2024-08-19 10:09:27

FormShortCut MainForm 和 二级FORM的相关文章

Windows Live Writer介绍及相关问题解决

今天本来想说更新一篇我的文章,更新的过程中添加了很多的内容,里面的图片太多了,导致我浏览器占用的内存不断增大,浏览器变得很卡,最后过了好久我终于更新完文章打算保存的时候居然卡住,然后所有我更新的文字和图片都丢失了,文章变得和更新钱一样,我很不爽,之前从来没有遇见这种情况,可能也就是因为写文章的时候添加的文字和图片太多了,于是我就想说能不能不用浏览器编辑博客文章,而换用一个软件来操作,这样就不会那么卡顿,很快我发现了博客园推荐使用的Windows Live Writer工具,这个工具其实我之前也见

c#设计应用程序单实例运行

利用WindowsFormsApplicationBase的IsSingleInstance来控制应用程序只能单实例运行. [DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)] public static extern int ShowWindow(IntPtr hwnd, int nCmdShow); [DllImport("User32.dll"

C# 使用摄像头拍照 支持Win7 64位

原文:C# 使用摄像头拍照 支持Win7 64位 So, how do we capture an image from a WebCam? Once you download the source code that is attached to the article you should have the following three projects: Demo – simple Windows Forms project that demonstrates how a WebCam

sSkinProvider.pas

unit sSkinProvider;{$I sDefs.inc}{.$DEFINE LOGGED} interface uses Windows, Messages, SysUtils, Classes, Graphics, Forms, Dialogs, sDefaults, menus, sSkinMenus, sSkinManager, sConst, sCommondata, Controls, acSBUtils{$IFDEF TNTUNICODE}, TntWideStrUtils

MVC 提交方法

MVC 使用Jquery实现AJax <script type="text/javascript"> function GetTime() { $.get("Home/GetTime", function (response) { $("#myPnl").html(response); }); return false; } </script> <div id="myPnl" style=&quo

C# 基于Directshow.Net lib库 USB摄像头使用DirectShow.NET获取摄像头视频流

https://blog.csdn.net/u010118312/article/details/91766787 https://download.csdn.net/download/u010118312/11238555 https://github.com/wanglong/DirectShow.NET-Webcam-Barcode-Reader 开源社区提供了DirectShow的.NET版本,为C#开发者提供了便利.这里分享下如何用DirectShow.NET API来启动摄像头,以及

ASP.NET + MVC5 入门完整教程二

原文链接:https://blog.csdn.net/qq_21419015/article/details/80318046 从前端UI开始 MVC分离的比较好,开发顺序没有特别要求,先开发哪一部分都可以,这次我们主要讲解前端UI的部分.而谈到一个Web Application的UI,涉及到的无非就是html.css. js这些东西.有兴趣的同学可以看看EsayUI. 任务建立 注册/登录UI 步骤(静态页面功能实现) 借助bootstrap加入页面样式,补充其他功能,将前面的代码扩展成一个开

矿业大学论文模板

main.tex 1 \documentclass[preprint,authoryear,PhD]{cumtthesis} 2 \usepackage{fancyvrb}%----------------------------------------------------------用于代码排版 3 \DefineVerbatimEnvironment{shell}{Verbatim}% 4 {frame=single,framerule=0.3mm,rulecolor=\color{re

ajax技术实现登录判断用户名是否重复以及利用xml实现二级下拉框联动

今天学了ajax技术,特地在此写下来作为复习. 一.什么是ajax? 客户端(特指PC浏览器)与服务器,可以在[不必刷新整个浏览器]的情况下,与服务器进行异步通讯的技术  即,AJAX是一个[局部刷新]的[异步]通讯技术, 说白了就是局部刷新. 二.ajax的原理如下图 附上ajax与服务器之间的几种状态,但 4是所有浏览器都支持的的 三.ajax包含的技术如下图 四.ajax开发步骤 步一:创建ajax对象,例如:ajax = createAjax(); 步二:开启异步对象:例如:ajax.o