(div. posts from the NG)
I am trying to inherit a class from another because I need to add a method.
I am getting an error that I don´t have if I use the original class.
The object seems not to be created at all...
The code is something like this:
Class CL2 from CL1
METHOD PrintCl()
ENDCLASS
METHOD PrintCl() class CL2
alert("CL2")
return NIL
Questions:
Al the CL1 methods are avaiable in CL2 ?
Do I need a constructor/destructor method or the CL1 one is used ?
--------------------------------------------------------------------------------
Don't forget to add:
CLASSDATA lRegistered AS LOGICAL
--------------------------------------------------------------------------------
Why ?
What is "lRegistered" ?
-It is a flag that allows a one-time registration of a control class. It is
needed to get Windows aware of the new control.
-Ok, but could you tell me when I need it and when I do not ?
-If you are creating a temporary stand alone class from scratch and you will
not inherit from it then it is not required
-If you plan on inheriting from your class or your class is inheriting from
another, then you will need to add it.
-And apparently you need it only sometimes when it is a control. For instance,
the DBCombo class inherits from the TCombobox class but doesn't have
lRegistered (and it works fine). Perhaps lRegistered should be added, but one
wonders why it works without it.
-Because you are inheriting from a standard Windows control and not creating a
new custom control.
-Thanks for clarifying that.
Then add your new class to a .ch file.
Example:
xTWbrowse inherits from tWbrose
#xcommand @ <nRow>, <nCol> XLISTBOX [ <oBrw> ] FIELDS [<Flds,...>] ;
[ ALIAS <cAlias> ] ;
[ <sizes:FIELDSIZES, SIZES, COLSIZES> <aColSizes,...> ] ;
[ <head:HEAD,HEADER,HEADERS,TITLE> <aHeaders,...> ] ;
[ SIZE <nWidth>, <nHeigth> ] ;
[ <dlg:OF,DIALOG> <oDlg> ] ;
[ SELECT <cField> FOR <uValue1> [ TO <uValue2> ] ] ;
[ ON CHANGE <uChange> ] ;
[ ON [ LEFT ] CLICK <uLClick> ] ;
[ ON [ LEFT ] DBLCLICK <uLDblClick> ] ;
[ ON RIGHT CLICK <uRClick> ] ;
[ FONT <oFont> ] ;
[ CURSOR <oCursor> ] ;
[ <color: COLOR, COLORS> <nClrFore> [,<nClrBack>] ] ;
[ MESSAGE <cMsg> ] ;
[ <update: UPDATE> ] ;
[ <pixel: PIXEL> ] ;
[ WHEN <uWhen> ] ;
[ <design: DESIGN> ] ;
[ VALID <uValid> ] ;
[ ACTION <uAction,...> ] ;
=> ;
[ <oBrw> := ] xTWBrowse():New( <nRow>, <nCol>, <nWidth>, <nHeigth>,;
[\{|| \{<Flds> \} \}], ;
[\{<aHeaders>\}], [\{<aColSizes>\}], ;
<oDlg>, <(cField)>, <uValue1>, <uValue2>,;
[<{uChange}>],;
[\{|nRow,nCol,nFlags|<uLDblClick>\}],;
[\{|nRow,nCol,nFlags|<uRClick>\}],;
<oFont>, <oCursor>, <nClrFore>, <nClrBack>, <cMsg>,;
<.update.>, <cAlias>, <.pixel.>, <{uWhen}>,;
<.design.>, <{uValid}>, <{uLClick}>,;
[\{<{uAction}>\}] )