On Mar 2, 2006, at 9:08 AM, Ian R wrote:
Basically, I have a window, ListWindow, which, depending on how
its properties are set, will display records from any of my MySQL
tables, in a ListBox. Double-clicking on a row will open another
window in which you can edit the record.
Now, though the layout of ListWindow is suitable for any table,
the layout of the editing window is table-specific. Just to get
myself going, I've just been creating new editing windows --
table1Window, table2Window, etc. -- with different layouts and
copy/pasting the shared methods, properties, handlers, etc.
However, it seems silly and anti-OOP to have the same code over
and over, and it seemed like the obvious solution was to make a
subclass of Window, EditWindow, with all the shared methods,
props, etc., and then make it the super for table1Window,
table2Window, etc. which would have different layouts.
But RB won't let me set "EditWindow" as a super class. Any ideas?
You can create a new class EditWindow whose super is window. Then
set the super of the table windows to EditWindow. EditWindow can
contain the common code and serve as an abstract class for methods
that must be handled by the subclasses.
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?
Thanks!
Ian
p.s. I hate it when I'm searching the archives and I find question
that I've asked in the past that now seems silly. That having been
said, Hello Future Me!
_______________________________________________
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>