Object Repository or New component


2005-07-22 02:34:38 PM
cppbuilder42
Hi all,
I use frames in the tree nodes. Frames contain different kind of components
(Edit, StringGrid) and I should be able to save information of these frames.
Problem is that only each frame knows how to do that and therefore I should
add method SaveData() to frame component.
I realize that it is possible write a new component that is derived from
TFrame but is it possible to use object repository instead ? I rather would
use Object Repository than writing a new component.
Saving nodes:
....
TTreeNode *TempNodePointer;
String Path;
NodeList->Clear();
if(SaveDialog->Execute())
{
TempNodePointer=TreeView1->Items->GetFirstNode();
while(TempNodePointer)
{
Path=GetNodePath(TempNodePointer);
NodeList->Add(Path);
// TMyFrame is a parent class containing TMyFrame::SaveData(void){/*
does nothing*/}
reinterpret_cast <TMyFrame *>(TempNodePointer->Data)->SaveData();
//Derived class SaveData()-method Adds data to NodeList
TempNodePointer = TempNodePointer->GetNext();
}
NodeList->SaveToFile(SaveDialog->FileName);
}
....
Modified TmyFrame class containing SaveData-method:
class TmyFrame : public TFrame
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TmyFrame(TComponent* Owner);
void __fastcall TmyFrame::SaveData(void);
};
Your suggestions on this would be greatly appreciated.
Thanks,
Pauli