improve memo/edit keystroke "handled" property, which is, message result

add ability to continue processing shortcut events (fixes issue #1308)

git-svn-id: trunk@8062 -
This commit is contained in:
micha 2005-11-05 10:19:27 +00:00
parent 4983bbc0af
commit 68d4ba68c5
6 changed files with 10 additions and 8 deletions

View File

@ -11976,7 +11976,11 @@ begin
if (CurFocusControl<>nil) then begin
CurFocusControl:=GetParentForm(CurFocusControl);
if (CurFocusControl<>MainIDEBar) and (CurFocusControl<>SourceNotebook) then
begin
// continue processing shortcut, not handled yet
MainIDEBar.mnuMainMenu.ShortcutHandled := false;
exit;
end;
end;
DoCommand(EditorCommand);
end;

View File

@ -336,7 +336,8 @@ procedure TCustomEdit.WMChar(var Message: TLMChar);
begin
// all normal characters are handled by the Edit
//debugln('TCustomEdit.WMChar ',DbgSName(Self),' ',dbgs(Message.CharCode));
if Message.CharCode in [ord('A')..ord('Z'),ord('a')..ord('z')] then
if (KeyDataToShiftState(Message.KeyData) * [ssCtrl, ssAlt] = [])
and (Message.CharCode in [ord('A')..ord('Z'),ord('a')..ord('z')]) then
// eat normal keys, so they don't trigger accelerators
Message.Result := 1
else

View File

@ -211,12 +211,6 @@ begin
inherited ControlKeyDown(Key, Shift);
end;
procedure TCustomMemo.WMChar(var Message: TLMChar);
begin
// all normal characters are handled by the memo
Message.Result := 1;
end;
{------------------------------------------------------------------------------
Method: TCustomMemo.SetWordWrap
Params:

View File

@ -152,9 +152,11 @@ begin
Result := Item <> nil;
if Result then
begin
FShortcutHandled := true;
Item.InitiateActions;
Item.Click;
end;
Result := FShortcutHandled;
end;
{------------------------------------------------------------------------------

View File

@ -272,6 +272,7 @@ type
FItems: TMenuItem;
FOnChange: TMenuChangeEvent;
FParent: TComponent;
FShortcutHandled: boolean;
procedure SetImages(const AValue: TCustomImageList);
procedure SetParent(const AValue: TComponent);
procedure ImageListChange(Sender: TObject);
@ -299,6 +300,7 @@ type
public
property Handle: HMenu read GetHandle;
property Parent: TComponent read FParent write SetParent;
property ShortcutHandled: boolean read FShortcutHandled write FShortcutHandled;
published
property Items: TMenuItem read FItems;
property Images: TCustomImageList read FImages write SetImages;

View File

@ -672,7 +672,6 @@ type
procedure Loaded; override;
function WordWrapIsStored: boolean; virtual;
procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override;
procedure WMChar(var Message: TLMChar); message LM_CHAR;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;