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 » THISBACK1 works well, how can i make it with lambda
Re: THISBACK1 works well, how can i make it with lambda [message #48331 is a reply to message #48328] Fri, 23 June 2017 23:52 Go to previous messageGo to previous message
MuratAKAR is currently offline  MuratAKAR
Messages: 3
Registered: June 2017
Junior Member
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class AnaForm: public TopWindow
{
	Button butonlar[100];
	void btnDuzenle(Button*);
	typedef AnaForm CLASSNAME;
public:
	AnaForm();
};

void AnaForm::btnDuzenle(Button* btnDuzenle)
{
	btnDuzenle->SetLabel("X");
}

AnaForm::AnaForm()
{
	SetRect(100,100,320,345);
	for(int i=0;i<100;i++)
	{
		butonlar[i].LeftPosZ(i%10*30,28).TopPosZ(i/10*30,28);
		butonlar[i].SetLabel(String()<<i);
		Add(butonlar[i]);
		//butonlar[i]<<THISBACK1(btnDuzenle, &butonlar[i]); Works well
			
	
		//butonlar[i]<<[&]{ btnDuzenle(&butonlar[i]); }; Not Works
		
		butonlar[i]<<[=]{ btnDuzenle(&butonlar[i]); }; //Works well
		butonlar[i]<<[=]{ butonlar[i].SetLabel("X"); };//Works well
		
	}
}

GUI_APP_MAIN
{
	SetLanguage(GetSystemLNG());
	AnaForm frm;
	frm.Run();
}


butonlar[i]<<[=]{ btnDuzenle(&butonlar[i]); }; //Works well
butonlar[i]<<[=]{ butonlar[i].SetLabel("X"); };//Works well

Sory, I have not tried both. Problem solved. Thanks..

Turkish:
Teşekkür ederim. Baya kod denemiştim ama ikisini denememişim. Sağolasın. İyi bayramlar. Smile
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: callbacks freeze gui
Next Topic: About storing references and pointers to callbacks.
Goto Forum:
  


Current Time: Sun Apr 28 13:38:56 CEST 2024

Total time taken to generate the page: 0.02745 seconds