Home » U++ Library support » U++ Callbacks and Timers » Virtual functions versus callbacks
Re: Virtual functions versus callbacks [message #24204 is a reply to message #24202] |
Tue, 05 January 2010 10:36 |
|
koldo wrote on Tue, 05 January 2010 03:59 | 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
|
In my upp sources EditField has WhenEnter callback. I guess it could be added to the main tree as now I can see I'm not the only one who needs it
|
|
|
Goto Forum:
Current Time: Thu May 16 22:21:26 CEST 2024
Total time taken to generate the page: 0.02863 seconds
|