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 » overwritten virtual void LeftDown - how to invoke WhenAction?
overwritten virtual void LeftDown - how to invoke WhenAction? [message #36706] Wed, 27 June 2012 20:20 Go to next message
Wolfgang is currently offline  Wolfgang
Messages: 146
Registered: November 2011
Location: Germany
Experienced Member
Hi, I've created a class based on Button:
class PaintArea : public Button {

in this I overwrite LeftDown Action:
virtual void LeftDown(Point pos, dword flags) {


and now I'm asking how to call, when set, the WhenAction of the Button?
.h
PaintArea myPaintArea;

.cpp
myPaintArea.WhenAction = THISBACK(anotherMethod);


with this code and the virtual void LeftDown the "anotherMethod" method isn't called - what to change in the virtual void LeftDown(..) method to call this method?

Thanks for help!

EDIT: Is it that easy, just call
this->WhenAction();
at the bottom of the LeftDown method?

[Updated on: Wed, 27 June 2012 20:25]

Report message to a moderator

Re: overwritten virtual void LeftDown - how to invoke WhenAction? [message #36707 is a reply to message #36706] Wed, 27 June 2012 20:52 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Wolfgang

Wolfgang wrote on Wed, 27 June 2012 20:20

EDIT: Is it that easy, just call
this->WhenAction();
at the bottom of the LeftDown method?

Yes, it is that easy with U++ Smile You don't even have to write the "this->". WhenAction is just a Callback - a stored reference to function. You can call it just like the original function. In case no function has been assigned to the callback, it will simply do nothing.

Best regards,
Honza
Re: overwritten virtual void LeftDown - how to invoke WhenAction? [message #36710 is a reply to message #36706] Thu, 28 June 2012 06:20 Go to previous message
Wolfgang is currently offline  Wolfgang
Messages: 146
Registered: November 2011
Location: Germany
Experienced Member
every day u++ wows me again! .. and again! ... and again!
Previous Topic: mousepos / click for a widget...
Next Topic: Open TheIDE in "Restore Down" rather than full screen
Goto Forum:
  


Current Time: Thu Apr 18 13:00:23 CEST 2024

Total time taken to generate the page: 0.02144 seconds