📄 newnode.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "TBMain.h"
#include "NewNode.h"
#include "SelectJB.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CoolCtrls"
#pragma resource "*.dfm"
TENewNode *ENewNode;
//---------------------------------------------------------------------------
__fastcall TENewNode::TENewNode(TComponent* Owner)
: TForm(Owner)
{
try{
Query1->Active=false;
Query1->SQL->Clear();
Query1->SQL->Add("select * from valid order by valid");
Query1->Active=true;
}
catch (EDatabaseError &e)
{
Application->MessageBox(e.Message.c_str(),"错误",MB_OK | MB_ICONERROR);
return;
}
if(0 < Query1->RecordCount)
{
for(int i=0;i<Query1->RecordCount;i++)
{
ComboBox4->Items->Add(Query1->FieldByName("valid")->AsString.c_str ());
Query1->Next();
}
}
}
void __fastcall TENewNode::FormShow(TObject *Sender)
{
ComboBox1->SetFocus();
IsAdd = false;
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::BitBtn1Click(TObject *Sender)
{
if(ComboBox1->Text =="")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("域序号不能为空!","提示", MB_OK | MB_ICONQUESTION);
ComboBox1->SetFocus();
}
else if(Edit2->Text =="")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("域标题不能为空!","提示", MB_OK | MB_ICONQUESTION);
Edit2->SetFocus();
}
else if(ComboBox2->Text =="")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("域数据类型不能为空!","提示", MB_OK | MB_ICONQUESTION);
ComboBox2->SetFocus();
}
else if(Edit3->Text =="")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("域长度不能为空!","提示", MB_OK | MB_ICONQUESTION);
Edit3->SetFocus();
}
else if(Edit4->Text =="")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("小数位数不能为空!","提示", MB_OK | MB_ICONQUESTION);
Edit4->SetFocus();
}
else if(ComboBox3->Text =="")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("密码标志不能为空!","提示", MB_OK | MB_ICONQUESTION);
ComboBox3->SetFocus();
}
else if(ComboBox5->Text =="")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("输入输出不能为空!","提示", MB_OK | MB_ICONQUESTION);
ComboBox5->SetFocus();
}
else if(Edit1->Text =="")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("JB结构不能为空!","提示", MB_OK | MB_ICONQUESTION);
Edit1->SetFocus();
}
else
{
try{
Query1->Close();
Query1->SQL->Clear();
Query1->SQL->Add("select * from yjg where pmh = '" + MainForm->pmhstr + "' and yxh =" + ComboBox1->Text);
Query1->Active=true;
}
catch (EDatabaseError &e)
{
Application->MessageBox(e.Message.c_str(),"错误",MB_OK | MB_ICONERROR);
return;
}
if (Query1->RecordCount>0 )
{
Application->MessageBox("所添加的域结点的域序号已经存在,请重新添加!","错误",MB_OK | MB_ICONERROR);
ComboBox1->SetFocus();
}
else
{
IsAdd = true;
Close();
}
}
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::BitBtn2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::SpeedButton1Click(TObject *Sender)
{
ENewNode->OpenDialog1->Filter = "Wave files (*.vox)|*.VOX";
ENewNode->OpenDialog1->Execute();
TENewNode::Edit5->Text=ChangeFileExt(ExtractFileName(ENewNode->OpenDialog1->FileName),"");
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::SpeedButton2Click(TObject *Sender)
{
ENewNode->OpenDialog1->Filter = "Wave files (*.vox)|*.VOX";
ENewNode->OpenDialog1->Execute();
TENewNode::Edit6->Text=ChangeFileExt(ExtractFileName(ENewNode->OpenDialog1->FileName),"");
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::SpeedButton3Click(TObject *Sender)
{
TESelectJB * newmenu = new TESelectJB( this );
MainForm->JBFlag=true;
newmenu->Caption = "选择数据编码窗口";
newmenu->ADD->Visible=false;
newmenu->Delete->Visible=false;
newmenu->Modefy->Visible=false;
newmenu->Choose->Visible=false;
newmenu->N1->Visible=false;
MainForm->IsSelect =false;
newmenu->ShowModal();
if(MainForm->IsSelect)
{
TENewNode::Edit1->Text=newmenu->ListView1->Selected->Caption;
}
delete newmenu;
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::Edit3KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
if(!(isdigit(Key)||iscntrl(Key)))
Application->MessageBox("您的输入错误,请输入0-9之间的数!","错误",MB_OK |MB_ICONERROR);
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::ComboBox1KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
if(!(isdigit(Key)||iscntrl(Key)))
Application->MessageBox("您的输入错误,请输入0-9之间的数!", "错误",MB_OK |MB_ICONERROR);
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::Edit4KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
if(!(isdigit(Key)||iscntrl(Key)))
Application->MessageBox("您的输入错误,请输入0-9之间的数!", "错误",MB_OK |MB_ICONERROR);
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::Edit1KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
if(!(isdigit(Key)||iscntrl(Key)))
Application->MessageBox("您的输入错误,请输入0-9之间的数!", "错误",MB_OK |MB_ICONERROR);
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TENewNode::Edit2KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::ComboBox2KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::ComboBox3KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::Edit5KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::ComboBox4KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::Edit6KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TENewNode::ComboBox5KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -