Ejemplo de xBrowse (Solucionado, thanks Mr. Rao)

Ejemplo de xBrowse (Solucionado, thanks Mr. Rao)

Postby Armando » Thu Jun 21, 2018 9:52 pm

Saludos al foro:

Alguien que me pueda proporcionar un pequeño ejemplo de un xBrowse con selección
de varios renglones?

Un abrazo
Last edited by Armando on Sat Jun 30, 2018 4:32 pm, edited 1 time in total.
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Ejemplo de xBrowse

Postby joseluisysturiz » Fri Jun 22, 2018 4:32 pm

Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Ejemplo de xBrowse

Postby Armando » Fri Jun 22, 2018 4:42 pm

José Luis:

Muchas gracias, es un buen comienzo

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Ejemplo de xBrowse

Postby joseluisysturiz » Sat Jun 23, 2018 12:52 am

Armando wrote:José Luis:

Muchas gracias, es un buen comienzo

Saludos


Armando, ya al hacer el SELECT de los registros, xBrowse crea un ARRAY con los registros seleccionados, y luego solo manipulas ese array y listo...no se en si que buscar hacer al seleccionar los registros, eliminar, copiar, etc...cualquier duda EL FORO esta a la orden, jeje...gracias... :shock:
Last edited by joseluisysturiz on Sun Jun 24, 2018 2:31 am, edited 1 time in total.
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Ejemplo de xBrowse

Postby nageswaragunupudi » Sat Jun 23, 2018 7:41 am

Set oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROWMS // value 6

XBrowse automatically manages multi-row selection.
Select block of rows Shift-Click and toggle selection by Ctrl-Click.

At any time oBrw:aSelect is an array of selected record numbers.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Ejemplo de xBrowse

Postby Armando » Sat Jun 23, 2018 3:58 pm

Mr. Rao

Thanks a lot.

With best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Ejemplo de xBrowse

Postby Marc Venken » Sun Jun 24, 2018 8:59 pm

If you want to do someting with the selection, use this :

Code: Select all  Expand view  RUN

  if msgyesno("Want to add to other database")
    FOR I = 1 TO LEN(oBrwCol:aSELECTED) // obrw:aSELECTED is an array containing recnos marked
      oBrwCol:BookMark := oBrwCol:aSelected[ i ]   // works for dbf, rowset, ado and all
      att->(dbappend())
      att->artcode = nofoto->id  // database of browse, but you can also use xbrowse data
      att->fab_name = nofoto->fabrikan
      att->colnaam = oBrwCol:A:value
      att->colstr = upper(alltrim(nofoto->id)+oBrwCol:A:value)
    next
    oBrwAtt:refresh()
  endif

 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Ejemplo de xBrowse

Postby Armando » Sun Jun 24, 2018 11:10 pm

Marc:

Great!

Thanks a lot

With best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Ejemplo de xBrowse

Postby Armando » Wed Jun 27, 2018 11:00 pm

Amigos:

Gracias a su valioso apoyo he logrado seleccionar varios registros de un xBrowse, ahora
lo que necesito es que cada que se elija un registro obtener la suma de una columna,
que método debo usar para sumar dicha columna?

Estoy usando FWH1711

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Ejemplo de xBrowse

Postby joseluisysturiz » Thu Jun 28, 2018 2:51 am

Armando wrote:Amigos:

Gracias a su valioso apoyo he logrado seleccionar varios registros de un xBrowse, ahora
lo que necesito es que cada que se elija un registro obtener la suma de una columna,
que método debo usar para sumar dicha columna?

Estoy usando FWH1711

Saludos



Lo hago asi,

oBrowse:aCols[n]:nTotal := 0 // NECESARIA PARA TOTALIZAR COL.(MakeTotals)
oBrowse:aCols[n]:cFooterPicture := "@E 99,999,999" // PICT.FOOT(MakeTotals)

oBrowse:Maketotals()

asi sumaria la columna, y para obtener el valor uso

oBrowse:aCols[n]:nTotal / oBrowse:NombreColumna:nTotal

espero ayude, saludos...gracias... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Ejemplo de xBrowse

