class Menu{
public:
typedef Menu CLASSNAME;
Menu();
~Menu();
void WidgetFactory( One<Ctrl>& x);
void OnButton(int n);
void ButtonGenerator(int tableCount);
ArrayCtrl menuArray;
void GetMenu();
private:
int buttonCounter;
Vector<String> menuVec;
};
.cpp File
Menu::Menu()
{
buttonCounter = 0;
menuArray.AddColumn().Ctrls(THISBACK(WidgetFactory));
menuArray.AddColumn().Ctrls(THISBACK(WidgetFactory));
menuArray.AddColumn().Ctrls(THISBACK(WidgetFactory));
menuArray.AddColumn().Ctrls(THISBACK(WidgetFactory));
ButtonGenerator(20/4);
menuArray.SetLineCy(50);
}
void Menu::ButtonGenerator(int tableCount){
for (int i = 1; i <= tableCount; ++i){
menuArray.Add();
}
}
void Menu::OnButton(int n)
{
PromptOK(AsString(n));
}
void Menu::WidgetFactory(One<Ctrl>& x)
{
Button& b = x.Create<Button>();
b.SetLabel("Table " + AsString(++buttonCounter));
b.SizePos();
b <<= THISBACK1(OnButton, buttonCounter);
}
Menu::~Menu(){
menuArray.Clear();
}
Menu::GetMenu(){
for(int i = 0; i < 21; ++i){{
menuVec.???????
}
}
Why am I not able to access the vector here at the .cpp file?
What am I missing here?
And why would I be able to access it in the constructor in the. cpp file?
dolik.rce Messages: 1791 Registered: August 2008 Location: Czech Republic
Ultimate Contributor
Hi Georgi,
Dumb question: Did you #include the header file in the .cpp one? Also, are the definition and declaration in same namespace? And what exactly you mean by no access, can you post the compiler messages?