On Mar 3, 2006, at 7:45 AM, Ian R wrote:

Ok, pardon me, but I'm stuck again, and I'm having a hard time finding answers because I don't know really what I'm looking for. I just can't get it abstract enough!

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?

First, you can replace the above series of if statements with putting a suitable class interface on all the controls, and doing

control(i).Load

or only putting a class interface on the controls where you need it, and doing (assuming the Clas Interface is called Loader):

if control(i) IsA Loader
        control(i).Load
End If

The rest of your question, I don't follow. You can certainly do the above in the superclass. If there is something more specific you need to do in the subclasses, you would invoke an Event at the point where you need to do it.

Guyren G Howe
guyren-at-relevantlogic.com
http://relevantlogic.com

REALbasic, PHP, Python programming
PostgreSQL, MySQL database design and consulting
Technical writing and training


_______________________________________________
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