首页 > 代码库 > FormShortCut MainForm 和 二级FORM
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 typicalSDI apps where only the main form has a menu that is "shared" by thechild forms (an app like the IDE itself). Quite a bit of the VCLbehaviour is dictated by the requirements of the IDE...To fix this problem you have to override the main form‘s IsShortcutmethod, 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 isthe active form.-- Peter Below (TeamB) Don‘t be a vampire (http://slash7.com/pages/vampires), use the newsgroup archives :http://codenewsfast.comhttp://groups.google.com
FormShortCut MainForm 和 二级FORM
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。