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! » How to use callbacks with "embedded" controls...
Re: How to use callbacks with "embedded" controls... [message #2535 is a reply to message #2523] Mon, 17 April 2006 02:54 Go to previous messageGo to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
First of all, don't create too long code "sausages", esp. in the wrong places... Laughing

Second, don't spend your hours in the wrong bushes by creating a bicycle. That means, always check if your parents have those wheels... Smile
I'm not very sure but I guess:

Step1.
void VegaMain::Init()
{
	info="Ready";
	
	tab1.arr.WhenEnterRow = THISBACK(UpdateInfo);
	tab1.arr.WhenCtrlsAction = THISBACK(UpdateInfo);
}

Step2. in VegaStatus.cpp add this:
void VegaMain::UpdateInfo()
{
	info = "Wait..Counting...Busy...";
	int nTotal = tab1.arr.GetCount();
	int nAvail = tab1.GetAvail(); //might optimize later...
	info = NFormat("Ready: Total players: %d - Available: %d", nTotal, nAvail);
}

Step3
update VegaMain.h
	void UpdateInfo();

Step4
and also in the same VegaMain.h
class VegaTab1 : public WithVegaTab1Layout<TopWindow> {
public:
	void SortRecord(int column);
	void AddPlayer();
//	void ShowNumberRecord(); you don't need it here...
	int GetAvail();  //new!!!

Step5
in VegaTab1.cpp
int VegaTab1::GetAvail()
{
	int n=0;
	for(int i=0; i<arr.GetCount(); i++) {
		if ( arr.Get(i, "Avail") ) n=n+1;
	}
	return n;
}

Step5
remove your 1 hour wasted time and spoiled callback from Avail3
Step6
make "info" label in the layout at least double width.
Step7
Ctrl_F5.

You can apply this logic with Prompts if you like... Smile
Step8
Report any success or failure...

[Updated on: Mon, 17 April 2006 03:19]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to create a non modal dialog
Next Topic: ForlanoVega ArrayCtrl console app...
Goto Forum:
  


Current Time: Thu May 09 17:05:25 CEST 2024

Total time taken to generate the page: 0.02038 seconds