FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour XBrowse - SetCheck
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
XBrowse - SetCheck
Posted: Sun Apr 14, 2013 05:44 PM
Buenas tardes
No consigo poder editar un checkbox en el xbrowse con un array en el que la columna puede coger valores .T. o .F.
He estado mirando los ejemplos que aparecen en el foro pero no llego a hacer que funcione.
Adjunto codigo
Agradeceria cualquier ayuda..
Gracias
Code (fw): Select all Collapse
function BuildBrwPrgs( oFld )
local oCheck
local lOn 聽 聽 := .F.

// Estructura del Array de Datos
// static aPrgs 聽 聽 聽:= { { "", "", "", "" , .F. } }

聽 聽@ 0, 0 XBROWSE oBrwPrgs ARRAY aPrgs SIZE 300, 180 PIXEL OF oFld:aDialogs[ 1 ] ;
聽 聽 聽 聽 聽 FONT oFont //CELL

聽 聽ADD oCheck TO oBrwPrgs HEADER "S" 聽 聽DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 5 ] SIZE 聽18 //CENTER
聽 聽oCheck:SetCheck( nil , .T. , 聽) 聽 //{"Si","No",""} )
聽 聽//oBrwPrgs:aCols[ 1 ]:aEditListBound:= { .T. , .F. }


聽 聽ADD TO oBrwPrgs HEADER "Nombre" 聽 聽 聽DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 1 ] SIZE 280 //CENTER
聽 聽ADD TO oBrwPrgs HEADER "Size" 聽 聽 聽 聽DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 2 ] SIZE 聽80 RIGHT
聽 聽ADD TO oBrwPrgs HEADER "Fecha" 聽 聽 聽 DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 3 ] SIZE 聽80 CENTER
聽 聽ADD TO oBrwPrgs HEADER "Descripcion" DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 4 ] SIZE 300 //CENTER


聽 聽oBrwPrgs:nMarqueeStyle = MARQSTYLE_HIGHLROW 聽//CELL 聽 聽 聽//HIGHLROW
聽 聽oBrwPrgs:nRowHeight 聽 聽= 18
聽 聽oBrwPrgs:bClrSel 聽 聽 聽 = { || { CLR_WHITE, CLR_BLUE } }
聽 聽oBrwPrgs:lFooter 聽 聽 聽 = .T.

聽 聽oBrwPrgs:aCols[ 2 ]:cFooter 聽 聽 = "Total Ficheros: " + ;
聽 聽 聽 聽 聽 聽 if( empty( aPrgs[1][1] ), " 聽 0" , Str( Len( oBrwPrgs:aArrayData ) , 4 ) )


聽 聽//oBrwPrgs:lFastEdit 聽 聽 聽 聽 聽 聽 聽= .T.
聽 聽oBrwPrgs:aCols[ 5 ]:nEditType 聽 = EDIT_GET 聽 聽 // LISTBOX
聽 聽//oBrwPrgs:aCols[ 5 ]:bOnPostEdit = { | o, v | aPrgs[ oBrwPrgs:nArrayAt ][ 4 ] := v }

聽 聽oBrwPrgs:CreateFromCode()

聽 聽oFld:aDialogs[ 1 ]:SetControl( oBrwPrgs )

return oBrwPrgs
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: XBrowse - SetCheck
Posted: Mon Apr 15, 2013 02:19 AM
Asi lo hago y me funciona al 100%, primero defino el array asi LOCAL aDepositos := {} y luego el xbrowse con una funcion que hice para el tilde o destilde del checkbox, espero te sirva aunque sea de guia, saludos... :-)

Code (fw): Select all Collapse
   oBrwChq := TXBrowse():New( oFldx:aDialogs[2] )

   WITH OBJECT oBrwChq
      :nMarqueeStyle    := MARQSTYLE_HIGHLROW
      :nColDividerStyle := LINESTYLE_BLACK
      :lColDividerComplete := .t.
      :nHeaderHeight := 20
      :l2007 := .t.
      :lFooter := .t.
      :lRecordSelector := .t. // SI/NO 1RA.COL.IZQ.QUE TIENE LA FLECHITA NEGRA
      :lAllowColHiding := .f. // SI/NO BOTON DERECHO SOBRE CABEZERA, MUESTRE ARRAY COL.
      :lAllowColSwapping := .f. // SI/NO INTERCAMBIAR COL.
      :bClrStd := {|| IF( oBrwChq:nArrayAt % 2 == 0, {CLR_BLACK, CLR_WHITE}, {0, RGB(203,226,254)} ) }

      :bLDblClick := {|| tildacheque( aVar, aGet, oBrwChq ) } // DOBLE CLICK

      :bKeyDown= {|nKey| IF ( nKey  == VK_RETURN .or. nKey == VK_SPACE ,; // ENTER o ESPACIO
                              tildacheque( aVar, aGet, oBrwChq ),  ) }

   END WITH


columna del checkbox

oCol := oBrwChq:AddCol()
   oCol:cHeader       := "Sel"
   oCol:bStrData      := {|| IIF( LEN( aDepositos ) == 0, SPACE(5) ,;
                                  aDepositos[oBrwChq:nArrayAt, 6] ) }
   oCol:nHeadStrAlign := AL_CENTER
   oCol:nDataStrAlign := AL_CENTER
   oCol:nWidth        := 20
   oCol:nArrayCol     := 6
   oCol:cToolTip      := "Doble Click/ENTER/ESPACIO para marcar o descargar CHEQUE."
   oCol:SetCheck( { "OK16", } ) // ACA LLAMO UNA IMAGEN QUE ESTA EN RECURSO...

   oBrwChq:CreateFromResource(99)
   oBrwChq:SetArray( aDepositos, .t. )


la funcion tildacheque()

PROCEDURE tildacheque( aVar, aGet, oBrwChq ) // MARCA/DESCARCA CHEQUES A DEPOSITAR

   IF LEN( oBrwChq:aArrayData ) > 0

      IF oBrwChq:aArrayData[oBrwChq:nArrayAt, 6] == .f.
         oBrwChq:aArrayData[oBrwChq:nArrayAt, 6] := .t.

         aVar[11] := aVar[11] + oBrwChq:aArrayData[oBrwChq:nArrayAt, 5]

      ELSE
         oBrwChq:aArrayData[oBrwChq:nArrayAt, 6] := .f.

         aVar[11] := aVar[11] - oBrwChq:aArrayData[oBrwChq:nArrayAt, 5]

      ENDIF

   ENDIF

   aVar[12] := aVar[10] + aVar[11] // TOT.DEPOSITAR

   aGet[11]:REFRESH() // MTO.CHEQUES
   aGet[12]:REFRESH() // TOT.DEPOSITAR

   oBrwChq:REFRESH()

RETURN
Dios no est谩 muerto...



Gracias a mi Dios ante todo!
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: XBrowse - SetCheck
Posted: Mon Apr 15, 2013 07:50 PM
Jose Luis
Muchas gracias por tu ejemplo
Mi error estaba en que por lo que "cre铆a" haber le铆do en el foro (ingl茅s), el funcionamiento de la edici贸n de ese tipo de columna era "autom谩tico" y no necesitaba programarlo al igual que se hace con cualquier edici贸n "especial" que hacemos en otras columnas (p.j. de validaci贸n o c谩lculo).
Para eso pensaba que serv铆a: oBrwPrgs:aCols[ 1 ]:aEditListBound:= { .T. , .F. }

Por otra parte, he notado que cuando hago "dobleclick" o "SPACE" estando posicionado en la columna del CheckBox, no me cambia, sin embargo si estoy en la 2 columna si funciona, pulse donde pulse incluso en el recordselector, con el SPACE, funciona siempre que no est茅 situado en la columna del Check, como he comentado.
Puede ser mi versi贸n de 12.03 ?, creo que hab铆a le铆do algo en el foro de ingl茅s aunque ya no me f铆o de mi traducci贸n.
As铆 me ha quedado:
Code (fw): Select all Collapse
聽 聽ADD oCheck TO oBrwPrgs HEADER "S" 聽 聽DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 5 ] SIZE 聽18 //CENTER
聽 聽oCheck:SetCheck( nil , .T. , 聽) 聽 //{"Si","No",""} )
聽 聽//oBrwPrgs:aCols[ 1 ]:aEditListBound:= { .T. , .F. }

聽 聽ADD TO oBrwPrgs HEADER "Nombre" 聽 聽 聽DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 1 ] SIZE 280 //CENTER
聽 聽ADD TO oBrwPrgs HEADER "Size" 聽 聽 聽 聽DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 2 ] SIZE 聽80 RIGHT
聽 聽ADD TO oBrwPrgs HEADER "Fecha" 聽 聽 聽 DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 3 ] SIZE 聽80 CENTER
聽 聽ADD TO oBrwPrgs HEADER "Descripcion" DATA oBrwPrgs:aArrayData[ oBrwPrgs:nArrayAt ][ 4 ] SIZE 300 //CENTER


