Hi All,
I've created a window with xbrowse control using REDEFINE XBROWSE... I've also created a class for customized xBrowse and created a dialog using this class int the later part of the program. However, when i used the class, i always get an error Fivewin/3: Cannot create dialog box ::Argument NIL.
Changing the code to use both xBrowse ( without using customized class ) or vice versa ( using both customized xbrowse ) seems fine...
Could I not use xBrowse and customized xBrowse together?
Below is the customized xbrowse class:
#include "fivewin.ch"
#include "xbrowse.ch"
CLASS CustomBrowse FROM TXBrowse
DATA oWnd
DATA oBrow
DATA aFormat
DATA lArray
METHOD New( oWnd ) CONSTRUCTOR
METHOD KeyDown()
METHOD SetFormat( aFormat )
ENDCLASS
//------------------------------------------------------------------------------
METHOD New( oWnd ) CLASS CustomBrowse
::oBrow := Super():New( oWnd )
::aFormat := {}
::oWnd := oWnd
WITH OBJECT ::oBrow
:nRowHeight := 24
:nHeaderHeight := 26
END
RETURN ( Self )
//------------------------------------------------------------------------------
METHOD KeyDown( nKey, nFlags ) CLASS CustomBrowse
LOCAL oErr
TRY
DO CASE
CASE nKey == VK_INSERT
//::AddRecord()
Super:Refresh()
CASE nKey == VK_DELETE
//::DeleteRecord()
CASE nKey == VK_UP
// Msginfo( 'UP' )
CASE nKey == VK_DOWN
// Msginfo( 'Down' )
CASE nKey == VK_RETURN
OTHERWISE
// ::aData[::oBrow:nArrayAt, Len(::aData[::oBrow:nArrayAt])]:lMod := .T. // set current object lModified to .T.
ENDCASE
CATCH oErr
IF ValType( oErr ) == 'O'
MsgAlert(' ::SubSystem ' + cvaltoChar( oErr: Subsystem ) + CRLF + ;
' ::SubCode ' + cvaltoChar( oErr: SubCode ) + CRLF + ;
' ::Operation ' + cvaltoChar( oErr: Operation ) + CRLF + ;
' ::Description ' + cvaltoChar( oErr: Description ) + CRLF + ;
' ::Arguments ' + cvaltoChar( oErr: Args ), 'KeyDown' )
END
END
return super:keyDown( nKey, nFlags )
//------------------------------------------------------------------------------
METHOD SetFormat( aFormat ) CLASS CustomBrowse
LOCAL nLim, o, oErr
STATIC i := 1
IF ValType( aFormat ) == 'A'
::aFormat := aFormat
END
nLim := Len( ::oBrow:aCols )
TRY
FOR i := 1 TO nLim
::oBrow:aCols[i]:cHeader := aFormat[i, 1]
::oBrow:aCols[i]:nHeadStrAlign := aFormat[i, 2]
::oBrow:aCols[i]:lAllowSizing := aFormat[i, 3]
::oBrow:aCols[i]:nWidth := aFormat[i, 4]
::oBrow:aCols[i]:nDataStrAlign := aFormat[i, 5]
// ::oBrow:aCols[i]:lFastEdit := aFormat[i, 11]
// ::oBrow:lColDividerComplete := .t.
NEXT i
CATCH oErr
IF ValType( oErr ) == 'O'
MsgAlert(' ::SubSystem ' + cvaltoChar( oErr: Subsystem ) + CRLF + ;
' ::SubCode ' + cvaltoChar( oErr: SubCode ) + CRLF + ;
' ::Operation ' + cvaltoChar( oErr: Operation ) + CRLF + ;
' ::Description ' + cvaltoChar( oErr: Description ) + CRLF + ;
' ::Arguments ' + cvaltoChar( oErr: Args ), 'SetFormat' )
END
END
RETURN ( nil )
thanks,
ryugarai27