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
Re: Virtual functions versus callbacks [message #24219 is a reply to message #24218] Wed, 06 January 2010 11:29 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
IMO the difference is that Callbacks are intended for communication between classes/Ctrls and are defined by the Ctrl. Callbacks are usually for actions that imply some sort of state change or contextual (wrong word maybe?) function of the Ctrl.

The virtual methods are the way in which a Ctrl interfaces internally with the underlying GUI/OS and is essentially a cleaner replacement of the message loop. The functions sometimes pass additional information that wouldn't be useful or needed externally.

Example of Callbacks:
WhenAction
WhenAcceptEdit

Example of virtual function:
LeftDown
GotFocus

While there are occasions when the developer might requrie some additional comunication from a Ctrl (ie a Callback) that is the exception rather than the rule in my experience and as demonstrated it is not difficult to add.

I think the current way works very well. Adding Callbacks for all events would just expose a lot of internal message stuff that wouldn't be used very often at the expense of making derived Ctrls more difficult.

IMO obviously, only Mirek could give a definitive answer.

[Updated on: Wed, 06 January 2010 11:38]

Report message to a moderator

 
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: Thu May 16 20:12:41 CEST 2024

Total time taken to generate the page: 0.02129 seconds