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 |
|
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...
Second, don't spend your hours in the wrong bushes by creating a bicycle. That means, always check if your parents have those wheels...
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
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...
Step8
Report any success or failure...
[Updated on: Mon, 17 April 2006 03:19] Report message to a moderator
|
|
|
|
|
How to use callbacks with "embedded" controls...
By: forlano on Sun, 16 April 2006 18:54
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Mon, 17 April 2006 02:54
|
|
|
Re: How to use callbacks with "embedded" controls...
By: forlano on Mon, 17 April 2006 09:33
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Mon, 17 April 2006 10:03
|
|
|
Re: How to use callbacks with "embedded" controls...
By: forlano on Mon, 17 April 2006 10:19
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Mon, 17 April 2006 11:04
|
|
|
Re: How to use callbacks with "embedded" controls...
By: forlano on Mon, 17 April 2006 11:19
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Mon, 17 April 2006 11:55
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Mon, 17 April 2006 12:15
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Wed, 19 April 2006 06:26
|
|
|
Re: How to use callbacks with "embedded" controls...
By: forlano on Wed, 19 April 2006 09:16
|
|
|
Re: How to use callbacks with "embedded" controls...
By: forlano on Wed, 19 April 2006 16:44
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Wed, 19 April 2006 17:25
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Wed, 19 April 2006 17:35
|
|
|
Re: How to use callbacks with "embedded" controls...
By: forlano on Wed, 19 April 2006 21:36
|
|
|
Re: How to use callbacks with "embedded" controls...
By: forlano on Thu, 20 April 2006 00:46
|
|
|
Re: How to use callbacks with "embedded" controls...
By: fudadmin on Thu, 20 April 2006 05:02
|
Goto Forum:
Current Time: Thu May 09 17:05:25 CEST 2024
Total time taken to generate the page: 0.02038 seconds
|