At 8:45 AM -0500 3/3/06, Ian R wrote:
When I had the same code in many windows, I could loop through all
the controls in the window (i as integer) and do this:
if control(i) isA EditField then EditField1(control(i).Index).Load
if control(i) isA ListBox then ListBox1(control(i).Index).Load
if control(i) isA MoviePlayer then MoviePlayer1(control(i).Index).Load
Right, that won't work from outside the window (including in the
superclass) since EditField1, ListBox1, and MoviePlayer1 (which BTW I
hope are not their real names!) are only defined within the actual
window class where they live.
However, I note that EditField, Listbox, and MoviePlayer don't
actually have a Load method. So it seems that you're already using
subclasses of these that do know how to load themselves. That's
good! You have just one more small step to do:
Define a new Class Interface, called Loadable, that defines a Load
method. Make each of your control subclasses implement this
interface (which, since they already have a Load method, simply means
adding "Loadable" to their Interfaces property). Then the code in
your superclass becomes:
if control(i) IsA Loadable then Loadable(control(i)).Load
Aren't interfaces great?
Best,
- Joe
--
Joseph J. Strout
[EMAIL PROTECTED]
_______________________________________________
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>