聽 聽oBrwPrgs:nMarqueeStyle := MARQSTYLE_HIGHLROW 聽//CELL 聽 聽 聽//HIGHLROW
聽 聽oBrwPrgs:nRowHeight 聽 聽:= 18
聽 聽oBrwPrgs:bClrSel 聽 聽 聽 := { || { CLR_WHITE, CLR_BLUE } }
聽 聽oBrwPrgs:lFooter 聽 聽 聽 := .T.
聽 聽oBrwPrgs:bLDblClick 聽 聽:= {|| ChangeCheck( oBrwPrgs, 聽) } // DOBLE CLICK
聽 聽oBrwPrgs:bKeyDown 聽 聽 聽:= {|nKey| if ( nKey == VK_SPACE ,; // Solo ESPACIO
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽ChangeCheck( oBrwPrgs, 聽), 聽) }


Code (fw): Select all Collapse
Function ChangeCheck( oBrw , nCol )
//? oBrw:nRowSel, oBrw:nColSel
nCol 聽 := if( empty( nCol ), 1 , nCol )

//if oBrw:lRecordSelector
// 聽 nCol++
//endif
//if oBrw:nColSel = nCol
聽 聽if Len( oBrw:aArrayData ) > 0
聽 聽 聽 if oBrw:aArrayData[oBrw:nArrayAt, 5] == .F.
聽 聽 聽 聽 聽oBrw:aArrayData[oBrw:nArrayAt, 5] := .T.
聽 聽 聽 else
聽 聽 聽 聽 聽oBrw:aArrayData[oBrw:nArrayAt, 5] := .F.
聽 聽 聽 endif
聽 聽 聽 oBrw:Refresh()
聽 聽endif
//endif
Return nil


Gracias de nuevo y un saludo
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse - SetCheck
Posted: Mon Apr 15, 2013 09:01 PM
Above code can be simplified as:
Code (fw): Select all Collapse
@ 0,0 XBROWSE oBrwPrgs SIZE 300,180 PIXEL OF oFld:aDialogs[ 1 ] ;
聽 聽ARRAY aPrgs ;
聽 聽COLUMNS 5, 1, 2, 3, 4 ;
聽 聽HEADERS "S", "Nombre", "Size", "Fetcha", "Description" ;
聽 聽COLSIZES 18, 260, 80, 80, 300 ;
聽 聽JUSTIFY 聽AL_CENTER, nil, AL_RIGHT, AL_CENTER ;
聽 聽FOOTERS LINES NOBORDER
聽 聽
WITH OBJECT oBrwPrgs
聽 聽:s:SetCheck( nil, .f. )
聽 聽:Nombre:bFooter 聽 := { || "Total Ficheros: " + LTrim( Str( oBrwPrgs:nLen ) ) }
聽 聽:nMarqueeStyle 聽 聽:= MARQSTYLE_HIGHLROW
聽 聽:nRowHeight 聽 聽 聽 := 18
聽 聽:bClrSel 聽 聽 聽 聽 聽:= { || { CLR_WHITE, CLR_BLUE } }
   :bLDblClick       := { || If( oBrwPrgs:nLen > 0, oBrwPrgs:S:VarPut( ! oBrwPrgs:S:Value ), nil ) }
   :bKeyDown         := { |nKey| if ( nKey == VK_SPACE .and. oBrwPrgs:nLen > 0, ;
                           oBrwPrgs:S:VarPut( ! oBrwPrgs:S:Value ), nil ) }
聽 聽//
聽 聽:CreateFromCode()
END
Regards



G. N. Rao.

Hyderabad, India
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: XBrowse - SetCheck
Posted: Mon Apr 15, 2013 09:47 PM
Mr. Rao, its code is fabulous
Excuse my poor English (google translator)
But, when I press SPACE while the CheckBox column, I get the following error:

Code (fw): Select all Collapse
聽 聽Time from start: 0 hours 0 mins 26 secs 
聽 聽Error occurred at: 15/04/2013, 23:36:08
聽 聽Error description: Error BASE/1004 聽Message not found: NIL:SELECTALL
聽 聽Args:
聽 聽 聽[ 聽 1] = U 聽 

