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...
ForlanoVega ArrayCtrl console app... [message #2653] Thu, 20 April 2006 07:42 Go to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
It is not optimal but just an idea and to help Luigi with callbacks... (if you got one under the same name I suggest the old one to backup and use this one instead)

Re: ForlanoVega ArrayCtrl console app... [message #2678 is a reply to message #2653] Thu, 20 April 2006 20:55 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1189
Registered: March 2006
Location: Italy
Senior Contributor
fudadmin wrote on Thu, 20 April 2006 07:42

It is not optimal but just an idea and to help Luigi with callbacks... (if you got one under the same name I suggest the old one to backup and use this one instead)



Aris,

thank you very much for your patience and effort.
I'm studying the code. It is simply excellent for studying how this damned callback among widgets work. From what I saw so far perhaps I'm near (I hope) to catch their logic.
It seems very important where you define them, I mean in which doll of the matrioska they are defined. For example you can run the same method (AddPlayer) in two different places:
1.  tab1.btnAdd.WhenAction = THISBACK2(AddPlayerAndUpdateInfo, "btnAdd", "Add Player"); 
// then in turn run: tab1.AddPlayer();

2.  btnAdd <<= THISBACK(AddPlayer);

Both run AddPlayer() but in the first way you remain in some way out of the class tab1. In the second way you are inside class tab1 and cannot see what there is outside.
Is it correct?
Luigi
Re: ForlanoVega ArrayCtrl console app... [message #2679 is a reply to message #2678] Thu, 20 April 2006 21:40 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
forlano wrote on Thu, 20 April 2006 19:55

fudadmin wrote on Thu, 20 April 2006 07:42

It is not optimal but just an idea and to help Luigi with callbacks... (if you got one under the same name I suggest the old one to backup and use this one instead)



Aris,

thank you very much for your patience and effort.
I'm studying the code. It is simply excellent for studying how this damned callback among widgets work. From what I saw so far perhaps I'm near (I hope) to catch their logic.
It seems very important where you define them, I mean in which doll of the matrioska they are defined. For example you can run the same method (AddPlayer) in two different places:
1.  tab1.btnAdd.WhenAction = THISBACK2(AddPlayerAndUpdateInfo, "btnAdd", "Add Player"); 
// then in turn run: tab1.AddPlayer();

2.  btnAdd <<= THISBACK(AddPlayer);

Both run AddPlayer() but in the first way you remain in some way out of the class tab1. In the second way you are inside class tab1 and cannot see what there is outside.
Is it correct?
Luigi


Exactly! I'm happy that my example helps you! It's better than "debugging" with Prompts, isn't it? Smile
Re: ForlanoVega ArrayCtrl console app... [message #2683 is a reply to message #2679] Thu, 20 April 2006 23:32 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1189
Registered: March 2006
Location: Italy
Senior Contributor
fudadmin wrote on Thu, 20 April 2006 21:40


Exactly! I'm happy that my example helps you! It's better than "debugging" with Prompts, isn't it? Smile

Of course I agree!
Your console is very cool. I will adapt it for a super status bar. Now I've added my warning in corrispondence of the click of the optionimage
void VegaMain::UpdateFocusAndInfo(const String& _who, const String& _what)
{   String s, player;
	int m;
	
//	tab1.arr.ChildGotFocus();   //lets move the focus after calculations...
	UpdateInfo(_who, _what);
	
	m = tab1.arr.GetCursor();	
    player = tab1.arr.Get( m, "Name");
	s=AsString( tab1.arr.Get( m, "Avail") );		
    if (s=="1") PromptOK("Player " + player + " is now available");	
    else if (s=="0") PromptOK("Player " + player + " is NOT available");	
    else PromptOK("You have assigned a BYE to player " + player);	
}

It recognises the state of the button and catch the name of the player for a clear warning. As you see I've commented the ChildGotFocus to do an experiemnt. I didn't see any difference with the non commented row. So the question is: why we need it?
Luigi
Re: ForlanoVega ArrayCtrl console app... [message #2684 is a reply to message #2683] Thu, 20 April 2006 23:50 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
forlano wrote on Thu, 20 April 2006 22:32


...
Your console is very cool. I will adapt it for a super status bar.
...
Luigi



Why still Prompts? Shocked I expected you've already done by this time? Smile
Yes, I created it with a super status bar in mind (and saving track of changes) and even made some space for controlling it. Now everything depends on imagination...

Re: ForlanoVega ArrayCtrl console app... [message #2685 is a reply to message #2683] Fri, 21 April 2006 00:12 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
forlano wrote on Thu, 20 April 2006 22:32

As you see I've commented the ChildGotFocus to do an experiement. I didn't see any difference with the non commented row. So the question is: why we need it?
Luigi



Very good! That mean's, we don't need it anymore. Smile I was rushing in the early morning hours and forgotten to test without it.
Re: ForlanoVega ArrayCtrl console app... [message #2690 is a reply to message #2685] Fri, 21 April 2006 02:32 Go to previous messageGo to next 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

Re: ForlanoVega ArrayCtrl console app... [message #2693 is a reply to message #2690] Fri, 21 April 2006 10:23 Go to previous message
forlano is currently offline  forlano
Messages: 1189
Registered: March 2006
Location: Italy
Senior Contributor
fudadmin wrote on Fri, 21 April 2006 02:32

Luigi, I would strongly suggest to run this as soon as possible Smile



It's very nice and look very professional Cool .
I'll try to freeze what I have learned about callback in a tutorial.
Luigi
Previous Topic: How to use callbacks with "embedded" controls...
Next Topic: Batch processing images using U++ (new Image code)
Goto Forum:
  


Current Time: Sat Jun 15 15:27:37 CEST 2024

Total time taken to generate the page: 0.01691 seconds