123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <IOUtils.hpp>
- #include "ITSSkinF.h"
- #include "ITSUtilF.h"
- #include "AppGlobalF.h"
- #pragma hdrstop
- #include "FrmVmsFormSelF.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "cxButtons"
- #pragma link "cxCalendar"
- #pragma link "cxContainer"
- #pragma link "cxControls"
- #pragma link "cxDropDownEdit"
- #pragma link "cxEdit"
- #pragma link "cxGraphics"
- #pragma link "cxGroupBox"
- #pragma link "cxLabel"
- #pragma link "cxLookAndFeelPainters"
- #pragma link "cxLookAndFeels"
- #pragma link "cxMaskEdit"
- #pragma link "cxPC"
- #pragma link "cxPCdxBarPopupMenu"
- #pragma link "cxSpinEdit"
- #pragma link "cxSplitter"
- #pragma link "cxTextEdit"
- #pragma link "cxTimeEdit"
- #pragma link "dxSkinBlack"
- #pragma link "dxSkinBlue"
- #pragma link "dxSkinCaramel"
- #pragma link "dxSkinCoffee"
- #pragma link "dxSkinDarkRoom"
- #pragma link "dxSkinDarkSide"
- #pragma link "dxSkinFoggy"
- #pragma link "dxSkinGlassOceans"
- #pragma link "dxSkiniMaginary"
- #pragma link "dxSkinLilian"
- #pragma link "dxSkinLiquidSky"
- #pragma link "dxSkinLondonLiquidSky"
- #pragma link "dxSkinMcSkin"
- #pragma link "dxSkinMoneyTwins"
- #pragma link "dxSkinOffice2007Black"
- #pragma link "dxSkinOffice2007Blue"
- #pragma link "dxSkinOffice2007Green"
- #pragma link "dxSkinOffice2007Pink"
- #pragma link "dxSkinOffice2007Silver"
- #pragma link "dxSkinOffice2010Black"
- #pragma link "dxSkinOffice2010Blue"
- #pragma link "dxSkinOffice2010Silver"
- #pragma link "dxSkinsCore"
- #pragma link "dxSkinscxPCPainter"
- #pragma link "dxSkinSeven"
- #pragma link "dxSkinSharp"
- #pragma link "dxSkinSilver"
- #pragma link "dxSkinStardust"
- #pragma link "cxRadioGroup"
- #pragma link "cxClasses"
- #pragma link "cxCustomData"
- #pragma link "cxData"
- #pragma link "cxDataStorage"
- #pragma link "cxDBData"
- #pragma link "cxFilter"
- #pragma link "cxGrid"
- #pragma link "cxGridCustomTableView"
- #pragma link "cxGridCustomView"
- #pragma link "cxGridDBTableView"
- #pragma link "cxGridLevel"
- #pragma link "cxGridTableView"
- #pragma link "cxStyles"
- #pragma link "cxCheckBox"
- #pragma link "cxImage"
- #pragma link "cxButtonEdit"
- #pragma link "cxBlobEdit"
- #pragma resource "*.dfm"
- TFrmVmsFormSel *FrmVmsFormSel = NULL;
- //---------------------------------------------------------------------------
- __fastcall TFrmVmsFormSel::TFrmVmsFormSel(TComponent* Owner)
- : TForm(Owner)
- {
- ITSSkin_Load(this);
- //CMM_LoadForm(g_sFormsDir, this);
- FUpdate= false;
- FTitle = Caption;//"VMS 객체이미지 선택";
- FListSymb = new TList;
- EditMode = false;
- m_bSelected = false;
- EdVmsFormId->Clear();
- TvList->OptionsView->DataRowHeight = 0;
- TvList->OptionsView->CellAutoHeight = true;
- TvList->OptionsView->Indicator = true;
- TvList->OptionsCustomize->ColumnMoving = false;
- TvList->OptionsCustomize->ColumnSorting = false;
- //TvList->Columns[0]->Width = 50;
- //TvList->Columns[0]->Options->HorzSizing = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::CommClose()
- {
- try
- {
- ClearSymbloList();
- SAFE_DELETE(FListSymb);
- //CMM_SaveForm(g_sFormsDir, this);
- }
- catch(...)
- {
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::FormShow(TObject *Sender)
- {
- Refresh();
- FormInit();
- TmrShow->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::FormInit()
- {
- EdVmsFormId->Clear();
- ImgPreView->Picture->Bitmap->FreeImage();
- ImgPreView->Picture->Bitmap = NULL;
- FNewDb = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::TmrShowTimer(TObject *Sender)
- {
- TmrShow->Enabled = false;
- LoadVmsForm();
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::BtnCloseClick(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::FormClose(TObject *Sender, TCloseAction &Action)
- {
- CommClose();
- FrmVmsFormSel = NULL;
- Action = caFree;
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::FormCloseQuery(TObject *Sender, bool &CanClose)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::DisplayInfo()
- {
- FormInit();
- int nRow = TvList->DataController->FocusedRecordIndex;
- if( nRow <= -1 )
- return;
- TcxGridDataController *pDc = TvList->DataController;
- nRow = pDc->FocusedRecordIndex;
- EdVmsFormId->Text = VarToStr(pDc->Values[nRow][ColPictId->Index]);
- EdVmsFormNm->Text = VarToStr(pDc->Values[nRow][ColPictNm->Index]);
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::ClearSymbloList()
- {
- for(int ii = 0; ii < FListSymb->Count; ii++)
- {
- Graphics::TBitmap *bitmap = (Graphics::TBitmap *)FListSymb->Items[ii];
- delete bitmap;
- }
- FListSymb->Clear();
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::LoadVmsForm()
- {
- FormInit();
- CMM_ClearGridTableView(TvList);
- ClearSymbloList();
- String sQry;
- TADOQuery *pADO = NULL;
- sQry = "SELECT T.VMS_FORM_ID, \r\n"
- " T.VMS_MODL_KIND, \r\n"
- " T.VMS_FORM_TYPE, \r\n"
- " T.VMS_FORM_NM, \r\n"
- " T.VMS_FORM_IMG \r\n"
- " FROM TB_VMS_FORM T \r\n"
- " WHERE 1=1 \r\n"
- " AND T.VMS_MODL_KIND = :p01 \r\n"
- " AND T.VMS_FORM_TYPE = :p02 \r\n"
- " ORDER BY T.VMS_FORM_ID \r\n";
- int nRowHeight = 0;
- try
- {
- int nRow;
- TcxDataController *pGDC = TvList->DataController;
- TvList->BeginUpdate();
- try
- {
- pADO = new TADOQuery(NULL);
- pADO->Close();
- pADO->Connection = ITSDb_GetConnection();
- ITSDb_SQLText(pADO, sQry);
- ITSDb_SQLBind(pADO, "p01", FVmsModlKind);
- ITSDb_SQLBind(pADO, "p02", FVmsMsgType);
- ITSDb_SQLOpen(pADO);
- for( ; !pADO->Eof; pADO->Next()) {
- nRow = pGDC->AppendRecord();
- String VMS_FORM_ID = pADO->FieldByName("VMS_FORM_ID")->AsString;
- pGDC->Values[nRow][ColPictId->Index] = VMS_FORM_ID;
- pGDC->Values[nRow][ColPictNm->Index] = pADO->FieldByName("VMS_FORM_NM")->AsString;
- pGDC->Values[nRow][ColData->Index] = pADO->FieldByName("VMS_FORM_IMG")->AsVariant;
- }
- }
- catch(EDatabaseError &E)
- {
- DBERRORMSG("TFrmVmsFormSel::LoadVmsForm", String(E.ClassName()), E.Message, sQry);
- throw Exception(String(E.ClassName()) + E.Message);
- }
- catch(Exception &e)
- {
- DBERRORMSG("TFrmVmsFormSel::LoadVmsForm", String(e.ClassName()), e.Message, sQry);
- throw Exception(String(e.ClassName()) + e.Message);
- }
- }
- __finally
- {
- if (pADO)
- {
- pADO->Close();
- delete pADO;
- }
- //TvList->OptionsView->DataRowHeight = nRowHeight;
- TvList->EndUpdate();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
- TMouseButton AButton, TShiftState AShift,
- bool &AHandled)
- {
- if (!ACellViewInfo) return;
- DisplayInfo();
- Sleep(200);
- BtnSelImageClick((TObject*)BtnSelImage);
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::TvListFocusedRecordChanged(TcxCustomGridTableView *Sender,
- TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord,
- bool ANewItemRecordFocusingChanged)
- {
- if (!AFocusedRecord) return;
- DisplayInfo();
- }
- //---------------------------------------------------------------------------
- void __fastcall TFrmVmsFormSel::BtnSelImageClick(TObject *Sender)
- {
- if (EdVmsFormId->Text == "")
- {
- Application->MessageBox(L"VMS 메시지 폼 선택\r\nVMS 메시지 폼을 목록에서 선택하세요.",
- FTitle.c_str(),
- MB_OK|MB_ICONERROR|MB_APPLMODAL);
- return;
- }
- m_bSelected = true;
- Close();
- }
- //---------------------------------------------------------------------------
|