Stack Calls
===========
聽 聽Called from: 聽=> __ERRRT_SBASE( 0 )
聽 聽Called from: ../../../tobject.prg => NIL:ERROR( 0 )
聽 聽Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
聽 聽Called from: ../../../tobject.prg => NIL:MSGNOTFOUND( 0 )
聽 聽Called from: ../../../tobject.prg => NIL:SELECTALL( 0 )
聽 聽Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:EDIT( 10618 )
聽 聽Called from: vmh.prg => (b)BUILDSOURCE( 580 )
聽 聽Called from: .\source\classes\WINDOW.PRG => TWINDOW:KEYDOWN( 2616 )
聽 聽Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYDOWN( 1019 )
聽 聽Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYDOWN( 2201 )
聽 聽Called from: .\source\classes\WINDOW.PRG => TWINDOW:KEYDOWN( 2620 )
聽 聽Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYDOWN( 1019 )
聽 聽Called from: .\source\classes\TGET.PRG => TGET:KEYDOWN( 1016 )
聽 聽Called from: 聽=> TWINDOW:HANDLEEVENT( 0 )
聽 聽Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1700 )
聽 聽Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 579 )
聽 聽Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
聽 聽Called from: 聽=> DIALOGBOXINDIRECT( 0 )
聽 聽Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
聽 聽Called from: vmh.prg => MAIN( 223 )
Variables in use
================
聽 聽Procedure 聽 聽 Type 聽 Value
聽 聽==========================
聽 聽__ERRRT_SBASE
聽 聽 聽Param 聽 1: 聽 聽O 聽 聽Class: ERROR
聽 聽NIL:ERROR
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽13
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽1004
聽 聽 聽Param 聽 3: 聽 聽C 聽 聽"Message not found"
聽 聽 聽Param 聽 4: 聽 聽C 聽 聽"NIL:SELECTALL"
聽 聽 聽Param 聽 5: 聽 聽N 聽 聽1
聽 聽 聽Param 聽 6: 聽 聽U 聽 聽
聽 聽 聽Local 聽 1: 聽 聽U 聽 聽
聽 聽 聽Local 聽 2: 聽 聽U 聽 聽
聽 聽(b)HBOBJECT
聽 聽 聽Param 聽 1: 聽 聽C 聽 聽"Message not found"
聽 聽 聽Param 聽 2: 聽 聽C 聽 聽"NIL"
聽 聽 聽Param 聽 3: 聽 聽C 聽 聽"SELECTALL"
聽 聽 聽Param 聽 4: 聽 聽N 聽 聽1004
聽 聽NIL:MSGNOTFOUND
聽 聽 聽Param 聽 1: 聽 聽U 聽 聽
聽 聽 聽Param 聽 2: 聽 聽C 聽 聽"SELECTALL"
聽 聽NIL:SELECTALL
聽 聽 聽Param 聽 1: 聽 聽C 聽 聽"SELECTALL"
聽 聽TXBRWCOLUMN:EDIT
聽 聽(b)BUILDSOURCE
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽32
聽 聽 聽Local 聽 1: 聽 聽O 聽 聽Class: TXBRWCOLUMN
聽 聽 聽Local 聽 2: 聽 聽A 聽 聽Len: 聽 聽2
聽 聽 聽Local 聽 3: 聽 聽L 聽 聽.T.
聽 聽 聽Local 聽 4: 聽 聽C 聽 聽""
聽 聽 聽Local 聽 5: 聽 聽N 聽 聽76
聽 聽 聽Local 聽 6: 聽 聽N 聽 聽25
聽 聽 聽Local 聽 7: 聽 聽N 聽 聽14
聽 聽 聽Local 聽 8: 聽 聽N 聽 聽14
聽 聽 聽Local 聽 9: 聽 聽N 聽 聽4
聽 聽 聽Local 聽10: 聽 聽N 聽 聽2081424959
聽 聽 聽Local 聽11: 聽 聽L 聽 聽.T.
聽 聽 聽Local 聽12: 聽 聽L 聽 聽.F.
聽 聽 聽Local 聽13: 聽 聽O 聽 聽Class: TFONT
聽 聽TWINDOW:KEYDOWN
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽3735553
聽 聽TCONTROL:KEYDOWN
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽3735553
聽 聽 聽Local 聽 1: 聽 聽U 聽 聽
聽 聽TXBROWSE:KEYDOWN
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽3735553
聽 聽 聽Local 聽 1: 聽 聽U 聽 聽
聽 聽TWINDOW:KEYDOWN
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽3735553
聽 聽 聽Local 聽 1: 聽 聽U 聽 聽
聽 聽TCONTROL:KEYDOWN
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽3735553
聽 聽 聽Local 聽 1: 聽 聽U 聽 聽
聽 聽TGET:KEYDOWN
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽3735553
聽 聽 聽Local 聽 1: 聽 聽U 聽 聽
聽 聽TWINDOW:HANDLEEVENT
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽3735553
聽 聽 聽Local 聽 1: 聽 聽O 聽 聽Class: TGET
聽 聽 聽Local 聽 2: 聽 聽U 聽 聽
聽 聽 聽Local 聽 3: 聽 聽U 聽 聽
聽 聽 聽Local 聽 4: 聽 聽U 聽 聽
聽 聽 聽Local 聽 5: 聽 聽N 聽 聽-1
聽 聽 聽Local 聽 6: 聽 聽U 聽 聽
聽 聽TCONTROL:HANDLEEVENT
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽256
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 3: 聽 聽N 聽 聽3735553
聽 聽TGET:HANDLEEVENT
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽256
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 3: 聽 聽N 聽 聽3735553
聽 聽 聽Local 聽 1: 聽 聽U 聽 聽
聽 聽_FWH
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽256
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 3: 聽 聽N 聽 聽3735553
聽 聽 聽Local 聽 1: 聽 聽U 聽 聽
聽 聽DIALOGBOXINDIRECT
聽 聽 聽Param 聽 1: 聽 聽N 聽 聽3735553
聽 聽 聽Param 聽 2: 聽 聽N 聽 聽256
聽 聽 聽Param 聽 3: 聽 聽N 聽 聽32
聽 聽 聽Param 聽 4: 聽 聽N 聽 聽3735553
聽 聽 聽Param 聽 5: 聽 聽N 聽 聽126
聽 聽 聽Local 聽 1: 聽 聽O 聽 聽Class: TGET
.../...

