⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sexcrr.cpp

📁 速达开源ERP系统
💻 CPP
字号:

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "SexcRr.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "RecBaseForm"
#pragma link "fpanel"
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "SDGrid"
#pragma resource "*.dfm"
TfrmSexcRr *frmSexcRr;
//---------------------------------------------------------------------------
__fastcall TfrmSexcRr::TfrmSexcRr(TComponent* Owner)
    : TRecBaseForm(Owner,euSdSexcRr,"")
{
 AutoCtl=seSexcRrCode;
}

AnsiString __fastcall TfrmSexcRr::GetFieldValue(int FieldIndex)
{
    WideString S;
    S  = ReadFieldValue(comServer,FieldIndex);
    return(S);
}
//---------------------------------------------------------------------------

void __fastcall TfrmSexcRr::ClearControl(bool BringToNext)
{
    if(BringToNext)
    {
        return;
    }
    seSexcRrCode->Text       =   "";
    meSexcRrDesc->Text       =   "";
}
//---------------------------------------------------------------------------

void __fastcall TfrmSexcRr::GetDataFromComObject()
{
    seSexcRrCode->Text       =   GetFieldValue(fiSexcRrCode);
    meSexcRrDesc->Text       =   GetFieldValue(fiSexcRrDesc);
    sgSexcRr->LocateGrid(1,seSexcRrCode->Text);    
//    sgSexcRr->LocateGrid(1,seSexcRrCode->Text);    
}
//---------------------------------------------------------------------------

void __fastcall TfrmSexcRr::SendDataToComObject()
{
    WriteFieldValue(comServer,fiSexcRrCode,WideString(seSexcRrCode->Text));   // SexcRrCode
    WriteFieldValue(comServer,fiSexcRrDesc,WideString(meSexcRrDesc->Text));   // SexcRrDesc
}
//---------------------------------------------------------------------------

void __fastcall TfrmSexcRr::WaitUserInput()
{
    if(seSexcRrCode->Enabled)
    seSexcRrCode->SetFocus();
}
//---------------------------------------------------------------------------

AnsiString __fastcall TfrmSexcRr::GetDataToGrid()
{
    AnsiString  s;
    s = "\t" + GetFieldValue(fiSexcRrCode);
    s = s + "\t" + GetFieldValue(fiSexcRrDesc);
    return(s);
}

void __fastcall TfrmSexcRr::RefreshGridData(int mAction)
{
    AnsiString ItemStr;
    ItemStr = GetDataToGrid();
    if (mAction ==  0)   //Add
    {
        sgSexcRr->AddItem(ItemStr);
       sgSexcRr->Row=sgSexcRr->RowCount-1;        
    }
    else if(mAction ==  1)   //Modify
    {
     sgSexcRr->ChangeItem(ItemStr,sgSexcRr->Row);
      }
    else if(mAction ==  2)      //Delete
    {
        sgSexcRr->RemoveItem(sgSexcRr->Row);
    }
}

//---------------------------------------------------------------------------
void __fastcall TfrmSexcRr::FillGridWithData()
{
    AnsiString ItemStr;
    comServer->MoveFirst();
    sgSexcRr->RowCount    =   1;

    while (comServer->Eof   ==  0)
    {
        ItemStr =  GetDataToGrid();
        sgSexcRr->AddItem(ItemStr);
        comServer->MoveNext();
    }
}

//---------------------------------------------------------------------------
void __fastcall TfrmSexcRr::InitEditControl()
{
    ClientGroup->AddComponent(2,true,true,false, sgSexcRr,sgSexcRr->Name);
    ClientGroup->AddComponent(2,false,false,true, FloatPanel1,FloatPanel1->Name);
}

//---------------------------------------------------------------------------
void __fastcall TfrmSexcRr::FormClose(TObject *Sender, TCloseAction &Action)
{
    TRecBaseForm::FormClose(Sender,Action);
    //AnsiString FormIniFile = "D:\Test.Ini";
    //WriteGridWidth(Name,sgSexcRr,FormIniFile);

}
//---------------------------------------------------------------------------
void __fastcall TfrmSexcRr::FormShow(TObject *Sender)
{
    FillGridWithData();
    comServer->MoveFirst();
    GetDataFromComObject();
}
//---------------------------------------------------------------------------

void __fastcall TfrmSexcRr::sgSexcRrClick(TObject *Sender)
{
    if (sgSexcRr->Row > 0)
         comServer->LocateByKey(WideString(sgSexcRr->TextMatrix[sgSexcRr->Row][1]));
    if (!comServer->Eof)
         GetDataFromComObject();

}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -