|
Last change
on this file was 317, checked in by chronos, 18 months ago |
- Modified: Remove U prefix from unit names.
- Modified: Use TFormEx for all forms for code simplification.
|
|
File size:
892 bytes
|
| Line | |
|---|
| 1 | unit FormChat;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
|---|
| 7 | Game, GameClient, FormEx;
|
|---|
| 8 |
|
|---|
| 9 | type
|
|---|
| 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 |
|
|---|
| 25 | implementation
|
|---|
| 26 |
|
|---|
| 27 | {$R *.lfm}
|
|---|
| 28 |
|
|---|
| 29 | { TFormChat }
|
|---|
| 30 |
|
|---|
| 31 | procedure TFormChat.EditMessageKeyPress(Sender: TObject; var Key: char);
|
|---|
| 32 | begin
|
|---|
| 33 | if Key = #13 then ButtonMessageSend.Click;
|
|---|
| 34 | end;
|
|---|
| 35 |
|
|---|
| 36 | procedure TFormChat.ButtonMessageSendClick(Sender: TObject);
|
|---|
| 37 | begin
|
|---|
| 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;
|
|---|
| 44 | end;
|
|---|
| 45 |
|
|---|
| 46 | end.
|
|---|
| 47 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.