On Apr 25, 2007, at 9:34 AM, Carl Karsten wrote:
>> The fact that this happens when you change the value should give you
>> a clue. DataBinding is dynamic, and as a result is evaluated when it
>> is used;
>
> That seems to be incorrect. otherwise, "myObj" would be evaluated.
When the value is changed, the name 'myObj' refers to nothing. You
need to understand and keep separate objects themselves and names
that are temporarily assigned to them. The name 'myObj' exists only
in the part of the code that instantiates the object. Once that code
completes, that name goes out of scope. The object persists because
it is referenced by the form, but that temporary name (what we would
call a 'variable' in VFP) no longer exists.
Later on the value of the textbox changes, and code that is deep in
the mixins for data controls is triggered. Since the textbox has non-
empty DataSource and DataField properties, the code tries to push the
textbox Value to the DataSource. First it has to figure out what that
source is. If it is an object reference, great. If it is a string, it
looks for obvious stuff like 'self.Form', 'form', 'app', etc. If none
of those apply, it does an eval() to see if that string evaluates to
a valid object reference. This is the point at which it tries to
figure out what 'myObj' might refer to. At that moment, there is
nothing in the namespace called 'myObj', so the evaluation fails.
>> If myObj exists at the time you are assigning the DataSource, then
>> use the object reference, not a string containing a temporary name to
>> that object.
>
> That does not answer my question.
Yes it does. You just don't want to change your pre-conceived notion
of how things are supposed to work so that you can see how they
actually work.
> The reason I want to understand is so I can figure out how to "use
> the object
> reference" when creating the textbox in the CD?
You really need to keep your namespaces straight. I don't know why
it isn't overwhelmingly obvious to you that the name 'myObj' is long
out of scope at the time that a cdxml is parsed into class code and
then instantiated. Maybe you are thinking along the lines of VFP-
style private memvars, which might work in something like this, but
anyone who's worked with Python for even a short while would
understand that there is nothing even remotely equivalent to 'private'.
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]