//--------------------------------------------------------------------------- #include #pragma hdrstop #include "mdul_Frm.h" #include "MainForm.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TInsertModule_Frm *InsertModule_Frm; //--------------------------------------------------------------------------- __fastcall TInsertModule_Frm::TInsertModule_Frm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TInsertModule_Frm::FormShow(TObject *Sender) { int nRet; LEADDicom1 = MainFrm->LEADDicom1; LEADDicom1->GetInfoDS(); LEADDicom1->FindClassIOD(LEADDicom1->InfoClass); nRet = LEADDicom1->MoveChildIOD(); while(nRet == SUCCESS) { if(LEADDicom1->CurrentIOD->nType == DICOM_IOD_TYPE_MODULE) ComboBox_Module->Items->AddObject(LEADDicom1->CurrentIOD->Name, (TObject *)(LEADDicom1->CurrentIOD->Code)); nRet = LEADDicom1->MoveNextIOD(true); } ComboBox_Module->ItemIndex = 0; } void __fastcall TInsertModule_Frm::OKBtnClick(TObject *Sender) { TTreeNode *NodeX; Cardinal uModule, y; int nRet, x, uCount; uModule = Cardinal(ComboBox_Module->Items->Objects[ComboBox_Module->ItemIndex]); NodeX = MainFrm->TreeView1->Items->Item[0]; uCount = MainFrm->GetTreeModuleCount(); for(x=0; xData) == uModule) { ShowMessage("Already Exists!"); ModalResult = mrNone; return; } NodeX = NodeX->getNextSibling(); } nRet = LEADDicom1->InsertModule(uModule, true); if(nRet != SUCCESS) ShowMessage("Error Inserting Module!"); else { /* Add the module to the TreeView and also insert its sub-tree */ LEADDicom1->FindModuleIOD(LEADDicom1->InfoClass, uModule); NodeX = MainFrm->TreeView1->Items->AddChild(0, LEADDicom1->CurrentIOD->Name); NodeX->ImageIndex = IMAGE_FOLDER_CLOSED; NodeX->SelectedIndex = IMAGE_FOLDER_CLOSED; NodeX->Data = Pointer(LEADDicom1->CurrentModule->Module); /* insert each element */ for(y=0; yCurrentModule->ElementCount; ++y) { LEADDicom1->SetCurrentElement(LEADDicom1->CurrentModule->Element[y]->hElement); MainFrm->FillSubTreeHighLevel(NodeX, false); } } }