Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Vector declaration .h and initialization .cpp
Vector declaration .h and initialization .cpp [message #38154] Mon, 03 December 2012 04:01 Go to previous message
nejnadusho is currently offline  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
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: GridCtrl and DropList
Next Topic: Icon size
Goto Forum:
  


Current Time: Sun May 12 18:00:25 CEST 2024

Total time taken to generate the page: 0.02374 seconds