xbrowse y keydown cosa rara.

xbrowse y keydown cosa rara.

Postby Garbi » Thu Dec 29, 2016 6:12 pm

Hola sigo con el tema de las celdas de xbrowse, ahora lo que pretendo es que al cambiar de una celda a otra me muestro unos datos en la parte superior pero al añadir :keydown me aparece una columna más como podéis ver en la imagen, por lo demás funciona perfecto, me refresca bien los datos.

Si quito :keydown no aparece dicha columna.

He probado con :bkeydown, pero no hace nada.


Agradecería cualquier ayuda como siempre haceis.

Saludos y Feliz Año nuevo.


Image

Adjunto tambien codigo :

Code: Select all  Expand view
REDEFINE XBROWSE oBrwt ID 101 autocols;
    HEADERS V_Header ;
    SIZES  V_ColSize ;
    ARRAY tfilas CELL LINES of oDDATOS
            WITH OBJECT oBrwt
             :bRClicked:= {|| borrararticulo(tfilas,oBrwt,0,vestanteria) }
             :bLDblClick := {|| buscararticulo(tfilas,oBrwt,0) }
             :KeyDown := {|| refrescardatos(vestanteria,oBrwt,0) }
             :bKeychar := {|nkey| iif(nkey=13 .and. oBrwt:nColSel > 1,buscararticulo(tfilas,oBrwt,0),)}
             :nFreeze:=1
             :lFullGrid  := .t.
           END

   REDEFINE BTNBMP ID 500  RESOURCE "ACEPTAR" OF oddatos ;
            ACTION (lSalva:=.t. , oddatos:End());
            MESSAGE "Guardar cambios y salir del catalogo" ;
            WHEN ( Acceso(oApp:aUsuarios,"ESTANTER", nActua ) )

   REDEFINE BTNBMP ID 501  RESOURCE "SALIR" OF oddatos ACTION (lSalva := falso, oddatos:End()) ;
            MESSAGE "Salir de Estanteria"


 ACTIVATE DIALOG oDDATOS CENTER  ON INIT oBrwT:SetFocus()


..........
static function refrescardatos(vestanteria,oBrw,vprofundo)

    area:=select()
    cdestant := OpenDbf(fdestant,1, , , , kdestant,"DBFCDX")
   (cdestant)->(DbSetOrder(1))
   (cdestant)->(Dbgotop())
    acdestan:=select()
    if vprofundo = 0
      (cdestant)->(dbseek(vestanteria+transform(oBrw:nRowSel,"9999")+transform(oBrw:nColSel,"9999")+transform(1,"9999")))
      if found()
         vfcliente:= (cdestant)->cliente
         gvfcliente:refresh()
         vfnombre := (cdestant)->nombre
         gvfnombre:refresh()
         vfarticulo:=(cdestant)->articulo
         gvfarticulo:refresh()
         vfdetalle:=(cdestant)->detalle
         gvfdetalle:refresh()
         vfcantidad:=(cdestant)->cantidad
         gvfcantidad:refresh()

      else
         vfcliente:= ""
         gvfcliente:refresh()
         vfnombre :=""
         gvfnombre:refresh()
         vfarticulo:=""
         gvfarticulo:refresh()
         vfdetalle:=""
         gvfdetalle:refresh()
         vfcantidad:=""
         gvfcantidad:refresh()

      endif
   endif
   (cdestant)->(Dbclosearea())
    select(area)

return nil
 
Saludos,
Regards,

Jose Luis Alepuz
joseluis@mancomputer.com
www.mancomputer.com
Garbi
 
Posts: 291
Joined: Wed Nov 02, 2005 3:28 pm

Re: xbrowse y keydown cosa rara.

Postby MGA » Thu Dec 29, 2016 7:30 pm

/***************************************************************************/
procedure EscondeColunasRestantes( oBrw, nColInicial)
/*
*/
Local x

for x:=nColInicial to len(oBrw:aCols)
oBrw:aCols[x]:lHide := .t.
next

return
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: xbrowse y keydown cosa rara.

Postby nageswaragunupudi » Fri Dec 30, 2016 8:12 am

Code: Select all  Expand view
           :KeyDown := {|| refrescardatos(vestanteria,oBrwt,0) }
 

This creates a new column.
Do not use it.

If you want to take some action when column is changed, then do this.
Code: Select all  Expand view
oBrw:lColChangeNotify := .t.
oBrw:bChange :- { |brw| OnColChange( oBrw ) }

<other clauses>

function OnColChange( oBrw )

   // take action here
   // oBrw:nColSel --> new column number
   // oBrw:SelectedCol() --> new column object
   // oBrw:SelectedCol():Value --> value of the new column

   // using the above data you take your action

return nil
 
Regards

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

Re: xbrowse y keydown cosa rara. Aun mas raro

Postby Garbi » Fri Dec 30, 2016 9:53 am

Hola la opción de ocultar la columna me da error de array.

La opción de bchange funciona bien (yo la habia probado pero solo me funcionaba cuando cambiaba de fila no de columna) supongo que oBrw:lColChangeNotify := .t. hace que también funciona para columnas.

Si veis la foto superior vereis que lo que cambio son unas variables que representan información de la celda, encima del array.

Cuando encuentra los datos en el fichero lo refrescar bien y todo funciona ok.

Pero cuando entra en una celda que no tiene valor, le asigno valores de "" a la variables y al refrescar me da el siente error.Estoy haciendo todo tipo de pruebas pero no consigo nada.
¿Alguna ayuda? por favor . Gracias.Si quito el refresco funciona bien pero claro no me refresca los valores a espacio en blanco

