Subject Re: INHERITANCE
From Andy Taylor <andy.taylor@which.net>
Date Tue, 18 Jul 2017 05:55:42 -0400
Newsgroups dbase.getting-started

Mustansir,

Try running the form below... it demonstrates both methods.....you jusy need to work out what you haven't
done in your form...

Andy

> Dear Andy
> I did not work and gave following error message "Not member of Class or Base class:  ONSELCHANGE"
> Regards
> Mustansir
>
> Andy Taylor Wrote:
> > Mustansir,
> > There are two ways, either use the super:: designation which refers to the same method in the immediate ancestor, or call the code in the original custom object diectly (assuming you have a set procedure command that refers to the cc file).
> > so your first line in the new code is either:
> >
> >    super::onSelChange()
> >    or
> >    MyTabBox::onSelChange()
> >
> > Andy
> >  
> > > Dear All
> > > There is custom control MyTabBox which I have used in my form. It has an event OnselChange inherited. How do I add code to this event because if I do It overrides the custom code in cc file.
> > > Best Regards
> > > Mustansir

// Save the following as ccSuperMethods.wfm
*--cut here----------------------------------------------*
// displays use of methods in cc & calling with super...
        set procedure to ccSuperMethods.wfm additive
** END HEADER -- do not remove this line
//
// Generated on 18/09/2016
//
parameter bModal
local f
f = new InheritForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class InheritForm of FORM
   with (this)
      height = 10.1364
      left = 88.7143
      top = 9.1364
      width = 46.7143
      text = "CcSuperMethods"
   endwith

   this.TXT1 = new MyTXT1(this)
   with (this.TXT1)
      height = 1.0
      left = 4.0
      top = 1.5
      width = 12.0
      text = "Txt1"
   endwith

   this.TXT2 = new MyTXT2(this)
   with (this.TXT2)
      height = 1.0
      left = 4.0
      top = 3.5
      width = 12.0
      text = "Txt2"
   endwith

   this.TXT3 = new MyTxt3(this)
   with (this.TXT3)
      height = 1.0
      left = 4.0
      top = 5.5
      width = 12.0
      text = "Txt3"
   endwith

endclass

Class MyTxt1(f) of Text(f) custom
   Function OnOpen
           Msgbox("I am "+this.name+" running "+Program())
Endclass

Class MyTxt2(f) of MyTxt1(f) custom
   Function OnOpen
           super::OnOpen()
                *--now my own
           Msgbox("I am "+this.name+" running "+Program())
Endclass

Class MyTxt3(f) of MyTxt2(f) custom
   Function OnOpen
           MyTxt2::OnOpen()
                *--now my own
           Msgbox("I am "+this.name+" running "+Program())
Endclass

*---end here--------*