Editar celda xBrowse

Editar celda xBrowse

Postby JoseAlvarez » Fri Oct 22, 2021 2:29 am

Saludos,

Tengo este pequeño codigo de prueba con xBrowse

Code: Select all  Expand view
  REDEFINE XBROWSE oBrw Id 10  DATASOURCE oArticulos             ;
                                FIELDS     oArticulos:descripcion ;
                                HEADERS    "Descripcion"          ;
                                FIELDSIZES  350                   ;
                                JUSTIFY     AL_LEFT               ;
                                CELL LINES                        ;
                                of oDlg_Articulos  
                                WITH object oBrw
                                        oBrw :l2007           := .t.                        
                                        oBrw :lRecordSelector := .t.                        
                                        oBrw :aCols[1]        :nHeadStrAlign := AL_CENTER  
                                        oBrw :aCols[1]        :oHeaderFont   := oFontHeader  
                                        oBrw :oDataFonts      :=oFontData                    
                                END
                                oArticulos:Gotop()
                                oBrw:Refresh()
 


Quiero poder Editar y Cambiar el Valor de cualquier celda de esa columna,

¿Que debo Hacer?

¿ese cambio afecta la tabla directamente o actua sobre el arreglo resultado de la consulta?

Necesito que NO afecte la tabla directamente. Discupen la pregunta, pero no se como actua xBowse en esos casos
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 728
Joined: Sun Nov 09, 2014 5:01 pm

Re: Editar celda xBrowse

Postby leandro » Fri Oct 22, 2021 11:32 am

Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Editar celda xBrowse

Postby cnavarro » Fri Oct 22, 2021 12:30 pm

Creo que con esto te servirá
Code: Select all  Expand view

     oCol:nEditType := EDIT_GET
 

aunque seguramente tendrás que añadir también en la definición del xbrowse la clausula FASTEDIT
Una vez que puedas editar, tendrás que aplicar algunas de las acciones que te comenta el compañero Leandro en el post anterior
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
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Editar celda xBrowse

Postby JoseAlvarez » Fri Oct 22, 2021 3:54 pm

Leandro, Cristobal,

Listo amigos, ya lo hice andar,

Gracias a Ambos.

Decidi ya dejar la twbrowse del amigo cecarelli, la cual me acompaño por muchos años y pasarme a xBrowse, asi que los estare molestando con algunas cosillas mas...

Muchas gracias por su ayuda.
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 728
Joined: Sun Nov 09, 2014 5:01 pm

Re: Editar celda xBrowse

Postby nageswaragunupudi » Thu Oct 28, 2021 1:17 am

Recommended:

Code: Select all  Expand view

REDEFINE XBROWSE oBrw Id 10 ;
   OF oDlg_Articulos ;
   DATASOURCE oArticulos ;
   COLUMNS "Descripcion" ; //FIELDS oArticulos:descripcion HEADERS "Descripcion"          ;
   FIELDSIZES  350 ; // JUSTIFY AL_LEFT
   FONT oFontData ;
   CELL LINES ;
   FASTEDIT // optional

   WITH object oBrw
      // :l2007            := .t.
      // :lRecordSelector  := .t.
      WITH OBJECT :aCols[ 1 ]
         :nHeadStrAlign := AL_CENTER
         :oHeaderFont   := oFontHeader
         :nEditType     := EDIT_GET   //
      END
   END
   oArticulos:Gotop()
   // oBrw:Refresh() // remove this line
   ACTIVATE DIALOG oDlg_Atriculos
 


1) Do not use FIELDS clause. Use COLUMNS clause. In the COLUMNS clause, provide the names of the fields as strings.
2) Do not use bStrData and bOnPostEdit. Their usage was deprecated many years ago.


Quiero poder Editar y Cambiar el Valor de cualquier celda de esa columna,
¿Que debo Hacer?

English:
I want to be able to Edit and Change the Value of any cell in that column, What should I do?

This is enough.
Code: Select all  Expand view

oBrw:aCols[ 1 ]:nEditType := EDIT_GET
 

This is the line that enables editing the value in the cell and save it to the table.
User can directly type into the cells and make changes.

¿ese cambio afecta la tabla directamente o actua sobre el arreglo resultado de la consulta?
ENGLISH
Does this change affect the table directly or does it act on the array resulting from the query?


All changes are saved immediately to the table on the Server.

I undertanad oArticulos as TDolphin Query.

Spanish
Necesito que NO afecte la tabla directamente.

ENGLISH
I need it to NOT affect the table directly.


If you are using TDolphin, read the data into an array and then Browse the array like this.

Code: Select all  Expand view

REDEFINE XBROWSE oBrw Id 10 ;
   OF oDlg_Articulos ;
   DATASOURCE aArray ;
   COLUMNS 1 ;
   HEADERS "Descripcion" ;
   <...other clauses...>
 


If you are using FWH built-in library, this is not necessary.
Simply set
Code: Select all  Expand view

oArticulos:SetBatchMode( .t. )
 

All changes made are retained in the memory only and are not written to the real table.
Later, if you want to save all the changes to the server at once, then call oArticulos:SaveBatch() and otherwise simply ignore the changes.
Regards

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


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 10 guests