Home » Community » Newbie corner » THISBACK, is there a THATBACK?
THISBACK, is there a THATBACK? [message #47786] |
Sun, 26 March 2017 06:50  |
ptkacz
Messages: 89 Registered: March 2017
|
Member |
|
|
On the click of a button, if we want to perform some type of action, we can specify:
myPanel.someBtn << THISBACK(doThis);
"doThis" is a local method that's executed on the click of the button, "someBtn". If wanting to for example call a method of an already created object, how does one specify something like:?
myPanel.someBtn << THISBACK(canvas.doThis);
Is there a way to do this, call a method of an object?
Peter
|
|
|
Re: THISBACK, is there a THATBACK? [message #47787 is a reply to message #47786] |
Sun, 26 March 2017 11:10   |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
ptkacz wrote on Sun, 26 March 2017 06:50how does one specify something like:?
myPanel.someBtn << THISBACK(canvas.doThis);
Peter
Take a look at source code of THISBACK:
#define THISBACK(x) callback(this, &CLASSNAME::x)
You just need pointer to an object and method:
myPanel.someBtn << callback(&canvas, &Canvas::doThis);
[Updated on: Sun, 26 March 2017 11:11] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Sun Apr 27 08:07:19 CEST 2025
Total time taken to generate the page: 0.00752 seconds
|