Browse Source

* KeyPressed now returns a Boolean which indicates if the key has been
processed or not

sg 25 years ago
parent
commit
2f9b5b1b2b
2 changed files with 20 additions and 5 deletions
  1. 11 3
      fcl/shedit/keys.inc
  2. 9 2
      fcl/shedit/shedit.pp

+ 11 - 3
fcl/shedit/keys.inc

@@ -449,7 +449,7 @@ begin
   end;
 end;
 
-procedure TSHTextEdit.KeyPressed(KeyCode: LongWord; ShiftState: TShiftState);
+function TSHTextEdit.KeyPressed(KeyCode: LongWord; ShiftState: TShiftState): Boolean;
 var
   i: Integer;
   shortcut: TShortcut;
@@ -471,6 +471,8 @@ begin
     end;
   end;
 
+  Result := True;
+
   if ShortcutFound then begin
     // WriteLn(shortcut.Action.Descr);
     shortcut.Action.Method;	// Execute associated action
@@ -490,7 +492,9 @@ begin
     end;
   end else
     if (KeyCode <= 255) and (ShiftState * [ssCtrl, ssAlt] = []) then
-      ExecKey(Chr(KeyCode), False);
+      ExecKey(Chr(KeyCode), False)
+    else
+      Result := False;		// Key has not been processed
 
   EndSelectionChange;
 end;
@@ -498,7 +502,11 @@ end;
 
 {
   $Log$
-  Revision 1.10  2000-01-07 01:24:34  peter
+  Revision 1.11  2000-01-23 23:58:25  sg
+  * KeyPressed now returns a Boolean which indicates if the key has been
+    processed or not
+
+  Revision 1.10  2000/01/07 01:24:34  peter
     * updated copyright to 2000
 
   Revision 1.9  2000/01/06 01:20:34  peter

+ 9 - 2
fcl/shedit/shedit.pp

@@ -239,7 +239,10 @@ type
     procedure FocusIn;
     procedure FocusOut;
     procedure DrawContent(x1, y1, x2, y2: Integer);
-    procedure KeyPressed(KeyCode: LongWord; ShiftState: TShiftState); virtual;
+
+    // Return value: True=Key has been pressed, False=Key has not been processed
+    function  KeyPressed(KeyCode: LongWord; ShiftState: TShiftState): Boolean; virtual;
+
     procedure StartSelectionChange;
     procedure EndSelectionChange;
 
@@ -473,7 +476,11 @@ end.
 
 {
   $Log$
-  Revision 1.13  2000-01-07 13:24:31  sg
+  Revision 1.14  2000-01-23 23:59:02  sg
+  * KeyPressed now returns a Boolean which indicates if the key has been
+    processed or not
+
+  Revision 1.13  2000/01/07 13:24:31  sg
   * OK, now _this_ is the originally meant version with the fixed
     selection handling ;)