home *** CD-ROM | disk | FTP | other *** search
- unit EditListBox;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls;
-
- type
- TEditListBox = class(TListBox)
- private
- { Private declarations }
- procedure WMCHAR (var Mes: TMessage); Message WM_CHAR;
- protected
- { Protected declarations }
- public
- { Public declarations }
- constructor Create(AOwner: TComponent); override;
- published
- { Published declarations }
- end;
-
- procedure Register;
-
- implementation
-
- procedure Register;
- begin
- RegisterComponents('TDSoft', [TEditListBox]);
- end;
-
- { TEditListBox }
-
- constructor TEditListBox.Create(AOwner: TComponent);
- begin
- inherited;
- Font.Name:='Courier New';
- Font.Size:=10;
-
- end;
-
- procedure TEditListBox.WMCHAR(var Mes: TMessage);
- var
- Position: Byte;
- begin
- TForm(Parent).Caption:=IntToStr(Mes.wParam);
-
- if ItemIndex=-1 then Exit;
- Position:=Length(Items[ItemIndex]);
-
- if Position=0 then
- if chr(Mes.wParam) in ['C','D','E','F','G','A','B'] then
- Items[ItemIndex]:=chr(Mes.wParam);
-
- if Position=1 then
- begin
- if chr(Low(Mes.wParam)) = '-' then
- Items[ItemIndex]:=Items[ItemIndex] + 'b';
- if chr(Low(Mes.wParam)) = '+' then
- Items[ItemIndex]:=Items[ItemIndex] + '#';
- end;
-
- end;
-
- end.
-