xBrowse : < oCol:nCreationOrder > Error

xBrowse : < oCol:nCreationOrder > Error

Postby ukoenig » Tue Mar 04, 2008 9:20 pm

Hello, from Germany

I want to create a xBrowser with automatic Col-defines

Code: Select all  Expand view  RUN

// It works without define each COL
// like i need it.
// -------------------------------------------------
   lOemAnsi := .T.
// to show old DOS-Clipper DBF
// ---------------------------------------

oBrw5 := TXBrowse():New( oDlg )

oBrw5:nMarqueeStyle      := MARQSTYLE_HIGHLROW
oBrw5:nColDividerStyle   := LINESTYLE_BLACK
oBrw5:nRowDividerStyle   := LINESTYLE_BLACK
oBrw5:lColDividerComplete   := .t.
oBrw5:nHeaderLines      := 1
oBrw5:nDataLines      := 1
oBrw5:lAllowColSwapping           := .t.
oBrw5:SetRDD()

FOR nFor := 1 to LEN( oBrw5:aCols )
   oCol := oBrw5:aCols[ nFor ]

   // To show D- and L-vars = Centered, N = Right
   // otherwise everything is shown left
   // ---------------------------------------------------------
   IF VALTYPE((cAlias1)->(FieldGet(nFor))) = 'N'
                oCol:nDataStrAlign := AL_RIGHT 
   ENDIF
   IF VALTYPE((cAlias1)->(FieldGet(nFor))) = 'D' .or. ;
      VALTYPE((cAlias1)->(FieldGet(nFor))) = 'L'
                oCol:nDataStrAlign := AL_CENTER 
   ENDIF
   // ---------------------------------------------------------

    oCol:nEditType := 1
    oCol:nEditType := EDIT_GET

                // Shows OemToAnsi => if lOemnsi = .T.
   // --------------------------------------------------
   oCol:bStrData := { |oCol| nOrder := oCol:nCreationOrder, ;
   IIF( VALTYPE( (cAlias1)->(FieldGet(nOrder)) ) = 'C' ;
                      .and. lOemAnsi = .T., ;
         cValToChar( OemToAnsi( ( cAlias1 )->( FieldGet( nOrder ) )) ), ;
         cValToChar( ( cAlias1 )->( FieldGet( nOrder ) )) )   }

   oCol:nEditType := 1
                oCol:nEditType := EDIT_GET
                oCol:bOnPostEdit:= { |oCol,xValue,nLastKey| ;
                                    nOrder := oCol:nCreationOrder, ;
               BRW_SAVE(oBrw5,xValue,nLastKey,cAlias1,nOrder,lOemAnsi) }

next

oBrw5:CreateFromResource( 110 )

.........
.........

On DBL-Click i get the Error in  < oCol:bStrData >

In < oCol:bOnPostEdit > there is no error
and the Function < BRW_SAVE > saves C-Strings
in AnsiToOem-Format !!

// -------------------------------------------------------------
Error BASE/1004  Class: 'NIL' has no exported method: NCREATIONORDER
Args: [   1] = U   

Stack Calls
========
=> NCREATIONORDER(0)
------------------------------------
(   oCol:bStrData := { |oCol| nOrder := oCol:nCreationOrder )

xBrowse.PRG => TXBRWCOLUMN:EDIT(4465)
xBrowse.PRG => TXBROWSE:LDBLCLICK(2325)

//---------------------------------------------------------------------------//

FUNCTION BRW_SAVE(oBrw,xValue,nLastKey,cAlias,nOrder,lOemAnsi)

IF nLastKey == 13
    IF VALTYPE((cAlias)->(FieldGet(nPOS))) = 'C' .and. lOemAnsi = .T.
      xValue   := AnsiToOem( xValue )
    ELSEIF VALTYPE((cAlias)->(FieldGet(nPOS))) = 'C' .and. lOemAnsi = .F.
      xValue   := xValue
    ELSEIF VALTYPE((cAlias)->(FieldGet(nPOS))) = 'N'
      xValue   := Val( xValue )
    ELSEIF VALTYPE((cAlias)->(FieldGet(nPOS)))  = 'D'
        IF EMPTY(CTOD( ALLTRIM( xValue ) ))
          // IF Edit-xValue = "10102007" xValue = 10.10.2007
          xValue  := SUBSTR( xValue,1,2) + "." + ;
                       SUBSTR(xValue,4,2) + "." + SUBSTR( xValue,5,4)
        ENDIF
        xValue   := CTOD( ALLTRIM( xValue ) )
    ELSEIF VALTYPE((cAlias)->(FieldGet(nPOS)))  = 'L'
                   xValue   := ( Upper( Left ( LTrim( xValue ), 1 ) ) $ "YT" )
    ENDIF
    IF NET_RLOCK()
   (cAlias)->( FieldPut( nPOS, xValue ) )
   NET_ULOCK()
    ENDIF
    oBrw:DrawLine( .t. )
    oBrw:Refresh()
ENDIF

RETURN NIL




Image


It works
i can read OemtoAnsi and write AnsiToOem back.
Only on DBL-Click inside of a col i get the error.
When i don't define < oCol:bStrData > everything is ok.
But i have to read in format < OemToAnsi >.

Maybe somebody knows, what to do with < oCol:bStrdata > ?

Regards
Uwe :lol: [/img]
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests