|
Home > Archive > dBASE Questions and Answers > December 2005 > using super with custom classes
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
using super with custom classes
|
|
| Zagrijs Venter 2005-11-29, 7:24 am |
| Hi
I should know how to do this, but I don't, and the OLH is silent about
"super".
class CENTRYFIELD (parentObj) of ENTRYFIELD( parentObj) custom
this.onOpen = class::CENTRYFIELD_o
nOpen
function CENTRYFIELD_onOpen
return
endclass
Using the custom class on a form and overriding the custom class's onOpen
event, I am unable to call the original function using "super".
Most of my attempts have been met with the error message "not member of
class or base class".
Your help is appreciated.
Zagrijs Venter
| |
| Michael Nuwer [dBVIPS] 2005-11-29, 7:24 am |
| Zagrijs Venter wrote:
> Using the custom class on a form and overriding the custom class's onOpen
> event, I am unable to call the original function using "super".
>
> Most of my attempts have been met with the error message "not member of
> class or base class".
>
The following code, run from a single prg file, works for me:
f = new form()
f.ef = new myentryfield(f)
f.open()
class MYENTRYFIELD (parentObj) of CENTRYFIELD( parentObj) custom
this.onOpen = class::CENTRYFIELD_o
nOpen
function CENTRYFIELD_onOpen
? "Sub class"
return super::centryfield_o
nopen()
endclass
class CENTRYFIELD (parentObj) of ENTRYFIELD( parentObj) custom
this.onOpen = class::CENTRYFIELD_o
nOpen
function CENTRYFIELD_onOpen
? "super class"
return
endclass
| |
| Todd Kreuter 2005-11-29, 7:24 am |
| Zagrijs Venter wrote:
>
> Using the custom class on a form and overriding the custom class's onOpen
> event, I am unable to call the original function using "super".
In the form class, using "super" would refer to the super form class, I
believe. You need to name the class instead, like so:
function OverRide_onOpen
// do something
return CENTRYFIELD::onOpen(
)
--
Todd Kreuter [dBVIPS]
| |
| Zagrijs Venter 2005-12-05, 8:25 pm |
| Thanks to both. I knew I was missimg sometghing small, but this time of the
year exhaustion takes its toll.
Zagrijs
"Zagrijs Venter" < wrote in message
> Hi
>
> I should know how to do this, but I don't, and the OLH is silent about
> "super".
>
> class CENTRYFIELD (parentObj) of ENTRYFIELD( parentObj) custom
>
> this.onOpen = class::CENTRYFIELD_o
nOpen
>
> function CENTRYFIELD_onOpen
>
> return
>
> endclass
>
> Using the custom class on a form and overriding the custom class's onOpen
> event, I am unable to call the original function using "super".
>
> Most of my attempts have been met with the error message "not member of
> class or base class".
>
> Your help is appreciated.
>
> Zagrijs Venter
>
>
|
|
|
|
|