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 » U++ Library support » U++ Callbacks and Timers » Virtual functions versus callbacks
Virtual functions versus callbacks [message #24202] Tue, 05 January 2010 09:59 Go to previous message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hello all

To let the program do actions after events I have seen there are two options in Upp:

- To use "virtual" functions
For example to get the "enter" key in an EditField it is necessary to do a derived class
that catches virtual bool Key(dword key, int rep);

- To use callback
For example to do something after clicking in an ArrayCtrl it could be done by assigning a callback function to "WhenLeftClick".

From the user (programmer) point of view it seems better callback functions as you do not need to do derived classes every time you need a certain response after a Ctrl event.

Personally I stronger prefer callback but, what do you think about it ?

Best regards
Koldo


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: mini BUGFIX in CallbackArgTarget
Next Topic: extracted Timer from Ctrl
Goto Forum:
  


Current Time: Fri Apr 19 23:04:22 CEST 2024

Total time taken to generate the page: 0.04839 seconds