Pressing SPACE or doubleclick on any column other than the checkbox on the editing get the letter [F] or [T] and not bitmap .
Use the version 3.12
Thanks for your interest[
greetings
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: XBrowse - SetCheck
Posted: Tue Apr 16, 2013 12:40 AM

A mi me hace el cambio ubicado en cualquier columna, sean pulsando ESPACIO, DOBLE CLICK, etc...voy probar la opcion de nageswaragunupudi haber que tal, saludos... :shock:

Dios no est谩 muerto...



Gracias a mi Dios ante todo!
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse - SetCheck
Posted: Tue Apr 16, 2013 03:58 AM

Mr Cnavarro

I am sorry for the mistake. I have edited and made corrections to the code above.
I changed :setcheck(), :bLDClick and :bKeyDown.
Please copy the code again and try. I tested this and it works.

Regards



G. N. Rao.

Hyderabad, India
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: XBrowse - SetCheck
Posted: Tue Apr 16, 2013 10:32 AM
joseluisysturiz wrote:A mi me hace el cambio ubicado en cualquier columna, sean pulsando ESPACIO, DOBLE CLICK, etc...voy probar la opcion de nageswaragunupudi haber que tal, saludos... :-)

Jose luis
Que version de FWH est谩s usando?
Gracias
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: XBrowse - SetCheck
Posted: Wed Apr 17, 2013 06:27 PM
nageswaragunupudi wrote:Mr Cnavarro

I am sorry for the mistake. I have edited and made corrections to the code above.
I changed :setcheck(), :bLDClick and :bKeyDown.
Please copy the code again and try. I tested this and it works.


Mr. Rao
Funciona Ok las modificaciones que ha realizado
Mis preguntas:
Por que ha cambiado SetCheck( nil, .F. ) ?
C贸mo puedo editar solamente la columna Descripcion con Enter o Doubleclick?

Muchas gracias por su ayuda y su tiempo


Mr. Rao
Works Ok the changes you have made
My questions:
What has changed SetCheck (nil,. F.)?
How I can edit only the Description column with Enter or Doubleclick?

Thank you very much for your help and your time
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse - SetCheck
Posted: Thu Apr 18, 2013 02:37 AM
Using oCol:CheckToggle() method is a much simpler way to toggle the logical value.
I show the use of it in the revised sample at the end.

What has changed SetCheck (nil,. F.)?


