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 #48322 is a reply to message #48319] | 
			Thu, 22 June 2017 11:36    | 
		 
		
			
				
				
				
					
						  
						Oblivion
						 Messages: 1240 Registered: August 2007 
						
					 | 
					Senior Contributor  | 
					 | 
		 
		 
	 | 
 
	
		Hello, 
 
You are actually capturing nothing ("[]") while you really need to capture variables either by reference ("&") or by copy ("=").  
(Note that in  both cases (whether you use [&] or [=]) the "this" pointer will be automatically captured, so you'll have access to AnaForm class' members such as butonlar[] array.): 
 
Also, you really don't need a (empty) parameter list here. It can be omitted. 
 
butonlar[i]<<[&]{ btnDuzenle(&butonlar[i]); }; // this should work, since butonlar[] is a member of AnaForm class.
butonlar[i]<<[=]{ btnDuzenle(&butonlar[i]); }; // this should work too.
// And you can also get rid of the member function AnaForm::btnDuzenle()
butonlar[i]<<[=]{ butonlar[i].SetLabel("X"); }; // this is IMO a more elegant solution in such  simple cases (given your example code).
 
 
 
 
Best regards, 
Oblivion 
		
		
  Github page: https://github.com/ismail-yilmaz 
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
		[Updated on: Thu, 22 June 2017 11:50] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
  
 
Goto Forum:
 
 Current Time: Tue Nov 04 07:00:36 CET 2025 
 Total time taken to generate the page: 0.11351 seconds 
 |