Postby nageswaragunupudi » Thu Jun 28, 2018 4:31 am

Please copy this sample to fwh\samples folder and build.
This sample works with DBF, MySql, ADO, etc without any changes. Just change the datasource.
You may adopt this logic to your needs.
Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oBrw, oFont

   USE CUSTOMER NEW ALIAS CUST VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE DIALOG oDlg SIZE 700,500 PIXEL TRUEPIXEL FONT oFont ;
      TITLE FWVERSION + " : MULTISELECT"

   @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUST" ;
      COLUMNS .F., "FIRST", "CITY", "SALARY" ;
      HEADERS "" ;
      CELL LINES FOOTERS NOBORDER

   WITH OBJECT oBrw
      :nMarqueeStyle    := MARQSTYLE_HIGHLROWMS
      WITH OBJECT :aCols[ 1 ]
         :bEditValue    := { || AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
         :SetCheck()
         :nHeadBmpNo    := 2
         :bFooter       := { || Len( oBrw:aSelected ) }
      END
      WITH OBJECT :Salary
         :nFooterType   := AGGR_SUM
         :bSumCondition := { || AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
      END
      :bOnMultiSelect   := { || oBrw:MakeTotals() }
      :bChange          := { || If( Len( oBrw:aSelected ) <= 1, ;
                                ( oBrw:Salary:nTotal := oBrw:Salary:Value,  ;
                                oBrw:Salary:RefreshFooter() ), ;
                                nil ) }

      :MakeTotals()
      //
      :CreateFromCode()
   END

   @ 10, 20 BTNBMP PROMPT "SelectAll" SIZE 100,40 PIXEL OF oDlg FLAT ;
      ACTION ( oBrw:SelectAll(), oBrw:SetFocus() )

   @ 10,140 BTNBMP PROMPT "ClearAll"  SIZE 100,40 PIXEL OF oDlg FLAT ;
      ACTION ( oBrw:SelectNone(), oBrw:SetFocus() )

   @ 10,300 SAY "Shift-Click to Select Block or Rows" + CRLF + ;
                "Ctrl-Click to Toggle Selection" ;
            SIZE 380,40 PIXEL OF oDlg RIGHT ;
            COLOR CLR_HRED,CLR_WHITE TRANSPARENT

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Ejemplo de xBrowse

Postby Armando » Thu Jun 28, 2018 3:04 pm

José Luis And Mr. Rao:

Thanks a lot for your advise, I will try it.
Muchas gracias por sus consejos, lo voy a intentar.

Best Regards
Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Ejemplo de xBrowse

Postby Armando » Thu Jun 28, 2018 6:23 pm

Mr. Rao:

I'm afraid I can't adapt your code to my needs, this is my source code but I get an error,
as you can see I'm using Recordset, if you could help me I'll be very grateful

Code: Select all  Expand view  RUN

        oBrw:=TxBrowse():New(oDlg)

        oBrw:nMarqueeStyle          := MARQSTYLE_HIGHLROWMS
        oBrw:nColDividerStyle       := LINESTYLE_LIGHTGRAY
        oBrw:nRowDividerStyle       := LINESTYLE_LIGHTGRAY
        oBrw:lColDividerComplete    := (.F.)
        oBrw:nHeaderHeight          := 25
        oBrw:nRowHeight             := 22
        oBrw:nHeaderLines               := 1
        oBrw:nDataLines             := 1
        oBrw:nFooterHeight          := 20
        oBrw:nFooterLines               := 1
        oBrw:lFooter                    := (.T.)
        oBrw:lHScroll                   := (.F.)

       aCol[ 1]                         := oBrw:AddCol()
        aCol[ 1]:bStrData           := { || IF(oRsCxc:RecordCount() > 0,TRANSFORM(oRsCxc:Fields("CARCAR"):Value,"@Z 9999999"),SPACE(01))}
        aCol[ 1]:cHeader            := "Factura"
        aCol[ 1]:nHeadStrAlign      := AL_RIGHT
        aCol[ 1]:nDataStrAlign      := AL_RIGHT
        aCol[ 1]:nWidth             := 60

       aCol[ 2]                         := oBrw:AddCol()
        aCol[ 2]:bStrData           := { || IF(oRsCxc:RecordCount() > 0,TRANSFORM(oRsCxc:Fields("CARCLI"):Value,"@Z 99999"),SPACE(01))}
        aCol[ 2]:cHeader            := "Cliente"
        aCol[ 2]:nHeadStrAlign      := AL_RIGHT
        aCol[ 2]:nDataStrAlign      := AL_RIGHT
        aCol[ 2]:nWidth             := 60

       aCol[ 3]                         := oBrw:AddCol()
        aCol[ 3]:bStrData           := { || IF(oRsCxc:RecordCount() > 0,oRsCxc:Fields("CLINOM"):Value,SPACE(01))}
        aCol[ 3]:cHeader            := "Nombre o Razón Social"
        aCol[ 3]:nHeadStrAlign      := AL_LEFT
        aCol[ 3]:nDataStrAlign      := AL_LEFT
        aCol[ 3]:nWidth             := 300

       aCol[ 4]                         := oBrw:AddCol()
        aCol[ 4]:bStrData           := { || IF(oRsCxc:RecordCount() > 0,Date2Txt(DameFecha(oRsCxc:Fields("CARFEC"):Value)),SPACE(01))}
        aCol[ 4]:cHeader            := "Emisión"
        aCol[ 4]:nHeadStrAlign      := AL_RIGHT
        aCol[ 4]:nDataStrAlign      := AL_RIGHT
        aCol[ 4]:nWidth             := 85

       aCol[ 5]                         := oBrw:AddCol()
        aCol[ 5]:bStrData           := { || IF(oRsCxc:RecordCount() > 0,Date2Txt(DameFecha(oRsCxc:Fields("CARVTO"):Value)),SPACE(01))}
        aCol[ 5]:cHeader            := "Vencimiento"
        aCol[ 5]:nHeadStrAlign      := AL_RIGHT
        aCol[ 5]:nDataStrAlign      := AL_RIGHT
        aCol[ 5]:nWidth             := 85
        aCol[ 5]:cFooter                := { || Len( oBrw:aSelected ) }

       aCol[ 6]                         := oBrw:AddCol()
        aCol[ 6]:bStrData           := { || IF(oRsCxc:RecordCount() > 0,TRANSFORM(oRsCxc:Fields("CARIMP"):Value,"@Z 99,999,999.99"),SPACE(01))}
        aCol[ 6]:cHeader            := "Saldo"
        aCol[ 6]:nHeadStrAlign      := AL_RIGHT
        aCol[ 6]:nDataStrAlign      := AL_RIGHT
        aCol[ 6]:nWidth             := 48
        aCol[ 6]:nFooterType        := AGGR_SUM

        oBrw:bOnMultiSelect         := { || oBrw:MakeTotals() }
      oBrw:bChange                  := { || IF( LEN( oBrw:aSelected ) <= 1, ;
                                            ( oBrw:aCol[6]:nTotal := oBrw:aCol[ 6]:Value,;
                                                oBrw:aCol[6]:RefreshFooter() ),NIL ) }

       oBrw:l2007                       := (.F.)

        oBrw:nStretchCol                := STRETCHCOL_LAST

        oBrw:bClrHeader := { || {CLR_WHITE,CLR_BLACK} }
        oBrw:bClrStd        := { || {CLR_BLACK,CLR_WHITE} }
        oBrw:bClrFooter := { || {CLR_WHITE,CLR_BLACK} }
        oBrw:nRecSelColor   := oApp:nRowParClr                  // Triangulo de selección
        oBrw:bClrSel        := { || {CLR_BLACK,CLR_WHITE} }
        oBrw:bClrSel        := {|| IF( oRsCxc:AbsolutePosition % oApp:nRowsInt == 0 ,{ CLR_BLACK, oApp:nRowParClr },{ CLR_BLACK, oApp:nRowNonClr }) }
        oBrw:bClrSelFocus   := { || {oApp:nFClrFocus,oApp:nBClrFocus} }

        oBrw:bGoTop    := { || IF( ! oRsCxc:BOF() .AND. ! oRsCxc:EOF(), oRsCxc:MoveFirst(), ) }
        oBrw:bGoBottom := { || IF( ! oRsCxc:BOF() .AND. ! oRsCxc:EOF(), oRsCxc:MoveLast(), ) }
        oBrw:bBof      := { || oRsCxc:BOF() }
        oBrw:bEof      := { || oRsCxc:EOF() }
        oBrw:bBookMark := { | uBm | IF( oRsCxc:BOF() .AND. oRsCxc:EOF(), 0, IF( uBm == NIL, oRsCxc:BookMark, oRsCxc:BookMark := uBm ) ) }
        oBrw:bKeyNo    := { | n | IF( oRsCxc:BOF() .AND. oRsCxc:EOF(), 0, IF( n == NIL, oRsCxc:AbsolutePosition, oRsCxc:AbsolutePosition := n ) ) }
        oBrw:bKeyCount  := {|| oRsCxc:RecordCount() }

        oBrw:SetAdo(oRsCxc)
        oBrw:bClrStd    := {|| IF( oRsCxc:AbsolutePosition % oApp:nRowsInt == 0 ,{ CLR_BLACK, oApp:nRowParClr },{ CLR_BLACK, oApp:nRowNonClr }) }
        oBrw:nRecSelColor   := oApp:nRowParClr
        oBrw:CreateFromResource(201)
 


    Application
    ===========
    Path and name: C:\AppPag\AppPag.Exe (32 bits)
    Size: 3,613,184 bytes
    Compiler version: Harbour 3.2.0dev (r1801051438)
    FiveWin version: FWH 17.11
    C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
    Windows version: 6.1, Build 7601 Service Pack 1

    Time from start: 0 hours 0 mins 10 secs
    Error occurred at: 28/06/2018, 12:43:33
    Error description: Error BASE/1132 Bound error: array access
    Args:
    [ 1] = A { ... } length: 0
    [ 2] = N 1

    Stack Calls
    ===========
    Called from: Source\AppPag.Prg => BRWFAC( 911 )
    Called from: Source\AppPag.Prg => (b)APPPAG( 147 )
    Called from: .\source\classes\TGET.PRG => TGET:LVALID( 1657 )
    Called from: .\source\classes\CONTROL.PRG => TGET:FWLOSTFOCUS( 1136 )
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1706 )
    Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 805 )
    Called from: .\source\classes\WINDOW.PRG => _FWH( 3348 )
    Called from: => SYSREFRESH( 0 )
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYCHAR( 827 )
    Called from: .\source\classes\TGET.PRG => TGET:KEYCHAR( 1553 )
    Called from: => TWINDOW:HANDLEEVENT( 0 )
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1731 )
    Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 805 )
    Called from: .\source\classes\WINDOW.PRG => _FWH( 3348 )
    Called from: => DIALOGBOX( 0 )
    Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 296 )
    Called from: Source\AppPag.Prg => APPPAG( 272 )

    System
    ======
    CPU type: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz 3093 Mhz
    Hardware memory: 1936 megs

    Free System resources: 90 %
    GDI resources: 90 %
    User resources: 90 %

    Windows total applications running: 5
    1 DDE Server Window, C:\Windows\syswow64\OLE32.DLL
    2 GDI+ Window, C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23894_none_5c0be957a00992
    3 MCI command handling window, C:\Windows\system32\WINMM.DLL
    4 TV tray notification,
    5 Transferencia de archivos iniciada, C:\AppPag\AppPag.Exe

    Variables in use
    ================
    Procedure Type Value
    ==========================
    BRWFAC
    Param 1: O Class: ERROR
    (b)APPPAG
    Param 1: O Class: TDIALOG
    Local 1: O Class: TDIALOG
    Local 2: O Class: TXBROWSE
    Local 3: O Class: TFONT
    Local 4: O Class: TICON
    Local 5: O Class: TBRUSH
    Local 6: A Len: 5
    Local 7: A Len: 6
    Local 8: N 0
    Local 9: N 0.00
    Local 10: U
    Local 11: U
    Local 12: O Class: TXBROWSE
    Local 13: P 0x350BB64
    Local 14: A Len: 0
    Local 15: N 1
    Local 16: U
    Local 17: U
    TGET:LVALID
    Param 1: O Class: TGET
    TGET:FWLOSTFOCUS
    Local 1: L .T.
    TCONTROL:HANDLEEVENT
    Param 1: N 1836104
    Local 1: U
    TGET:HANDLEEVENT
    Param 1: N 2057
    Param 2: N 1836104
    Param 3: N 0
    Local 1: U
    _FWH
    Param 1: N 2057
    Param 2: N 1836104
    Param 3: N 0
    Local 1: U
    Local 2: U
    SYSREFRESH
    Param 1: N 0
    Param 2: N 2057
    Param 3: N 1836104
    Param 4: N 0
    Param 5: N 15
    Local 1: O Class: TGET
    TCONTROL:KEYCHAR
    TGET:KEYCHAR
    Param 1: N 13
    Param 2: N 18612225
    Local 1: U
    Local 2: U
    Local 3: U
    TWINDOW:HANDLEEVENT
    Param 1: N 13
    Param 2: N 18612225
    Local 1: U
    Local 2: U
    Local 3: U
    Local 4: U
    TCONTROL:HANDLEEVENT
    Param 1: N 258
    Param 2: N 13
    Param 3: N 18612225
    TGET:HANDLEEVENT
    Param 1: N 258
    Param 2: N 13
    Param 3: N 18612225
    Local 1: U
    _FWH
    Param 1: N 258
    Param 2: N 13
    Param 3: N 18612225
    Local 1: U
    Local 2: U
    DIALOGBOX
    Param 1: N 18612225
    Param 2: N 258
    Param 3: N 13
    Param 4: N 18612225
    Param 5: N 15
    Local 1: O Class: TGET
    TDIALOG:ACTIVATE
    Param 1: N 4194304
    Param 2: C "QryPag"
    Param 3: N 0
    Param 4: O Class: TDIALOG
    APPPAG
    Param 1: U
    Param 2: U
    Param 3: U
    Param 4: L .T.
    Param 5: B {|| ... }
    Param 6: L .T.
    Param 7: U
    Param 8: U
    Param 9: U
    Param 10: U
    Param 11: U
    Local 1: N 0
    Local 2: S
    Local 3: O Class: TDIALOG

    Linked RDDs
    ===========
    DBF
    DBFFPT
    DBFBLOB
    DBFNTX

    DataBases in use
    ================

    Classes in use:
    ===============
    1 ERROR
    2 HBCLASS
    3 HBOBJECT
    4 TWINDOW
    5 TCONTROL
    6 TGET
    7 TAPLICACION
    8 WIN_OLEAUTO
    9 TOLEAUTO
    10 TPUBLIC
    11 TICON
    12 TBRUSH
    13 TFONT
    14 TDIALOG
    15 TSAY
    16 GET
    17 TCLIPGET
    18 TDATEPICK
    19 TXBROWSE
    20 TREG32
    21 TXBRWCOLUMN
    22 TBUTTON
    23 TBUTTONBMP
    24 TSCROLLBAR
    25 TBTNBMP
    26 TCLIPBOARD
    27 TRECT
    28 TSTRUCT

    Memory Analysis
    ===============
    389 Static variables

    Dynamic memory consume:
    Actual Value: 1638400 bytes
    Highest Value: 1638400 bytes

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Ejemplo de xBrowse

