home *** CD-ROM | disk | FTP | other *** search
- unit Entlist;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls;
-
- type
- TEnterListBox = class(TListBox)
- private
- { Private declarations }
- protected
- { Protected declarations }
- procedure KeyPress(var Key: Char); override;
- procedure KeyDown(var Key: Word; Shift: TShiftState); override;
- public
- { Public declarations }
- published
- { Published declarations }
- end;
-
- procedure Register;
-
- implementation
-
- procedure Register;
- begin
- RegisterComponents('Samples', [TEnterListBox]);
- end;
-
- procedure TEnterListBox.KeyPress(var Key: Char);
- var
- MYForm: TForm;
- begin
-
- if Key = #13 then
- begin
- MYForm := GetParentForm( Self );
- if not (MYForm = nil ) then
- SendMessage(MYForm.Handle, WM_NEXTDLGCTL, 0, 0);
- Key := #0;
- end;
-
- if Key <> #0 then inherited KeyPress(Key);
-
- end;
-
- procedure TEnterListBox.KeyDown(var Key: Word; Shift: TShiftState);
- var
- MYForm: TForm;
- CtlDir: Word;
- begin
-
- if ((Key = VK_UP) or (Key = VK_DOWN)) and (Shift = [ssShift]) then
- begin
- MYForm := GetParentForm( Self );
- if Key = VK_UP then CtlDir := 1
- else CtlDir :=0;
- if not (MYForm = nil ) then
- SendMessage(MYForm.Handle, WM_NEXTDLGCTL, CtlDir, 0);
- end
- else inherited KeyDown(Key, Shift);
-
- end;
-
-
-
- end.
-