On Mar 2, 2006, at 9:08 AM, Ian R wrote:


Hey all --

I have 2 related, seemingly pretty basic concepts that, if somebody could take a minute to explain them, I'd be grateful.

1.  "Subclassing a subclass of Window"

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.

Best,

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