When second parameter is set to .t. , the columns :nEditType is automatically set to EDIT_GET. I disabled it because anyway we are toggling the value directly.
But it is desirable to keep it .T. and I restored it now. oCol:CheckToggle() works only when this is set to .t.


How I can edit only the Description column with Enter or Doubleclick?


Just enable edit of Description column.
Code (fw): Select all Collapse
oBrwPrgs:Description:nEditType := EDIT_GET

You can edit the column with Enter or Double Click when the user is on this cell.
Double click on the column overrides global double click.

Because you are highlighting the entire row, the user does not know which column is selected. For this add this line:
Code (fw): Select all Collapse
 聽 oBrwPrgs:bClrRowFocus 聽 聽 := { || { CLR_BLACK, RGB( 120,210,255 ) } }


Now the full code:
Code (fw): Select all Collapse
 聽 local oDlg, oFont, oBrwPrgs
聽 聽local aPrgs

聽 聽aPrgs := { ;
聽 聽 聽 { "One", "Two", "Three", "Four", .t. }, ;
聽 聽 聽 { "Five", "Six", "Seven", "Eight", .f. } }

聽 聽DEFINE DIALOG oDlg SIZE 620,400 PIXEL


@ 0,0 XBROWSE oBrwPrgs SIZE 300,180 PIXEL OF oFld:aDialogs[ 1 ] ;
聽 聽ARRAY aPrgs ;
聽 聽COLUMNS 5, 1, 2, 3, 4 ;
聽 聽HEADERS "S", "Nombre", "Size", "Fetcha", "Description" ;
聽 聽COLSIZES 18, 150, 70, 70, 300 ;
聽 聽JUSTIFY 聽AL_CENTER, nil, AL_RIGHT, AL_CENTER ;
聽 聽FOOTERS LINES NOBORDER

WITH OBJECT oBrwPrgs
聽 聽:s:SetCheck( nil, .t. )
聽 聽:Description:nEditType := EDIT_GET
聽 聽:Nombre:bFooter 聽 := { || "Total Ficheros: " + LTrim( Str( oBrwPrgs:nLen ) ) }
聽 聽:nMarqueeStyle 聽 聽:= MARQSTYLE_HIGHLROW
聽 聽:bClrRowFocus 聽 聽 := { || { CLR_BLACK, RGB( 120,210,255 ) } }
聽 聽:nRowHeight 聽 聽 聽 := 18
聽 聽:bClrSel 聽 聽 聽 聽 聽:= { || { CLR_WHITE, CLR_BLUE } }
聽 聽:bLDblClick 聽 聽 聽 := { || If( oBrwPrgs:nLen > 0, oBrwPrgs:S:CheckToggle(), nil ) }
聽 聽:bKeyDown 聽 聽 聽 聽 := { |nKey| if ( nKey == VK_SPACE .and. oBrwPrgs:nLen > 0, 聽oBrwPrgs:S:CheckToggle(), nil ) }聽 聽 聽  聽 聽//
聽 聽:CreateFromCode()
END
Regards



G. N. Rao.

Hyderabad, India
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: XBrowse - SetCheck
Posted: Sun Apr 21, 2013 08:20 PM
Buenas noches Mr. Rao
He estado probando el codigo que ha enviado y funciona OK, muchas gracias
No he podido probar el cambio de Font al editar la columna, no funciona

Adjunto el codigo que he usado, y en el que al ejecutar obtengo el siguiente error:
Le agradezco de antemano cualquier ayuda.
Code (fw): Select all Collapse
function HazElBrw( oFld , nDlg , aArray )
Local oBrw

聽@ 0,0 XBROWSE oBrw SIZE 300,180 PIXEL OF oFld:aDialogs[ nDlg ] ;
聽 聽ARRAY aArray ;
聽 聽COLUMNS 5, 1, 2, 3, 4 ;
聽 聽HEADERS "S", "Nombre", "Size", "Fecha", "Descripcion" ;
聽 聽COLSIZES 20, 280, 80, 80, 304 ;
聽 聽JUSTIFY 聽AL_CENTER, nil, AL_RIGHT, AL_CENTER , nil ;
聽 聽FOOTERS NOBORDER 聽 聽 //LINES

聽 聽WITH OBJECT oBrw

