📄 templetexpredit.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "TempletExprEdit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DateEdit"
#pragma link "fpanel"
#pragma link "ListBaseForm"
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmTempletExprEdit *frmTempletExprEdit;
//---------------------------------------------------------------------------
__fastcall TfrmTempletExprEdit::TfrmTempletExprEdit(TComponent* Owner)
: TListBaseForm(Owner,euSdView,"")
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::InitEditControl()
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::ClearControl()
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::GetDataFromComObject(int Section)
{
if (Section==1)
{
}
else
{
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SendDataToComObject(int Section)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::WaitUserInput(int Section)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::RefreshGridData(int mAction)
{
FieldNameListBox->Items->Add(GetDetailValue(fiVFieldDesc));
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::DisplayBill()
{
GetDataFromComObject(1);
FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::GetBill(AnsiString BillID)
{
comServer->FilterString=WideString("ViewName='"+BillID+"'");
comServer->Query();
if (comServer->RecordCount!=0) //Found it
{
DisplayBill();
}
else
ShowMessageWindow("在数据库中没有查到记录:"+BillID+",请查证",mwsInformation);
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::FillGridWithData()
{
int i,j;
FieldNameListBox->Clear();
for (i=0;i<comServer->ItemCount;i++)
{
comServer->LocateItemByIndex(i);
RefreshGridData(0);
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmTempletExprEdit::GetHeadValue(int Index)
{
WideString S;
S = ReadFieldValue(comServer,Index);
return S;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TfrmTempletExprEdit::GetDetailValue(int Index)
{
WideString S;
S = ReadItemValue(comServer,Index);
return S;
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SetHeadValue(int Index,AnsiString Value)
{
WriteFieldValue(comServer,Index,WideString(Value));
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SetDetailValue(int Index,AnsiString Value)
{
WriteItemValue(comServer,Index,WideString(Value));
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::FormShow(TObject *Sender)
{
ClearControl();
GetBill(BillNumID);
RichExpr->Text=TempletdExpr;
RichExpr->ClearUndo();
RichExpr->Modified=false;
ChangeToBrowseState(true);
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::ChangeToBrowseState(bool Browse)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::FormClose(TObject *Sender,
TCloseAction &Action)
{
TempletdExpr=RichExpr->Text;
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SetTempletdExpr(AnsiString value)
{
if(FTempletdExpr != value) {
FTempletdExpr = value;
}
}
AnsiString __fastcall TfrmTempletExprEdit::GetTempletdExpr()
{
return FTempletdExpr;
}
void __fastcall TfrmTempletExprEdit::BtnInsertClick(TObject *Sender)
{
comServer->LocateItemByIndex(FieldNameListBox->ItemIndex);
RichExpr->SelText=GetDetailValue(fiVFieldName);
RichExpr->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::FieldNameListBoxDblClick(
TObject *Sender)
{
BtnInsertClick(Sender);
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton15Click(TObject *Sender)
{
RichExpr->SelText="SUM()";
RichExpr->SelStart--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton16Click(TObject *Sender)
{
RichExpr->SelText="AVG()";
RichExpr->SelStart--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton17Click(TObject *Sender)
{
RichExpr->SelText="COUNT()";
RichExpr->SelStart--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton3Click(TObject *Sender)
{
RichExpr->SelText="+";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton4Click(TObject *Sender)
{
RichExpr->SelText="-";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton5Click(TObject *Sender)
{
RichExpr->SelText="*";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton6Click(TObject *Sender)
{
RichExpr->SelText="/";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton7Click(TObject *Sender)
{
RichExpr->SelText="=";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton8Click(TObject *Sender)
{
RichExpr->SelText="1";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton9Click(TObject *Sender)
{
RichExpr->SelText="2";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton1Click(TObject *Sender)
{
RichExpr->SelText="3";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton2Click(TObject *Sender)
{
RichExpr->SelText="4";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton10Click(TObject *Sender)
{
RichExpr->SelText="5";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton18Click(TObject *Sender)
{
RichExpr->SelText="6";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton11Click(TObject *Sender)
{
RichExpr->SelText="7";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton12Click(TObject *Sender)
{
RichExpr->SelText="8";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton13Click(TObject *Sender)
{
RichExpr->SelText="9";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton14Click(TObject *Sender)
{
RichExpr->SelText="0";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton19Click(TObject *Sender)
{
RichExpr->SelText=",";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton20Click(TObject *Sender)
{
RichExpr->SelText="''";
RichExpr->SelStart--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton21Click(TObject *Sender)
{
RichExpr->SelText="%";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton22Click(TObject *Sender)
{
RichExpr->SelText="MAX()";
RichExpr->SelStart--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton23Click(TObject *Sender)
{
RichExpr->SelText="MIN()";
RichExpr->SelStart--;
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton24Click(TObject *Sender)
{
RichExpr->SelText="<";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton25Click(TObject *Sender)
{
RichExpr->SelText=">";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::SpeedButton26Click(TObject *Sender)
{
RichExpr->SelText="LIKE ";
}
//---------------------------------------------------------------------------
void __fastcall TfrmTempletExprEdit::FormCloseQuery(TObject *Sender,
bool &CanClose)
{
if(RichExpr->Modified && this->ModalResult==mrCancel)
{
if(ShowMessageWindow("您确定取消修改码?",mwsConfirmation)==IDYES)
CanClose=true;
else
CanClose=false;
}
else
CanClose=true;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -