source: trunk/Forms/FormChat.pas

Last change on this file was 317, checked in by chronos, 6 months ago
  • Modified: Remove U prefix from unit names.
  • Modified: Use TFormEx for all forms for code simplification.
File size: 892 bytes
Line 
1unit FormChat;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
7 Game, GameClient, FormEx;
8
9type
10
11 { TFormChat }
12
13 TFormChat = class(TFormEx)
14 ButtonMessageSend: TButton;
15 EditMessage: TEdit;
16 Label1: TLabel;
17 MemoChat: TMemo;
18 procedure ButtonMessageSendClick(Sender: TObject);
19 procedure EditMessageKeyPress(Sender: TObject; var Key: char);
20 public
21 Client: TClient;
22 end;
23
24
25implementation
26
27{$R *.lfm}
28
29{ TFormChat }
30
31procedure TFormChat.EditMessageKeyPress(Sender: TObject; var Key: char);
32begin
33 if Key = #13 then ButtonMessageSend.Click;
34end;
35
36procedure TFormChat.ButtonMessageSendClick(Sender: TObject);
37begin
38 if Assigned(Client) then
39 with Client do begin
40 Protocol.SendMessage(EditMessage.Text);
41 MemoChat.Lines.Add(Client.Name + ': ' + EditMessage.Text);
42 EditMessage.Text := '';
43 end;
44end;
45
46end.
47
Note: See TracBrowser for help on using the repository browser.