Home » Community » Newbie corner » Vector declaration .h and initialization .cpp
Vector declaration .h and initialization .cpp [message #38154] |
Mon, 03 December 2012 04:01  |
nejnadusho
Messages: 60 Registered: October 2012
|
Member |
|
|
Hi,
I cant understand how to do that.
.h File
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?
Thank you.
Best
Georgi
|
|
|
Goto Forum:
Current Time: Thu May 01 01:34:02 CEST 2025
Total time taken to generate the page: 0.03496 seconds
|