Code: Select all  Expand view
DEFINE DIALOG oDDATOS RESOURCE "FOLDER" TITLE " " OF oApp:aMod[20]:oWnd

 REDEFINE get gvfcliente  Var vfcliente  ID 102 of oDDATOS when lsay
 REDEFINE get gvfnombre   Var vfnombre   ID 103 of oDDATOS when lsay
 REDEFINE get gvfarticulo Var vfarticulo ID 104 of oDDATOS when lsay
 REDEFINE get gvfdetalle  Var vfdetalle  ID 105 of oDDATOS when lsay
 REDEFINE get gvfcantidad Var vfcantidad ID 106 of oDDATOS when lsay


  VASCII:= 65
  for i:=1 to vcolumnas+1
          if i = 1
         AADD(V_Header," ")
         AADD(V_Colsize,50)
      ELSE
         AADD(V_Header,chr(VASCII++))
         AADD(V_Colsize,100)
      endif
  next i

vllenandofilas:='space(10)'
for i:= 2 to vcolumnas
    vllenandofilas:=vllenandofilas+',space(10)'
next i

for i:=vfilas to 1 step -1
    aadd(tfilas,{transform(i,"999"),&vllenandofilas})
 next i
    area:=select()
    cdestant := OpenDbf(fdestant,1, , , , kdestant,"DBFCDX")
   (cdestant)->(DbSetOrder(1))
   (cdestant)->(Dbgotop())
    acdestan:=select()
    dbseek(vestanteria)
    do while !eof() .and. (cdestant)->estanteria = vestanteria
        tfilas[(cdestant)->fila,(cdestant)->columna]:= (cdestant)->articulo
       dbskip()
    enddo
    (cdestant)->(Dbclosearea())
    select(area)

 REDEFINE XBROWSE oBrwt ID 101 autocols;
    HEADERS V_Header ;
    SIZES  V_ColSize ;
    ARRAY tfilas CELL LINES of oDDATOS
            WITH OBJECT oBrwt
             :bRClicked:= {|| borrararticulo(tfilas,oBrwt,0,vestanteria) }
             :bLDblClick := {|| buscararticulo(tfilas,oBrwt,0) }
             :bKeychar := {|nkey| iif(nkey=13 .and. oBrwt:nColSel > 1,buscararticulo(tfilas,oBrwt,0),)}
             :lColChangeNotify := .t.
             :bChange := { |oBrwt| refrescardatos(vestanteria,oBrwt,0)}
             :nFreeze:=1
             :lFullGrid  := .t.
           END


   REDEFINE BTNBMP ID 500  RESOURCE "ACEPTAR" OF oddatos ;
            ACTION (lSalva:=.t. , oddatos:End());
            MESSAGE "Guardar cambios y salir del catalogo" ;
            WHEN ( Acceso(oApp:aUsuarios,"ESTANTER", nActua ) )

   REDEFINE BTNBMP ID 501  RESOURCE "SALIR" OF oddatos ACTION (lSalva := falso, oddatos:End()) ;
            MESSAGE "Salir de Estanteria"


 ACTIVATE DIALOG oDDATOS CENTER  ON INIT oBrwT:SetFocus()
 

Code: Select all  Expand view
static function refrescardatos(vestanteria,oBrw,vprofundo)

    area:=select()
    cdestant := OpenDbf(fdestant,1, , , , kdestant,"DBFCDX")
   (cdestant)->(DbSetOrder(1))
   (cdestant)->(Dbgotop())
    acdestan:=select()
    if vprofundo = 0

      (cdestant)->(dbseek(vestanteria+transform(oBrw:nRowSel,"9999")+transform(oBrw:nColSel,"9999")+transform(1,"9999")))

      if found()
         vfcliente:= (cdestant)->cliente
         vfnombre := (cdestant)->nombre
         vfarticulo:=(cdestant)->articulo
         vfdetalle:=(cdestant)->detalle
         vfcantidad:=(cdestant)->cantidad

      else
         vfcliente:= ""
         vfnombre := ""
         vfarticulo:=""
         vfdetalle:=""
         vfcantidad:=""
      endif
        gvfcliente:refresh()
        gvfnombre:refresh()
        gvfarticulo:refresh()
        gvfdetalle:refresh()
        gvfcantidad:refresh()

   endif

   (cdestant)->(Dbclosearea())
    select(area)

return nil
 


Error :
Error description: Error BASE/1073 Error de argumento: <
Args:
[ 1] = C
[ 2] = N 0

Stack Calls
===========
Called from: ../../../tget.prg => TCLIPGET:PUTMASK(0)
Called from: ../../../tget.prg => TCLIPGET:UPDATEBUFFER(0)
Called from: .\source\classes\TGET.PRG => (b)TGET(161)
Called from: .\source\classes\TGET.PRG => TGET:REFRESH(0)
Called from: .\estanter.PRG => REFRESCARDATOS(0)
Called from: .\estanter.PRG => (b)ESTANTERIADATOS(0)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:CHANGE(1274)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:GORIGHT(2785)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYDOWN(2362)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1733)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(12964)
Called from: .\window.PRG => _FWH(0)
Called from: => DIALOGBOX(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(293)
Called from: .\estanter.PRG => ESTANTERIADATOS(0)
Called from: .\estanter.PRG => (b)ESTANTER(0)
Called from: .\jose.PRG => (b)CODBROWSE_NEW(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK(638)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP(872)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1723)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(1705)
Called from: .\window.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\window.PRG => TMDIFRAME:ACTIVATE(0)
Called from: .\planman.PRG => MAIN(0)
Saludos,
Regards,

Jose Luis Alepuz
joseluis@mancomputer.com
www.mancomputer.com
Garbi
 
Posts: 291
Joined: Wed Nov 02, 2005 3:28 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests