home *** CD-ROM | disk | FTP | other *** search
- unit Main;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: DRAGLIST }
-
- { Use Drag and Drop to drag text from a listbox to
- an edit control. }
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs,
- Messages, Classes, Graphics,
- Controls, Forms, Dialogs,
- StdCtrls;
-
- type
- TForm1 = class(TForm)
- Edit1: TEdit;
- ListBox1: TListBox;
- Label1: TLabel;
- procedure FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure Edit1DragOver(Sender, Source: TObject; X, Y: Integer;
- State: TDragState; var Accept: Boolean);
- procedure Edit1DragDrop(Sender, Source: TObject; X, Y: Integer);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- if ssAlt in Shift then
- if Key = vk_Tab then
- Edit1.Text := 'Bingo';
- end;
-
- procedure TForm1.Edit1DragOver(Sender, Source: TObject; X, Y: Integer;
- State: TDragState; var Accept: Boolean);
- begin
- Accept := True;
- end;
-
- procedure TForm1.Edit1DragDrop(Sender, Source: TObject; X, Y: Integer);
- begin
- Edit1.Text := (Source as TListBox).ITems.Strings[ListBox1.ItemIndex];
- end;
-
- end.
-