realbasic-plugins
[Top] [All Lists]

Re: Callback functions

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Callback functions
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Tue, 26 Oct 2004 09:22:33 -0500
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
References: <1329EC4B-2495-11D9-814C-000A27B1C8AE at elfdata dot com> <6 dot 1 dot 0 dot 6 dot 2 dot 20041026074236 dot 06127ec0 at mail1 dot netreach dot net>
At 7:44 AM -0400 10/26/04, Leonard Rosenthol wrote:

Following up on some discussions of earlier about how to pass a "callback function" into a plugin, so that the plugin can call on the RB app as needed (progress, threading, etc.)

What is the best/approved/recommended method for doing this? Passing in an AddressOf?

Emphatically NO.

  REALLoadObjectMethod()?

Again, NO.

  Other?

Yes: make your code a class, if it is not already, that declares events for whatever "callbacks" it needs. Then locate and invoke these with REALGetEventInstance.

I'm not sure what earlier discussion you're talking about, but you should *never* pass a callback function into a plugin. If you ever find yourself tempted to use AddressOf with a plugin, you should take a deep breath and step calmly away from the cliff. AddressOf is intended for system functions or shared libraries beyond your control; plugins have a much better "callback" mechanism, and always have.

Best,
- Joe

--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>