Registriert seit: 29. Nov 2003
Ort: San Diego, CA/USA
1.446 Beiträge
Delphi 2006 Architect
|
Re: Popup-Window wie Code Complete
12. Sep 2007, 23:44
Delphi-Quellcode:
type
TDemoForm = class(TForm)
Memo: TMemo;
XPManifest: TXPManifest;
ListBox: TListBox;
procedure MemoKeyPress(Sender: TObject; var Key: Char);
procedure ListBoxKeyPress(Sender: TObject; var Key: Char);
procedure MemoEnter(Sender: TObject);
procedure ListBoxDblClick(Sender: TObject);
private
procedure MemoCatch;
end;
var
DemoForm: TDemoForm;
implementation
{$R *.dfm}
procedure TDemoForm.MemoCatch;
begin
with ListBox do
Memo.SelText := Items[ItemIndex];
Memo.SetFocus;
end;
procedure TDemoForm.MemoKeyPress(Sender: TObject; var Key: Char);
var
pt: TPoint;
begin
if Key <> '.' then
Exit;
GetCaretPos(pt);
with ListBox do
begin
Left := pt.X + 6;
Top := pt.Y - Memo.Font.Height * 6 div 5;
ItemIndex := 0;
Visible := true;
SetFocus;
end;
end;
procedure TDemoForm.ListBoxKeyPress(Sender: TObject; var Key: Char);
begin
case Key of
Chr(VK_RETURN):
MemoCatch;
Chr(VK_ESCAPE):
Memo.SetFocus;
end;
end;
procedure TDemoForm.MemoEnter(Sender: TObject);
begin
Listbox.Visible := false;
end;
procedure TDemoForm.ListBoxDblClick(Sender: TObject);
begin
MemoCatch;
end;
Um etwas Neues zu schaffen muss man seine Ohren vor den Nein-sagern verschliessen um seinen Geist öffnen zu können.
(George Lukas)
|