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 #2636 is a reply to message #2613] Wed, 19 April 2006 16:44 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
fudadmin wrote on Wed, 19 April 2006 06:26

Ok, I think, this should help: [snip]


Aris,

I tried the code and it works nicely, but... there is a little drawback.
If you remind I wanted to intercept the clicked embedded OptionImage to get its status and prompt the user with a message (and write in the infoctrl too). Now I can do it because, thanks to you, the focus go on the row in which the button is. This is the code that shows its status:
 int VegaTab1::GetAvail()
{	int n = 0;
	String s, player, s1;

	for(int i=0; i<arr.GetCount(); i++) {
		if ( arr.Get(i, "Avail") ) n=n+1;
	}
	//try this here. Later we'll rearrange...
	arr.ChildGotFocus();   //lets move the focus after calculations...
	//do you tests below...

        n = arr.GetCursor();
	s=AsString( arr.Get(n, "Avail") );		
    	PromptOK( s );	
	return n;
}

Now, when I click the optionimage, the PromptOK( s ) appear TWO times, instead of one, and it is annoying. This is due both do the click and the refocus connected connected to WhenCtrlsAction :
void VegaMain::Init()
{	info1="Ready";
	tab1.arr.WhenEnterRow = THISBACK(UpdateInfo);
	tab1.arr.WhenCtrlsAction = THISBACK(UpdateInfo);
}

that call GetAvail:
void VegaMain::UpdateInfo()
{	int int_row, nTotal, nAvail;

	nTotal = tab1.arr.GetCount();
	nAvail = tab1.GetAvail();
	info1 = NFormat("Total players: %d - Available: %d", nTotal, nAvail);
} 


I've noticed that if you comment
// tab1.arr.WhenCtrlsAction = THISBACK(UpdateInfo);
then the consecutive click on the option image will not produce a PromptOK dialog.
So now I'm a bit confused on the place where I have to put the hands to correct this behaviour.
I hope to have been clear.
Luigi
 
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 20:52:17 CEST 2024

Total time taken to generate the page: 0.02360 seconds