source: trunk/Details.pas

Last change on this file was 6, checked in by george, 16 years ago
  • Přesunuto: Hlavní vývojová větev přesunuta do podsložky trunk.
File size: 2.5 KB
Line 
1unit Details;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, ExtCtrls, ComCtrls, ShellApi, RichEdit;
8
9type
10 TForm7 = class(TForm)
11 Label1: TLabel;
12 Label2: TLabel;
13 Image1: TImage;
14 Timer1: TTimer;
15 Label3: TLabel;
16 Label4: TLabel;
17 Label5: TLabel;
18 RichEdit1: TRichEdit;
19 procedure FormShow(Sender: TObject);
20 procedure Timer1Timer(Sender: TObject);
21 procedure FormCreate(Sender: TObject);
22 private
23 { Private declarations }
24 public
25 { Public declarations }
26 protected
27 procedure WndProc(var Msg: TMessage); override;
28 end;
29
30var
31 Form7: TForm7;
32
33 DetailsServerIndex: integer;
34
35implementation
36
37uses Main;
38
39{$R *.dfm}
40
41procedure TForm7.FormShow(Sender: TObject);
42var
43 BitMap: TBitmap;
44begin
45 Label1.Caption := Form1.Servers[DetailsServerIndex].Name;
46 Label2.Caption := 'Addresa: '+Form1.Servers[DetailsServerIndex].Address;
47 if Form1.Servers[DetailsServerIndex].Image <> '' then begin
48 if Form1.Servers[DetailsServerIndex].Image = '1' then begin
49 BitMap := TBitmap.Create;
50 Form1.ImageList32default.GetBitmap(1,BitMap);
51 Image1.Picture.Graphic := BitMap;
52 end else begin
53 if FileExists(Form1.Servers[DetailsServerIndex].Image) then begin
54 Image1.Picture.LoadFromFile(Form1.Servers[DetailsServerIndex].Image);
55 end;
56 end;
57 end else begin
58 BitMap := TBitmap.Create;
59 Form1.ImageList32default.GetBitmap(0,BitMap);
60 Image1.Picture.Graphic := BitMap;
61 end;
62 RichEdit1.Text := Form1.Servers[DetailsServerIndex].Description;
63 Timer1.Enabled := true;
64end;
65
66procedure TForm7.Timer1Timer(Sender: TObject);
67begin
68 close;
69 Timer1.Enabled := false;
70end;
71
72procedure TForm7.FormCreate(Sender: TObject);
73begin
74 Form1.InitRichEditURLDetection(RichEdit1);
75end;
76
77procedure TForm7.WndProc(var Msg: TMessage);
78var
79 p: TENLink;
80 sURL: string;
81 CE : TRichEdit;
82begin
83 if (Msg.Msg = WM_NOTIFY) then
84 begin
85 if (PNMHDR(Msg.lParam).code = EN_LINK) then
86 begin
87 p := TENLink(Pointer(TWMNotify(Msg).NMHdr)^);
88 if (p.Msg = WM_LBUTTONDOWN) then
89 begin
90 try
91 CE := TRichEdit(Form7.ActiveControl);
92 SendMessage(CE.Handle, EM_EXSETSEL, 0, Longint(@(p.chrg)));
93 sURL := CE.SelText;
94 ShellExecute(Handle, 'open', PChar(sURL), nil, nil, SW_SHOWNORMAL);
95 except
96 end;
97 end;
98 end;
99 end;
100
101 inherited;
102
103end;
104
105end.
Note: See TracBrowser for help on using the repository browser.