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 » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » ForlanoVega ArrayCtrl console app...
Re: ForlanoVega ArrayCtrl console app... [message #2690 is a reply to message #2685] Fri, 21 April 2006 02:32 Go to previous messageGo to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Luigi, I would strongly suggest to run this as soon as possible Smile :
//replace all below consoleFrame
//====================
void VegaMain::UpdateInfo(const String& _who, const String& _action, const String& _what)
{
	int nTotal = tab1.arr.GetCount();
	int nAvail = tab1.GetAvail();
	String	info = NFormat("Total players: %d - Available: %d ... %s", nTotal, nAvail, _what);
	String time = AsString(GetSysTime());
	consoleFrame.console.Add(time, _who, _action, info);
	consoleFrame.console.ScrollInto(consoleFrame.console.GetCount());
	
}

String VegaMain::InfoCurrentPlayerAndStatus()
{
//	Animate(); //for animated status effects!
	int m = tab1.arr.GetCursor();
	String  player = AsString(tab1.arr.Get( m, "Name"));
	String s;
	Value v = tab1.arr.Get( m, "Avail");
	if (IsNull(v))
		s = " is DOUBTful!";
	else 
		s = v? " is AVAILable!" : " is NOT AVAILable!";
	
	return (" and now "+ player + s);
}

void VegaMain::arrCtrlsAction()
{
	UpdateInfo("optCtrl", "made", InfoCurrentPlayerAndStatus());
}

void VegaMain::btnAddAction()
{
	tab1.AddPlayer();
	UpdateInfo("btnAdd", "added", InfoCurrentPlayerAndStatus());
}


void VegaMain::Init()
{
	UpdateInfo("Luigi", "logged in", "");

	tab1.btnAdd.WhenAction = THISBACK(btnAddAction);
	//need for other layout buttons...
	tab1.arr.WhenCtrlsAction = THISBACK(arrCtrlsAction);	
}
//update declarations!
//try to set even row colors for "status"...
//in main.cpp 	consoleFrame.console.EvenRowColor();


Edit:
Some morals about the callbacks and matrioshkas:
1."Problems cannot be solved at the same level of awareness that created them." A.E. - that means you must change "coordinates of thinking" if you are stuck.
2. The higher in the mountains, the more you can see. That means from application level it's easier to think and manage objects by creating bridges than require them to digg tunnels without compasses to each other.
3. Patience feeds a fisherman... and maybe a chess player, too... Smile

[Updated on: Fri, 21 April 2006 08:50]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to use callbacks with "embedded" controls...
Next Topic: Batch processing images using U++ (new Image code)
Goto Forum:
  


Current Time: Sun May 12 06:38:17 CEST 2024

Total time taken to generate the page: 0.01329 seconds