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 » Community » Newbie corner » THISBACK, is there a THATBACK?
THISBACK, is there a THATBACK? [message #47786] Sun, 26 March 2017 06:50 Go to next message
ptkacz is currently offline  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 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
ptkacz wrote on Sun, 26 March 2017 06:50
how 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

Re: THISBACK, is there a THATBACK? [message #47793 is a reply to message #47787] Mon, 27 March 2017 06:22 Go to previous message
ptkacz is currently offline  ptkacz
Messages: 89
Registered: March 2017
Member
Thanks Z. Awesome, that worked! I was able to locate the header file that the macro and callback are defined in. Thanks for your help.


Peter
Previous Topic: Link error:
Next Topic: Where i can start learning u++?
Goto Forum:
  


Current Time: Thu Mar 28 13:41:19 CET 2024

Total time taken to generate the page: 0.01043 seconds