Witam,
Tak mnie naszło by użyć TFrame-a ale tworząc szablon... - widząc że się da, od razu buźka była zadowolona. Zamknąłem projekt minęło parę dni, wracam do projektu i tu niespodzianka - otwierając usuwa frame-a z formy i wywala że nie może znaleźć klasy wrrr. Powtórzyłem czynność tworząc nowy projekcik, definiując frame-a jako template-a, kładąc go na formę wszystko pięknie, kompiluje się, zamykam projekt, otwieram i buu klasa nie znaleziona, ramka usunięta. Widzę że jest z tym problem, może ktoś wie jak to rozwiązać
templacik:
template <class T1, class T2>
class TTemplateViewFrame : public TFrame
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TTemplateViewFrame (TComponent* Owner);
virtual void __fastcall Add(T1, T2); //jakas sobie funkcja
};
//---------------------------------------------------------------------------
template <class T1, class T2>
__fastcall TTemplateViewFrame <T1,T2>::TTemplateViewFrame (TComponent* Owner)
: TFrame(Owner)
{
}
//---------------------------------------------------------------------------
template <class T1, class T2>
void __fastcall TTemplateViewFrame <T1,T2>::Add(T1 Key, T2 Item)
{
}
//---------------------------------------------------------------------------
Dziedziczony framik:
typedef TTemplateViewFrame <int, int> TIntIntViewFrame;
//---------------------------------------------------------------------------
class TViewFrame : public TIntIntViewFrame
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TViewFrame(TComponent* Owner);
};
//---------------------------------------------------------------------------
__fastcall TViewFrame::TViewFrame(TComponent* Owner)
: TIntIntViewFrame(Owner)
{
}
//---------------------------------------------------------------------------
Wrzucam TViewFrame na formę, wszytko ok, ładnie się pojawia, kompiluje.
Po ponownym otwarciu Error creating form: 'TIntIntViewFrame' not found i
TViewFrame not found.
Dodam że chcą zrobić bez typedef-a bezpośrednio:
class TViewFrame : public TTemplateViewFrame <int, int>
to otrzymuje error Declaration of class TViewFrame is missing or incorect (nie da się skompilować)
co sądzicie o tym?
PS Środowisko Borland C++ Builder 6.0