-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcolors.pas
82 lines (71 loc) · 2.19 KB
/
colors.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
unit colors;
interface
uses
SysUtils, Classes, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Types;
type
TfrmColors = class(TForm)
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
StaticText4: TStaticText;
StaticText5: TStaticText;
StaticText6: TStaticText;
StaticText7: TStaticText;
StaticText8: TStaticText;
StaticText9: TStaticText;
StaticText10: TStaticText;
StaticText11: TStaticText;
StaticText12: TStaticText;
StaticText13: TStaticText;
StaticText14: TStaticText;
StaticText15: TStaticText;
StaticText16: TStaticText;
procedure InsertColors(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmColors: TfrmColors;
implementation
uses ChatPage, Core;
{$R *.dfm}
procedure TfrmColors.InsertColors(Sender: TObject);
var
ColorText, ColorStr :String;
iSelStart :Integer;
begin
if not Assigned(PagesManager) then Exit;
with (Core.PagesManager.GetActivePage.Frame as TChatFrame) do
begin
//EditInsertSymbol(IntToStr(TStaticText(Sender).Tag);
ColorText := TxtToSend.text;
iSelStart := TxtToSend.SelStart;
ColorStr:='0'+IntToStr(TStaticText(Sender).Tag);
if Length(ColorStr)>2 then ColorStr := IntToStr(TStaticText(Sender).Tag);
Insert(ColorStr, ColorText, iSelStart+1);
TxtToSend.text := ColorText;
Close;
TxtToSend.SelStart := iSelStart + Length(ColorStr);
end;
end;
procedure TfrmColors.FormShow(Sender: TObject);
var
ChatFrame: TChatFrame;
CaretPos: TPoint;
begin
if not Assigned(PagesManager) then Exit;
if not (Core.PagesManager.GetActivePage.Frame is TChatFrame) then Exit;
ChatFrame:=(Core.PagesManager.GetActivePage.Frame as TChatFrame);
//ChatFrame.TxtToSend.GetCaretPos(Cpos);
CaretPos:=ChatFrame.TxtToSend.CaretPos;
self.Left := Core.MainForm.Left + ChatFrame.TxtToSend.Left + CaretPos.X;
self.Top := Core.MainForm.Top + ChatFrame.TxtToSend.Top
+ ChatFrame.MessPanel.Top + CaretPos.Y
+ ChatFrame.TxtToolBar.Height - self.Height;
ChatFrame.EditInsertSymbol(#3);
end;
end.