ADD oCol TO XBROWSE...

ADD oCol TO XBROWSE...

Postby FranciscoA » Sat Apr 23, 2016 3:44 am

Saludos, amigos del foro.
Code: Select all  Expand view
REDEFINE XBROWSE oBrw2 ID 182 OF oWndChild ;
            AUTOCOLS SIZES 20,60,80,340 ALIAS "CTXCOB" CELL LINES

   ADD oCol TO oBrw2 AT 4 DATA 0.00 SIZE 80 HEADER "PAGO"

   oBrw2:bGotFocus:= {|| dbselectarea("CTXCOB") }
   oBrw2:bKeyDown := {|nKey| GrabPagos(nKey,oBrw2) }

*****
Luego en la function GrabPagos():

//-----------------------------
Function GrabPagos(nKey,oBrw)

if nKey == 32   //VK_SPACE
   oBrw:Pago:Value := oBrw:SaldoAct:Value   //NO ME FUNCIONA...  ES LA COLUMNA AGREGADA (ADD  oCol...)
   //oBrw:SaldoAct:Value := oBrw:Numdoc:Value   //Esta si funciona
   oBrw:Refresh()
endif
Return nil
 


¿Por qué no funciona?... ¿Alguna pista?

Gracias.

Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: ADD oCol TO XBROWSE...

Postby FranciscoA » Sun Apr 24, 2016 12:42 am

Bueno, opté por utilizar un campo de la tabla.
Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: ADD oCol TO XBROWSE...

Postby nageswaragunupudi » Sun Apr 24, 2016 12:53 pm

sample:
Code: Select all  Expand view

#include "fivewin.ch"

function main()

   local oDlg, oBrw, oFont
   local aData

   USE CUSTOMER

   aData    := Array( CUSTOMER->( LASTREC() ) )
   AFILL( aData, 0.00 )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL FONT oFont

   @ 20,10 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" ;
      COLUMNS "FIRST", "SALARY" ;
      CELL LINES NOBORDER FOOTERS

   ADD TO oBrw ;
      DATA { |x,o| If( x == nil, aData[ o:oBrw:BookMark ], aData[ o:oBrw:BookMark ] := x ) } ;
      HEADER "NewCol"

   WITH OBJECT oBrw
      :Salary:nFooterType     := AGGR_SUM
      :NewCol:nFooterType     := AGGR_SUM
      :NewCol:nWidth          := 100
      :bKeyChar   := { |nKey| If( nKey == 32, ;
                       oBrw:NewCol:VarPut( If( Empty( oBrw:NewCol:Value ), ;
                        oBrw:Salary:Value, 0.00 ) ), nil ) }
      //
      :MakeTotals()
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 
Regards

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

Re: ADD oCol TO XBROWSE...

Postby nageswaragunupudi » Sun Apr 24, 2016 1:10 pm

Another simple way
Code: Select all  Expand view

#include "fivewin.ch"

function main()

   local oDlg, oBrw, oFont
   local aData

   USE CUSTOMER

   aData    := Array( CUSTOMER->( LASTREC() ) )
   AFILL( aData, 0.00 )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL FONT oFont

   @ 20,10 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" ;
      COLUMNS "FIRST", "SALARY", { || aData[ RECNO() ] } ;
      HEADERS  nil, nil, "NewCol" ;
      CELL LINES NOBORDER


   WITH OBJECT oBrw
      :NewCol:nWidth          := 100
      :bKeyChar   := { |nKey| If( nKey == 32, ;
         ( aData[ CUSTOMER->( RECNO() ) ] := CUSTOMER->SALARY, ;
           oBrw:RefreshCurrent() ), nil ) }

      //
      :MakeTotals()
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 
Regards

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

Re: ADD oCol TO XBROWSE...

Postby FranciscoA » Sun Apr 24, 2016 6:13 pm

Thanks, Mr. Rao
Code: Select all  Expand view
WITH OBJECT oBrw
      :Salary:nFooterType     := AGGR_SUM
      :NewCol:nFooterType     := AGGR_SUM
      :NewCol:nWidth          := 100
      :bKeyChar   := { |nKey| If( nKey == 32, ;
                       oBrw:NewCol:VarPut( If( Empty( oBrw:NewCol:Value ), ;
                        oBrw:Salary:Value, 0.00 ) ), nil ) }
      //
      :MakeTotals()
      :CreateFromCode()
   END

Best regards
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 100 guests