| 4/06/06 ~ 6:02 -0700 :
| CV,
| " Re: Same code, different frame ? "
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)
...
Thank you for these explanations.
Two more questions :
- when I create the property, if I write in the dialog "myproperty as
integer = 500" it closes nicely on enterkey but does not compile. Is
your example to be understood as a shortcut for first creating
property, then giving it a value somewhere else, or is this syntax
correct in the definition dialog ? I run RB555 on a mac, and maybe
the syntax you show is correct in RB200x but not in RB555 ?
- your example :
SuperWindow(Window(i).Top = 50
seems to need another parenthesis. Should it not be :
SuperWindow(Window(i)).Top = 50
Ooh, so much to learn for my poor old brain!
_______________________________________________
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>