Page 1 of 1

Xbrowse error

Posted: Wed Jul 23, 2014 2:34 am
by Marcelo Via Giglio
Hello,

with the next sample we can see 2 xbrowse's bug

1.- total footer, edit the C or D column and you can see the error in total, this not happen with the column E
2.- When we edit, the focus go to the last row

Code: Select all

#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()

   local oDlg, oBrw, aData := {{1,"DATO1",1,2,2},{2,"DATO2",2,2,4},{3,"DATO3",3,2,6},{4,"DATO4",4,2,8}}

   DEFINE DIALOG oDlg SIZE 300, 200

   @ 0, 0 XBROWSE oBrw OF oDlg ARRAY aData ;
         PICTUREs "9","@!","999.99","999.99","999,999.99"; 
         AUTOCOLS ;
             CELL ;
         FASTEDIT ;
          FOOTERS
      
   oBrw:l2007                := .T.
   oBrw:bClrSel              := {|| { CLR_WHITE, CLR_HBLUE }}
   oBrw:bClrRowFocus         := {|| { CLR_BLACK, RGB(185,220,255) } }
   oBrw:bClrSelFocus         := {|| { CLR_BLUE, RGB(255,255,153) } }

   oBrw:lExcelCellWise       := .T.
   oBrw:lExitGetOnTypeOut    := .T.


   oBrw:aCols[3]:nFooterType  := AGGR_TOTAL
   oBrw:aCols[3]:nFootStrAlign:= 1
   oBrw:aCols[3]:nEditType    := EDIT_GET
   oBrw:aCols[3]:bOnPostEdit  := {|o, v, n| aData[ oBrw:nArrayAt,3] := v,;
                                            aData[ oBrw:nArrayAt,5] := aData[ oBrw:nArrayAt,4 ] * v , ;
                                            oBrw:MakeTotals(), oBrw:refresh() }

   oBrw:aCols[4]:nFooterType  := AGGR_TOTAL
   oBrw:aCols[4]:nFootStrAlign:= 1
   oBrw:aCols[4]:nEditType    := EDIT_GET
   oBrw:aCols[4]:bOnPostEdit  := {|o, v, n| aData[ oBrw:nArrayAt,4] := v,;
                                            aData[ oBrw:nArrayAt,5] := aData[ oBrw:nArrayAt,3 ] * v , ;
                                            oBrw:MakeTotals(), oBrw:refresh()  }

   oBrw:aCols[5]:nFooterType  := AGGR_TOTAL
   oBrw:aCols[5]:nFootStrAlign:= 1

   oBrw:CreateFromCode() 

   oBrw:MakeTotals()

      
   ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize() )

return nil
 
Testing with FWX 1402, 1404

Regards

Marcelo Vía

Re: Xbrowse error

Posted: Fri Mar 27, 2015 6:53 am
by nageswaragunupudi
There is no bug in xbrowse.
This is the correct code

Code: Select all

#include "fivewin.ch"
#include "xbrowse.ch"

function main()

   local oDlg, oBrw, aData := {{1,"DATO1",1,2,2},{2,"DATO2",2,2,4},{3,"DATO3",3,2,6},{4,"DATO4",4,2,8}}

   DEFINE DIALOG oDlg SIZE 300, 200

   @ 0, 0 XBROWSE oBrw SIZE 0,0 PIXEL OF oDlg ARRAY aData ;
         AUTOCOLS ;
         PICTUREs "9","@!","999.99","999.99","999,999.99";
             CELL ;
         FASTEDIT ;
          FOOTERS

   oBrw:aCols[ 3 ]:bOnChange  := { |oCol, uOld| oBrw:oCol( 5 ):VarPut( oCol:Value * oBrw:oCol( 4 ):Value ) }
   oBrw:aCols[ 4 ]:bOnChange  := { |oCol, uOld| oBrw:oCol( 5 ):VarPut( oCol:Value * oBrw:oCol( 3 ):Value ) }
   AEval( oBrw:aCols, { |o| o:nEditType := EDIT_GET, o:nFooterType := AGGR_SUM }, 3 )
   oBrw:MakeTotals()

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

return nil