We had a thread a few weeks (daze?) ago about the confusion about where
code is executing in an event.
I think I have found one major source of the confusion - the RB user
Guide!
P365 of the version I just downloaded says:
"Referring to a Class's Properties and Methods From Within the Class
When you add code to a control such as a PushButton in a window, you are
really
adding code to an instance of the PushButton class. Consequently, you
must include
some reference to the instance or REALbasic would have no way of knowing
which
PushButton, for example, your code is referring to.
However, when you are adding code to a class or subclass, there is no
need to refer to
any instance because the code is part of the class to which you have
added code, not
the instance of the class. Consequently, you don't include object
references to the
class in its own code. For example, suppose you create a pushbutton
named
"Pushbutton1" in a window that should be disabled after the user clicks
it. The code
in the PushButton's Action event handler would be:
Pushbutton1.Enabled=False
Creating Reusable Objects with Classes
If you had instead created a subclass with PushButton as its super
class, you would
not include the instance reference, so the code would be:
When the subclass is used, the code will automatically be operating on
the instance
of the class that's in use."
---
This consistently talks about code "within an instance of a class" but
is talking about an EVENT HANDLER which is *NOT* running in an instance
of the Pushbutton class but is running in an instance of the Window
containing that pushbutton instance.
The system doesn't allow us to log documentation bugs. I think this is
one.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|