G'day all,

Here is another one.

Create a new form and place a TMainMenu, TEdit and TButton on the form.

Create a File/Quit menu and assign the quit menu the shortcut ctrl+W.

Hook it up. (This is the only piece of code in the project really)

procedure TForm1.MenuQuitClick(Sender: TObject);
begin
   Close;
end;

Now, when the TEdit has focus, the shortcut does not work. The only way to get 
it to work is click 
the button (to focus it). Now you can close the form with ctrl-W.

This seems to be prevalent with any component that takes a keyboard input (I 
noticed it with 
TSynEdit initially).

v0.9.27 r16943M i386-linux-gtk 2 (beta)

Free Pascal Compiler version 2.2.3 [2008/10/08] for i386
Copyright (c) 1993-2008 by Florian Klaempfl


unit Unit1;

{$mode objfpc}{$H+}

interface

uses
   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
   SynEdit, Menus, StdCtrls;

type

   { TForm1 }

   TForm1 = class(TForm)
     Button1: TButton;
     Edit1: TEdit;
     MainMenu1: TMainMenu;
     MenuFile: TMenuItem;
     MenuQuit: TMenuItem;
     procedure FormCreate(Sender: TObject);
     procedure MenuQuitClick(Sender: TObject);
   private
     { private declarations }
   public
     { public declarations }
   end;

var
   Form1: TForm1;

implementation

{ TForm1 }

procedure TForm1.MenuQuitClick(Sender: TObject);
begin
   Close;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

end;

initialization
   {$I unit1.lrs}

end.

Regards,
Brad
-- 
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to