聽 聽 聽 :nombre:nHeadStrAlign 聽 聽 聽:= AL_CENTER
聽 聽 聽 :size:nHeadStrAlign 聽 聽 聽 聽:= AL_CENTER
聽 聽 聽 :fecha:nHeadStrAlign 聽 聽 聽 := AL_CENTER
聽 聽 聽 :descripcion:nHeadStrAlign := AL_CENTER

聽 聽 聽 :s:SetCheck( nil, .T. )
聽 聽 聽 
聽 聽 聽 :l2007 聽 聽 聽 聽 聽 聽:= .F.
聽 聽 聽 :nMarqueeStyle 聽 聽:= MARQSTYLE_HIGHLROW
聽 聽 聽 :nRowHeight 聽 聽 聽 := 18
聽 聽 聽 :bClrSel 聽 聽 聽 聽 聽:= { || { CLR_WHITE, CLR_BLUE } }
聽 聽 聽 :bClrRowFocus 聽 聽 := { || { CLR_BLACK, RGB( 120,210,255 ) } }
聽 聽 聽 :bLDblClick 聽 聽 聽 := { || If( oBrw:nLen > 0, oBrw:S:CheckToggle(), nil ) }
聽 聽 聽 :bKeyDown 聽 聽 聽 聽 := { |nKey| if ( nKey == VK_SPACE .and. oBrw:nLen > 0,;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽oBrw:S:CheckToggle(), nil ) }

聽 聽 聽 :Nombre:nEditype 聽 := 5 //EDIT_GET_BUTTON 聽 聽 聽//EDIT_BUTTON 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 <strong>// Linea ERROR </strong>
聽 聽 聽 :Nombre:bEditBlock := { || MsgInfo("Ok","Accion") }
聽 聽 聽 :Nombre:bFooter 聽 := { || "Total Ficheros: " + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽IF( !empty( oBrw:aArrayData[ oBrw:nArrayAt ][ 1 ] ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽LTrim( Str( oBrw:nLen ) ) , " 0" ) }
聽 聽 聽 
聽 聽 聽 :Descripcion:nEditType 聽 聽:= EDIT_GET
聽 聽 聽 :Descripcion:cEditPicture := "@!"
聽 聽 聽 :Descripcion:bClrEdit 聽 聽 := { || { CLR_BLUE , CLR_WHITE } }
聽 聽 聽 :Descripcion:oEditFont := OClone( oFontEdt )

聽 聽 聽 :CreateFromCode()

聽 聽END

聽 聽oFld:aDialogs[ nDlg ]:SetControl( oBrw )

Return oBrw


Este es el error en tiempo de ejecucion
Code (fw): Select all Collapse
聽 聽Time from start: 0 hours 0 mins 0 secs 
聽 聽Error occurred at: 21/04/2013, 21:52:45
聽 聽Error description: Error BASE/1005 聽Message not found: TXBRWCOLUMN:_NEDITYPE
聽 聽Args:
聽 聽 聽[ 聽 1] = O 聽 TXBRWCOLUMN

Stack Calls
===========
聽 聽Called from: 聽=> __ERRRT_SBASE( 0 )
聽 聽Called from: ../../../tobject.prg => TXBRWCOLUMN:ERROR( 0 )
聽 聽Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
聽 聽Called from: ../../../tobject.prg => TXBRWCOLUMN:MSGNOTFOUND( 0 )
聽 聽Called from: ../../../tobject.prg => TXBRWCOLUMN:_NEDITYPE( 0 )
聽 聽Called from: vmh.prg => HAZELBRW( 586 )
聽 聽Called from: vmh.prg => MAIN( 202 )

Gracias y un saludo

Good evening Mr. Rao
I've been testing the code you sent and it works OK, thank you very much
I could not test the change of Font when editing the column does not work

Attached the code I've used, and in which the run I get the following error
I thank you in advance for any help.

Thanks and regards
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse - SetCheck
Posted: Mon Apr 22, 2013 09:29 AM
In this line
Code (fw): Select all Collapse
     :Nombre:nEditype   := 5 //EDIT_GET_BUTTON      //EDIT_BUTTON

it should be :nEditType
not
:nEditype
Regards



G. N. Rao.

Hyderabad, India
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: XBrowse - SetCheck
Posted: Mon Apr 22, 2013 04:55 PM

Thanks
Excuse the error.
There are days that we should not take the computer
We have before the error, look a hundred times and do not see
A greeting

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse - SetCheck
Posted: Mon Apr 22, 2013 04:57 PM
We have before the error, look a hundred times and do not see

This happens to all of us.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion