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
174 lines
4.5 KiB
Plaintext
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, my_sys_chat;
|
|
|
|
{$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('·¢²¼').AsBoolean then
|
|
ChartMan:=ChartMan+1 ;
|
|
frm_main.t_chat_man.next ;
|
|
end ;
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
begin
|
|
if ChartMan<=0 then
|
|
begin
|
|
showmessage('ÄãÑ¡ÔñÁË˽ÁÄ£¬ÇëÑ¡ÔñÏàÓ¦µÄÁÄÌì¶ÔÏ󣡣¡');
|
|
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('·¢²¼').asBoolean then
|
|
begin
|
|
SendMsg_pri(frm_main.t_chat_man.fieldbyname('ËùÔÚµçÄÔ').asstring,trim(Memo1.text));
|
|
empmsg:=empmsg+' '+'['+frm_main.t_chat_man.fieldbyname('ÔÚÏßÖ°Ô±').asstring+']' ;
|
|
end;
|
|
frm_main.t_chat_man.next;
|
|
end;
|
|
ChatMsgRichEdit.lines.add('Äú¶Ô'+empmsg+'˵£º('
|
|
+datetimetostr(now)+')'+trim(Memo1.text));
|
|
end
|
|
else
|
|
begin
|
|
SendMsg_all(trim(Memo1.text));
|
|
ChatMsgRichEdit.lines.add('Äú¶ÔËùÓÐÈË˵£º('+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('·¢²¼').asboolean=true then
|
|
begin
|
|
frm_main.t_chat_man.Edit ;
|
|
frm_main.t_chat_man.FieldByName('·¢²¼').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.
|