Postby nageswaragunupudi » Fri Jun 29, 2018 12:39 am

We keep recommending to use command syntax for creating XBrowse, if you want to use advanced features of XBrowse.
Use of bStrData was deprecated many years back. For example, please consider this code:
Code: Select all  Expand view  RUN

        aCol[ 6]:bStrData           := { || IF(oRsCxc:RecordCount() > 0,TRANSFORM(oRsCxc:Fields("CARIMP"):Value,"@Z 99,999,999.99"),SPACE(01))}
aCols[ 6 ]:nFooterType := AGGR_SUM
 

The column value is character value. It is obvious that XBrowse can not total character values. It requires numeric values to total.

Please replace your entire code with this code:
Code: Select all  Expand view  RUN

FWNumFormat( "A", .t. )

REDEFINE XBROWSE oBrw ID 201 OF oDlg;
   DATASOURCE oRsCxc ;
   COLUMNS "CARCAR", "CARCLI", "CLINOM", "CARFEC", "CARVIO", "CARIMP" ;
   HEADERS "Factura", "Cliente", "Nombre o Razón Social", "Emisión", "Vencimiento", "Saldo" ;
   COLSIZES 60,60,300,85,85 ;
   FOOTERS

// Your preferences
WITH OBJECT oBrw
   :l2007            := .f.
   :lHScroll         := .f.
   :nMarqueeStyle    := MARQSTYLE_HIGHLROWMS
   :nColDividerStyle := LINESTYLE_LIGHTGRAY
   :nRowDividerStyle := LINESTYLE_LIGHTGRAY
   :nStretchCol      := STRETCHCOL_WIDEST
   :bClrHeader       := { || {CLR_WHITE,CLR_BLACK} }
   :bClrFooter       := { || {CLR_WHITE,CLR_BLACK} }
   :bClrSel          := {|| IF( oBrw:KeyNo % oApp:nRowsInt == 0 ,{ CLR_BLACK, oApp:nRowParClr },{ CLR_BLACK, oApp:nRowNonClr }) }
   :bClrSelFocus     := { || {oApp:nFClrFocus,oApp:nBClrFocus} }
   :bClrStd          := {|| IF( oBrw:KeyNo % oApp:nRowsInt == 0 ,{ CLR_BLACK, oApp:nRowParClr },{ CLR_BLACK, oApp:nRowNonClr }) }
   :nRecSelColor     := oApp:nRowParClr
   //
   :lDisplayZeros    := .f. // zero values are not displayed. Added by GNRao. No need to use @Z
