On May 18, 2006, at 7:03 PM, FreeFL wrote:
> Hello!
>
>
> I have built a window, set its frame property as document, its name
> is MyDocumentWindow.
> I have made a clone of this and set the frame propery to global
> palette, its name is MyPaletteWindow.
> So now I have two "versions" of the same window. I would like to
> use either one of them, with the same reference in my globals module.
>
> Is it possible to use in code a reference, say TheWindow, to a
> window and have this reference set to point to either
> MyDocumentWindow or MyPaletteWindow, assuming all other properties
> and methods are exactly the same in both ?
Yes, you can do that. But it is maybe not quite as straightforward as
you might think at first blush. Because the system won't think that
the properties and methods are the same.
Another thing you can do is to use a class interface, and add that
interface
to both windows. It's a lot less messy than using IsA and multiple
dims,
duplicate code, etc.
Or you can create TheWindow as a subclass of window and assign
TheWindow as the super of MyDocumentWindow and MyPaletteWindow.
Common methods declared in TheWindow with no code will be implemented
in instances of the subclasses, ie., by a MyDocumentWindow or a
MyPaletteWindow. This allows the reference TheWindow to access window
class functionality, as in TheWindow.Visible... as well as the custom
methods that you have added, as in TheWindow.MyMethods.
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>