-
Notifications
You must be signed in to change notification settings - Fork 5
/
unit3.pas
85 lines (67 loc) · 2.42 KB
/
unit3.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
(******************************************************************************)
(* *)
(* Author : Uwe Schächterle (Corpsman) *)
(* *)
(* This file is part of Gorilla *)
(* *)
(* See the file license.md, located under: *)
(* https://github.com/PascalCorpsman/Software_Licenses/blob/main/license.md *)
(* for details about the license. *)
(* *)
(* It is not allowed to change or remove this text from any *)
(* source file of the project. *)
(* *)
(******************************************************************************)
Unit Unit3;
{$MODE objfpc}{$H+}
Interface
Uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
Type
{ TForm3 }
TForm3 = Class(TForm)
Button1: TButton;
Edit1: TEdit;
ListBox1: TListBox;
Procedure Button1Click(Sender: TObject);
Procedure Edit1KeyPress(Sender: TObject; Var Key: char);
Procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
End;
Var
Form3: TForm3;
Procedure ReceiveChatMessage(Message: String);
Implementation
{$R *.lfm}
Uses
unit1,
ugorilla;
{ TForm3 }
Procedure ReceiveChatMessage(Message: String);
Begin
form3.listbox1.Items.add(message);
form3.listbox1.ItemIndex := form3.listbox1.Items.count - 1;
If Not form3.visible Then
form3.show;
End;
Procedure TForm3.FormCreate(Sender: TObject);
Begin
caption := 'Chatroom';
edit1.text := '';
End;
Procedure TForm3.Button1Click(Sender: TObject);
Begin
If length(edit1.text) = 0 Then exit;
Gorilla.SendMessage(opChatMessage, gorilla.chatname + ': ' + edit1.text);
listbox1.Items.add(gorilla.chatname + ': ' + edit1.text);
listbox1.ItemIndex := listbox1.Items.count - 1;
edit1.text := '';
End;
Procedure TForm3.Edit1KeyPress(Sender: TObject; Var Key: char);
Begin
If key = #13 Then Button1.OnClick(Nil);
End;
End.