You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
4.5 KiB
Plaintext

11 months ago
unit u_chrat_message;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner,
ComCtrls, StdCtrls, bsSkinCtrls, Menus,DB;
type
Tfrm_chart_message = class(TForm)
dxDBGrid4: TdxDBGrid;
dxDBGrid4Column1: TdxDBGridMaskColumn;
dxDBGrid4Column3: TdxDBGridColumn;
dxDBGrid4Column2: TdxDBGridMaskColumn;
dxDBGrid4Column4: TdxDBGridCheckColumn;
bsSkinPanel1: TbsSkinPanel;
bsSkinPanel3: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinPanel2: TbsSkinPanel;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
Memo1: TMemo;
ChatMsgRichEdit: TRichEdit;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
SaveDialog: TSaveDialog;
procedure dxDBGrid4Exit(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure ChatMsgRichEditKeyPress(Sender: TObject; var Key: Char);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure N5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_chart_message: Tfrm_chart_message;
implementation
uses u_main;
{$R *.dfm}
procedure Tfrm_chart_message.dxDBGrid4Exit(Sender: TObject);
begin
if frm_main.t_chat_man.State in [dsedit,dsinsert] then frm_main.t_chat_man.post ;
end;
procedure Tfrm_chart_message.bsSkinButton1Click(Sender: TObject);
var i,ChartMan :integer ;
Mybook :TBookmark ;
empMsg:string ;
begin
if trim(Memo1.text)=''then exit;
empmsg:='' ;
MYbook:=frm_main.t_chat_man.GetBookmark ;
frm_main.t_chat_man.DisableControls ;
frm_main.t_chat_man.First ;
while not frm_main.t_chat_man.Eof do
begin
if frm_main.t_chat_man.FieldByName('<27><><EFBFBD><EFBFBD>').AsBoolean then
ChartMan:=ChartMan+1 ;
frm_main.t_chat_man.next ;
end ;
if bsSkinCheckRadioBox1.Checked then
begin
if ChartMan<=0 then
begin
showmessage('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>˽<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣡣<EFBFBD>');
frm_main.t_chat_man.GotoBookmark(myBook);
frm_main.t_chat_man.FreeBookmark(MyBook);
frm_main.t_chat_man.EnableControls ;
exit;
end;
frm_main.t_chat_man.First ;
while not frm_main.t_chat_man.eof do
begin
if frm_main.t_chat_man.fieldbyname('<27><><EFBFBD><EFBFBD>').asBoolean then
begin
// SendMsg_pri(frm_main.t_chat_man.fieldbyname('<27><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>').asstring,trim(Memo1.text));
empmsg:=empmsg+' '+'['+frm_main.t_chat_man.fieldbyname('<27><><EFBFBD><EFBFBD>ְԱ').asstring+']' ;
end;
frm_main.t_chat_man.next;
end;
ChatMsgRichEdit.lines.add('<27><><EFBFBD><EFBFBD>'+empmsg+'˵<><CBB5>('
+datetimetostr(now)+')'+trim(Memo1.text));
end
else
begin
// SendMsg_all(trim(Memo1.text));
ChatMsgRichEdit.lines.add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>('+datetimetostr(now)+')'+trim(Memo1.text));
end;
frm_main.t_chat_man.GotoBookmark(myBook);
frm_main.t_chat_man.FreeBookmark(MyBook);
frm_main.t_chat_man.EnableControls ;
Memo1.text:='';
end;
procedure Tfrm_chart_message.ChatMsgRichEditKeyPress(Sender: TObject;
var Key: Char);
begin
if key=#13 then
begin
key:=#0;
bsSkinButton1Click(Sender);
end;
end;
procedure Tfrm_chart_message.N1Click(Sender: TObject);
var mybook:tbookmark ;
begin
mybook:=frm_main.t_chat_man.GetBookmark ;
frm_main.t_chat_man.DisableControls ;
frm_main.t_chat_man.First ;
while not frm_main.t_chat_man.Eof do
begin
if frm_main.t_chat_man.FieldByName('<27><><EFBFBD><EFBFBD>').asboolean=true then
begin
frm_main.t_chat_man.Edit ;
frm_main.t_chat_man.FieldByName('<27><><EFBFBD><EFBFBD>').asboolean:=false ;
frm_main.t_chat_man.Post ;
end ;
frm_main.t_chat_man.Next ;
end ;
frm_main.t_chat_man.GotoBookmark(mybook);
frm_main.t_chat_man.FreeBookmark(mybook);
frm_main.t_chat_man.EnableControls ;
end;
procedure Tfrm_chart_message.N2Click(Sender: TObject);
begin
ChatMsgRichEdit.Text :='' ;
end;
procedure Tfrm_chart_message.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_chart_message.Hide;
frm_chart_message.ManualFloat(frm_chart_message.BoundsRect );
frm_main.freeTabs('frm_chart_message');
SendLogoutMsg;
action:=cafree;
frm_chart_message:=nil;
end;
procedure Tfrm_chart_message.N5Click(Sender: TObject);
begin
with SaveDialog do
begin
DefaultExt :='txt';
Filter := '(*.txt)|*.txt';
if Execute then
begin
ChatMsgRichEdit.Lines.SaveToFile(filename);
end;
end;
end;
end.