Autor Beitrag
schneegurke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 19

Win XP
C# (VS 2003, 2005 Express)
BeitragVerfasst: Do 25.09.03 17:08 
Ich hab folgendes Objekt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
TSyntaxMemo = class(TCustomControl)
  private
    Buffer: TBitmap;
    Line: string;
    Lines: TStringList;
    cx, cy, tw, th: Integer;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  protected
    procedure KeyDown(var Key: Word; Shift: TShiftState); override;
    procedure KeyUp(var Key: Word; Shift: TShiftState); override;
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
    procedure Paint; override;
    procedure Resize; override;
  end;


Wenn ich jetzt z.B. folgende Zeile in KeyDown schreibe passiert nichts, wenn ich die entsprechende Taste drücke:

if Key = VK_LEFT then Halt;

Schreibe ich die gleiche Zeile in KeyUp, bricht mein Programm ab. Warum geht das nur bei KeyUp?
Horst
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: Do 25.09.03 20:48 
Hey,

entweder hast du die Methode keydown überschrieben,
oder im Form wurde keyPreview nicht auf True gesetzt.

Hilft das weiter :?:

Gruß

Horst
:wave:
schneegurke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 19

Win XP
C# (VS 2003, 2005 Express)
BeitragVerfasst: Fr 26.09.03 13:26 
Also die Methode muss ich doch überschreiben, oder etwa nicht? Sonst kommt vom Compiler immer ne Warnung. Selbst wenn ich sie nicht überschreibe, gehts nicht.

An KeyPreview liegts leider auch nicht. Es funktionierne ja alle anderen Tasten wie z.B. die F-Tasten, Pos1 etc.

Nur eben die vier Pfeiltasten nicht.