END


// Settings for Totals and Count
WITH OBJECT oBrw
   :aCols[ 5]:bFooter       := { || Len( oBrw:aSelected ) }
   WITH OBJECT :aCols[ 6]
      :nFooterType         := AGGR_SUM
      :bSumCondition       := { || AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
   END
     
   :bOnMultiSelect         := { || oBrw:MakeTotals() }
   :bChange                := { || IF( LEN( oBrw:aSelected ) <= 1, ;
                                     ( oBrw:oCol(6):nTotal := oBrw:oCol(6):Value,;
                                       oBrw:oCol(6):RefreshFooter() ),NIL ) }
       
   :MakeTotals()
END

ACTIVATE DIALOG oDlg // <other clauses>
 



Please do not use this code. XBrowse automatically provides these codeblocks correctly.
Code: Select all  Expand view  RUN

oBrw:bGoTop    := { || IF( ! oRsCxc:BOF() .AND. ! oRsCxc:EOF(), oRsCxc:MoveFirst(), ) }
oBrw:bGoBottom := { || IF( ! oRsCxc:BOF() .AND. ! oRsCxc:EOF(), oRsCxc:MoveLast(), ) }
oBrw:bBof      := { || oRsCxc:BOF() }
oBrw:bEof      := { || oRsCxc:EOF() }
oBrw:bBookMark := { | uBm | IF( oRsCxc:BOF() .AND. oRsCxc:EOF(), 0, IF( uBm == NIL, oRsCxc:BookMark, oRsCxc:BookMark := uBm ) ) }
oBrw:bKeyNo    := { | n | IF( oRsCxc:BOF() .AND. oRsCxc:EOF(), 0, IF( n == NIL, oRsCxc:AbsolutePosition, oRsCxc:AbsolutePosition := n ) ) }
oBrw:bKeyCount  := {|| oRsCxc:RecordCount() }

oBrw:SetAdo(oRsCxc)
oBrw:CreateFromResource(201)
 


Please try this and provide your feedback.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Ejemplo de xBrowse

Postby Armando » Fri Jun 29, 2018 2:13 am

Mr. Rao:

Thanks to you the xbrowse is improving and I am learning a better way to work with xBrowse,
now I have an error that attached

Code: Select all  Expand view  RUN

        REDEFINE XBROWSE oBrw ID 201 OF oDlg;
        DATASOURCE oRsCxc ;
        COLUMNS "CARCAR", "CARCLI", "CLINOM", "CARFEC", "CARVTO", "CARIMP" ;
        HEADERS "Factura", "Cliente", "Nombre o Razón Social", "Emisión", "Vencimiento", "Saldo" ;
        COLSIZES 60,60,300,85,85 ;
        FOOTERS

        // Your preferences
        WITH OBJECT oBrw
        :l2007            := .f.
        :lHScroll         := .f.
        :nMarqueeStyle    := MARQSTYLE_HIGHLROWMS
        :nColDividerStyle := LINESTYLE_LIGHTGRAY
        :nRowDividerStyle := LINESTYLE_LIGHTGRAY
        :nStretchCol      := STRETCHCOL_WIDEST
        :bClrHeader       := { || {CLR_WHITE,CLR_BLACK} }
        :bClrFooter       := { || {CLR_WHITE,CLR_BLACK} }
        :bClrSel          := { || IF( oBrw:KeyNo % oApp:nRowsInt == 0 ,{ CLR_BLACK, oApp:nRowParClr },{ CLR_BLACK, oApp:nRowNonClr }) }
        :bClrSelFocus     := { || {oApp:nFClrFocus,oApp:nBClrFocus} }
        :bClrStd          := { || IF( oBrw:KeyNo % oApp:nRowsInt == 0 ,{ CLR_BLACK, oApp:nRowParClr },{ CLR_BLACK, oApp:nRowNonClr }) }
        :nRecSelColor     := oApp:nRowParClr
        :lDisplayZeros    := .f. // zero values are not displayed. Added by GNRao. No need to use @Z
        END


        // Settings for Totals and Count
        WITH OBJECT oBrw
        :aCol[ 5]:bFooter       := { || Len( oBrw:aSelected ) }       // this line produces the error
        WITH OBJECT :aCol[ 6]
            :nFooterType         := AGGR_SUM
            :bSumCondition       := { || AScan( oBrw:aSelected, oBrw:BookMark ) > 0 }
        END

        :bOnMultiSelect         := { || oBrw:MakeTotals() }
        :bChange                := { || IF( LEN( oBrw:aSelected ) <= 1, ;
                                            ( oBrw:oCol(6):nTotal := oBrw:oCol(6):Value,;
                                            oBrw:oCol(6):RefreshFooter() ),NIL ) }
        :MakeTotals()
        END
 



    Application
    ===========
    Path and name: C:\AppPag\AppPag.Exe (32 bits)
    Size: 3,613,184 bytes
    Compiler version: Harbour 3.2.0dev (r1801051438)
    FiveWin version: FWH 17.11
    C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
    Windows version: 6.1, Build 7601 Service Pack 1

    Time from start: 0 hours 0 mins 9 secs
    Error occurred at: 28/06/2018, 21:05:28
    Error description: Error BASE/1004 Message not found: TXBROWSE:ACOL

    Stack Calls
    ===========
    Called from: .\source\function\HARBOUR.PRG => _CLSSETERROR( 247 )
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:ACOL( 9999 )
    Called from: Source\AppPag.Prg => BRWFAC( 932 )
    Called from: Source\AppPag.Prg => (b)APPPAG( 147 )
    Called from: .\source\classes\TGET.PRG => TGET:LVALID( 1657 )
    Called from: .\source\classes\CONTROL.PRG => TGET:FWLOSTFOCUS( 1136 )
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1706 )
    Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 805 )
    Called from: .\source\classes\WINDOW.PRG => _FWH( 3348 )
    Called from: => SYSREFRESH( 0 )
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYCHAR( 827 )
    Called from: .\source\classes\TGET.PRG => TGET:KEYCHAR( 1553 )
    Called from: => TWINDOW:HANDLEEVENT( 0 )
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1731 )
    Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 805 )
    Called from: .\source\classes\WINDOW.PRG => _FWH( 3348 )
    Called from: => DIALOGBOX( 0 )
    Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 296 )
    Called from: Source\AppPag.Prg => APPPAG( 272 )

With best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3242
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 36 guests

cron