On Jun 4, 2006, at 3:20 AM, FreeFL wrote:
| 19/05/06 ~ 4:23 -0700 :
| CV,
| " Re: Same code, different frame ? "
> 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 ?
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
Hello!
I have been trying to do this but I am quite lost in the maze.
Could you please explain more precisely how I can proceed ?
Now I have a (quite complex) window. I would like to have several
document windows, with different frame properties and setups,
inheriting all properties, controls, methods etc. from this basic
window.
It's important to recognize that the benefits of window subclassing
(and interfaces) are limited with respect to the functionality that
you've listed. Methods can be declared in the superclass and will be
inherited by the subclass windows. Controls are not inherited.
However, existing controls can be configured by methods declared in
the superclass and implemented(overridden) by code in the subclassed
windows. Frame properties aren't settable in code so I doubt that
subclassing is a help in that regard.
But you can experiment with subclassing windows to determine what may
or may not be useful for you: Create a new class, say SuperWindow,
and set it's superclass to Window in the Properties pane. For
demonstration, add a property to SuperWindow, say MyProperty as
integer = 500, and a method, GetMyProperty as integer which returns
MyProperty. Set Window1's superclass to SuperWindow in the properties
pane and add a pushbutton to Window1. In the pushbutton put: Msgbox
str(self.GetMyProperty). Then run and click the button.
And you can do things like this for any window whose super is
SuperWindow:
...
If Window(i) IsA SuperWindow then
SuperWindow(Window(i).Top = 50 // window class members are available
msgbox str(SuperWindow.GetMyProperty)
...
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>