On Apr 22, 2006, at 6:41 PM, Charles Ross wrote:
On Apr 22, 2006, at 3:18 PM, Charles Yeomans wrote:
The order is mostly intentionally undocumented. You're better off
writing code that does not depend on the order of events.
Then how would you suggest this is best handled? The window has a
property called db which needs to be set for most of the
functionality of the window, including the open event of the
listboxes and popup menus within the window. Should I set db in
each of these Open events to ensure that it is set when they are
called? At this time, I'm setting it in the Window.Activate event,
which seems to work. It seems a pain to have to put the same line
of code in every control's Open event given that I don't know which
will fire first. Or, given that controls execute their Open events
in the order of the control order (is this documented and
guaranteed?), I could place an invisible control on the window,
make it the first in the order, and place my property setting code
there.
<snick>
I don't mind that the Activate fires every time the Window comes to
the front, as the code within it is very simple at this point:
db = App.Database
Mostly, it's so I don't have to type "App.Database" every time I
need to refer to it within the Window's code.
Okay, this makes things simple. Add a private function DB as
Database to the window.
Private Function DB() as Database
Return App.Database
End Function
It solves your problem, as I understand it, and you can tell people
that you're using "law of Demeter" design principles.
Charles Yeomans
_______________________________________________
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>