U++ framework
Do not panic. Ask here before giving up.

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 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1265
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


[Updated on: Thu, 22 June 2017 11:50]

Report message to a moderator

 
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 26 16:35:27 GMT+2 2026

Total time taken to generate the page: 0.00564 seconds