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 » U++ Library support » U++ Callbacks and Timers » "Suicide Buttons Array" or how to re-index callbacks or...?
"Suicide Buttons Array" or how to re-index callbacks or...? [message #3502] Mon, 29 May 2006 12:08 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Hi, I'm stuck with this piece of code:

#include <CtrlLib/CtrlLib.h>


struct App : TopWindow {
	StaticRect          work;
	Array<Button>       buts;
//change count to change work area width 
static  int const count = 10;
static  int const elw = 40;
static  int const vw=500;
static  int const ww = count*elw+50;
static  int const wh = 290;

	void Suicide(int i){
		//i=GetNewIndex(i);
		buts.Remove(i);
		//ReIndex();
	}

	typedef App CLASSNAME;

	App() {
		work.SetRect(50,50,ww,wh);
		work.Color(SRed);
		Add(work);
		
		for(int i=0;i<=count;i++){
			buts.Add();
			buts[i].SetRect(5+i*elw,20,30,20);
			buts[i].SetLabel(AsString(i));
			work.Add(buts[i]);
			buts[i].WhenAction=callback1(this,Suicide,i);  //incorrect due to lost index!...
		}

	}
};

GUI_APP_MAIN
{
	App().Title("Suicide Buttons Array").Sizeable().Zoomable().Run();
}


My problem is not for buttons ( this code is just visual representation of the problem. I know that I can hide buttons or remove them from parent Ctrl's. And I know that I can arrange remove buttons with "outside management".).
But my problem is something like "how to re-index "suicide" calbacks with dynamic containers".
Or what else can be used in such cases?
(Somehow I feel that my custom index management is not the best case with ntl libraries...)
Any ideas?

[Updated on: Mon, 29 May 2006 12:10]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: what KillPostCallback is suppose to do
Next Topic: Question about PostCallback from Child Thread
Goto Forum:
  


Current Time: Fri Mar 29 01:24:14 CET 2024

Total time taken to generate the page: 0.02272 seconds