Le 6 sept. 06 à 23:05 Soir, Terry Ford a écrit:
On Sep 6, 2006, at 1:06 PM, Arnaud Nicolet wrote:
Le 6 sept. 06 à 19:31 Soir, Robert Poland a écrit:
Hi,
In Class1 I have this statement"w=TextWindow"
When I run it I get the error This property does not exist.
I have w=TextWindow set as a property, Global in TextWindow. I
thought that a global property could be accessed from anywhere
without a prefix.
This is true for modules.
For classes and windows, global is named public. (at least in my
RB version).
Would that be 5.5? You don't see anything in the latest releases.
Indeed. Most of the time, I say something which has not changed
between 5.5 (the version I keep using) and 2005-2006. This was not
the case here.
For example, say you have 2 windows opened (you used w=new win1
twice).
Then how would the compiler knows for which win1
MyWin1Property=2
refers to?
In that case wouldn't 'w' refer to an instance of win1?
MyWin1.Property doesn't exist as far as I can see by this code
snippet.
One must remember that if one has multiple windows of the same
class name opened, 'w' will usually refer to the last one cast with
the variable used. You must use other methods to determine which of
the win1 windows you are referring to. Here again, the scope of the
variable used is important.
REALbasic is really good at showing casting errors most of the time
but bad location of these variables can affect the execution of
your application.
My point was to demonstrate why not using MyWin1.MyWin1Property (but
only MyWin1Property was not enough). Well, I may not be able to
explain correctly. It's a shame if I want to try to help.
That seems logical to keep the prefix.
In this case, the class name is useless and it also isn't a prefix.
It's the name of the object or objects you are referring to. The
variable that is cast to Win1 is the point in question.
Still from my example, the prefix I was referring to was not
mentioned. I can be "w", self, or anything. The code MyWin1Property=2
was supposed to be outside of its parent class.
All I did was to clarify the scope of the variable "w". There
really wasn't enough code to ascertain exactly what was being
attempted.
If Robert can provide more detail we might be able to ascertain
what he did that was wrong in his code.
Yes. Seems like I'm tired these days, sorry, it's out of me.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>