Autor Beitrag
motion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: Sa 21.05.05 12:52 
Ich möchte in einer eigenen Edit-Komponente eine besondere Löschfunktion auf Ctrl-Backspace legen.

Kein Problem denke ich mir:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (Shift=[ssCtrl]) and (key=VK_Back) then
      Begin
       Beep; //hier später Spez.Funkt.hin
       key:=0;
      End;
  inherited;
end;

Aber leider wird trotzdem ein Keypressed Ereignis ausgelöst, in dem der Backspace noch drin ist (und dann seine eigene Funktion im TEdit durchführt). Wie unterdrücke ich die Backspace-Verarbeitung?

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 21.05.05 17:59 
Setze im Formular mal KeyPreview auf True und implementier diese Routine in Form.OnKeyPress.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
motion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: Sa 21.05.05 20:59 
Das ist leider noch nicht möglich,
weil
1.) Die Steuerung in einer Komponenten-Klassendefinition erfolgen muss (es entsteht eine abgeleitete TEdit Komponente)
2.) Den Shift Status kann ich nur im KeyDown abfangen, wo auch dann die spezielle Operation erfolgen muss; normale Backspace Operationen sollen ja weiterhin gestattet sein.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 22.05.05 09:51 
Die Behandlung von Key-Ereignissen erfolgt aber bereits in OnKeyPress, weshalb Du die Behandlung des Ereignisflusses etwas nach vorne ziehen musst.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.