On Mar 3, 2006, at 5:46 AM, 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
>
> but now that I've moved that shared code into a superclass of those
> Windows, I'm having a hard time communicating with the controls in
> the subclasses.  The only solutions I've found involve referring
> directly to the subclassed Windows (table1Window, etc, in the above
> message) but I think that would defeat the purpose of having the
> abstract superclass...any help?

I think in the above code you are confusing class with instance.  I presume
you have subclasses of EditField, ListBox, etc., defined that implement a
Load method.  Let's say your classes are named myEditField, myListBox, and
myMoviePlayer.  Then the code should read:

if control(i) isa myEditField then myEditField(control(i)).Load
if control(i) isa myListBox then myListBox(control(i)).Load
if control(i) isa myMoviePlayer then myMoviePlayer(control(i)).Load

Use the class name, not the instance's name (even though they all have the
same name, the compiler doesn't know that).

Tim


_______________________________________________
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>

Reply via email to