pBrowse inherits kBrowse and kBrowse inherit twbrowse. In the testapplication pBrowse(which inherit kBrowse) works fine(even with ado and SQL:D, see post: viewtopic.php?f=3&t=30404), but in the companies main application it gives a runtime error. I only changed KBROWSE in PBROWSE in one place to to test if that works (Still DBF based, so without SetAdo etc). Maybe there is a problem with the inheritence construction.
Below is a part of the error description.
Error description: Error FiveWin/6 Cannot create window or control:
Class: PBROWSE
Caption:
System Error: Cannot find window class.
Called from WNDCREATEERROR(917)
Called from PBROWSE:CREATE(898)
Called from KBROWSE:NEW(283)
Called from PBROWSE:NEW(73)
(I found function WndCreateError in C:\Pieter\fhw\source\classes\window.prg)
pbrowse.prg
- Code: Select all Expand view
** Class definition
CLASS pBrowse FROM kBrowse
METHOD New( nRow, nCol, nWidth, nHeight, bLine, aHeaders, ;
aColSizes, oWnd, cField, uVal1, uVal2, bChange,;
bLDblClick, bRClick, oFont, oCursor, nClrFore,;
nForeBack, cMsg, lUpdate, cAlias, lPixel, bWhen,;
lDesign, bValid, bLClick, aActions, nStyle ) CONSTRUCTOR
METHOD SetAdo()
ENDCLASS
METHOD New( nRow, nCol, nWidth, nHeight, bLine, aHeaders, aColSizes, oWnd,;
cField, uVal1, uVal2, bChange, bLDblClick, bRClick,;
oFont, oCursor, nClrFore, nClrBack, cMsg, lUpdate, cAlias,;
lPixel, bWhen, lDesign, bValid, bLClick, aActions, ;
nStyle ) CLASS pBrowse
Super:New( nRow, nCol, nWidth, nHeight, bLine, aHeaders, aColSizes, oWnd,;
cField, uVal1, uVal2, bChange, bLDblClick, bRClick,;
oFont, oCursor, nClrFore, nClrBack, cMsg, lUpdate, cAlias,;
lPixel, bWhen, lDesign, bValid, bLClick, aActions, ;
nStyle )
RETURN Self
METHOD SetAdo( oRs, cAlias ) CLASS pBrowse
::cAlias = cAlias
::bLogicLen = {|| oRs:RecordCount() }
::bGoTop = {|| If( oRs:RecordCount() > 0, oRs:MoveFirst(), nil ) }
::bGoBottom := {|| If( oRs:RecordCount() > 0, oRs:MoveLast(), nil ) }
::bSkip := {| n | AdoSkip( oRs, IfNil( n, 1 ) ) }
return nil
function AdoSkip( oRs, n )
LOCAL nRec
if oRs:RecordCount() == 0
return 0
endif
nRec := oRs:AbsolutePosition
If( oRs:Eof, oRs:MoveLast(), If( oRs:Bof, oRs:MoveFirst(),) )
oRs:Move( n )
If( oRs:Eof, oRs:MoveLast(), If( oRs:Bof, oRs:MoveFirst(),) )
return oRs:AbsolutePosition - nRec
.ch file:
- Code: Select all Expand view
- #xcommand @ <nRow>, <nCol> PBROWSE [ <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,...> ] ;
[ STYLE <nStyle> ] ;
=> ;
[ <oBrw> := ] pBrowse():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}>\}], <nStyle> )
Anybody Ideas?
Best regards,
Pieter