` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Clarion in general: Passing procedures as parameters
2006-02-10 -- Larry Sand
 
Here's a trivial example of "how" you would use a procedure as a prototype. It's difficult to come up with a non-trivial example using this technique. It's more appropriate where you want to allow access to some data from within a compiled module. A virtual method is very simlar and a better choice in many circumstances. For a real world example of how a callback is used in the Windows API, look in comp.lang.clarion for a thread with the subject enumfonts. I posted an example on 2006.19.01 that uses a typed procedure to prototype the callback procedure passed to the windows API. Another similar example is the FileCallbackInterface in Clarion. HTH, Larry Sand --------------------------- Program Map TranslatorCallbackProc Procedure(Long MsgId),Type Translate Procedure(TranslatorCallbackProc TraslateMessageId, Long MsgId) enTranslator Procedure(Long MsgId) esTranslator Procedure(Long MsgId) End nMsg Long Code nMsg = 1 Translate(enTranslator, nMsg) nMsg = 2 Translate(esTranslator, nMsg) Translate Procedure(TranslatorCallbackProc TraslateMessageId, long MsgId) Code TraslateMessageId(MsgId) Return enTranslator Procedure(Long MsgId) Code Case MsgId Of 1 message('Hello') Of 2 message('Goodbye') End Return esTranslator Procedure(Long MsgId) Code Case MsgId Of 1 message('Hola') Of 2 message('AdiĆ³s') End Return


Today is November 21, 2024, 6:38 am
This article has been viewed 35285 times.
Google search has resulted in 18 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: