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

📄 samplemanage.cpp

📁 某公司资料管理系统
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "SampleManage.h"
#include "DataModule.h"
#include "MainHead.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TSampleManageForm *SampleManageForm;
//---------------------------------------------------------------------------
__fastcall TSampleManageForm::TSampleManageForm(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void  TSampleManageForm::UpdateBitBtnState(TObject *Sender)
{
      //BitBtnInsert->Enabled =MastData->ProductSampleSource->State == dsBrowse;
     // BitBtnDelete->Enabled = MastData->ProductSampleSource->State == dsBrowse;
      BitBtnPost->Enabled = MastData->ProductSampleSource->State == dsEdit ||
                            MastData->ProductSampleSource->State == dsInsert;
      BitBtnCancel->Enabled = BitBtnPost->Enabled;
     // BitBtnNext->Enabled=!BitBtnPost->Enabled;
     // BitBtnPrior->Enabled=!BitBtnPost->Enabled;
      BitBtnClose->Enabled=!BitBtnPost->Enabled;
      BitBtnSearch->Enabled=!BitBtnPost->Enabled;
     // MainMenuForm->UpdateMenu();
}
//----------------------------------------------------------------------
void __fastcall  TSampleManageForm::SampleProductStateChange(TObject *Sender)
{
   UpdateBitBtnState(Sender);
}
//---------------------------------------------------------------------------
void __fastcall TSampleManageForm::BitBtnSearchClick(TObject *Sender)
{
    FindProductSampleForm->ShowModal();
    if (FindProductSampleForm->ModalResult == mrOk)
    {
             MastData->ProductSample->CachedUpdates=false;
             MastData->ProductSample->GotoCurrent(MastData->SampleNoLookup);
             MastData->ProductSample->CachedUpdates=true;
    }
}
//---------------------------------------------------------------------------
void __fastcall TSampleManageForm::FormShow(TObject *Sender)
{
    MastData->ProductSampleSource->OnStateChange =SampleProductStateChange;
//after filter
    MastData->ProductSample->Open();
    MastData->ProductSample->Last();
    SampleProductStateChange(Sender);

}
//---------------------------------------------------------------------------
void __fastcall TSampleManageForm::BitBtnCancelClick(TObject *Sender)
{
    MastData->ProductSample->Cancel();
}
//---------------------------------------------------------------------------
void __fastcall TSampleManageForm::BitBtnPostClick(TObject *Sender)
{
     MastData->ProductSample->Post();
}
//---------------------------------------------------------------------------
void __fastcall TSampleManageForm::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    Action=caFree;
}
//---------------------------------------------------------------------------
void __fastcall TSampleManageForm::BitBtnRefreshClick(TObject *Sender)
{
     MastData->ProductSample->Refresh();
}
//---------------------------------------------------------------------------


void __fastcall TSampleManageForm::FormDeactivate(TObject *Sender)
{
    MastData->ProductSampleSource->OnStateChange =NULL;
}
//---------------------------------------------------------------------------

void __fastcall TSampleManageForm::FormActivate(TObject *Sender)
{
     MastData->ProductSampleSource->OnStateChange =SampleProductStateChange;
        
}
//---------------------------------------------------------------------------

void __fastcall TSampleManageForm::FormCloseQuery(TObject *Sender,
      bool &CanClose)
{
  if(BitBtnPost->Enabled)
  {
     if(MessageBox(NULL,"样板生产数据没有存盘,是否保存?", "警告", MB_YESNO) == IDYES)
        MastData->ProductSampleAfterPost(MastData->ProductSample);
     else
        MastData->ProductSampleAfterCancel(MastData->ProductSample);
  }
  CanClose=true;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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