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?

----------------------------------------------------------------

2.  "Programmatically choosing which EditWindow to open"

In ListWindow, I have code that looks at the MySQL table ListWindow is using, and opens table1Window, table2Window, etc. accordingly. Because it works, I was just using a Select Case:

dim w1 as table1Window
dim w2 as table2Window
...this goes on for a while

Case "table1"
        create and load table1Window
Case "table2"
        create and load table2Window

etc.

...anyway, it's clunky, I have to dim all the windows outside of the control structure and it just LOOKS wrong. Is there a way for me to do something more like:

(having stored a property in ListWindow called WhichWindowToOpen)

dim w as WhichWindowToOpen
w = new WhichWindowToOpen
w.LoadRecord, etc.

?


Thanks, very much, in advance,
Ian
_______________________________________________
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