FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour xBrowse - Editar celda por codigo (SOLUCIONADO)
Posts: 1380
Joined: Fri Oct 14, 2005 01:28 PM
xBrowse - Editar celda por codigo (SOLUCIONADO)
Posted: Mon Oct 21, 2013 03:27 PM
Estimados
Tengo un xbrowse con 2 celdas editables. He asignado :nMoveType:= MOVE_RIGHT
Lo que pretendo es que luego de validar lo ingresado en la celda 1, y luego de pasar a la celda 2, inmediatamente a su derecha, la edite sin necesidad de que el operador pusle <Intro/Enter>.
Lo que yo hice es:
Code (fw): Select all Collapse
 聽 WITH OBJECT ::oBrwCom:aCols[_Cantidad]
聽 聽 聽 :nEditType 聽 := EDIT_GET
聽 聽 聽 :bOnPostEdit := {|o, nCant, nK| if( nK != VK_ESCAPE, ( if( !Empty( ::aArtCompra[::oBrwCom:nArrayAt][_CodArt] ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽( ::aArtCompra[::oBrwCom:nArrayAt][_Cantidad]:= nCant, ::Totaliza() ), msgBeep() ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽::oBrwCom:Refresh(), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Eval( ::oBrwCom:aCols[_PrcCom], VK_RETURN ) ), ) }
聽 聽END
聽 聽WITH OBJECT ::oBrwCom:aCols[_PrcCom]
聽 聽 聽 :cHeader:= "Prc.Unit"
聽 聽 聽 :nEditType 聽 := EDIT_GET
聽 聽 聽 :bOnPostEdit := {|o, nPrcUVta, nK| if( nK != VK_ESCAPE, ( if( !Empty( ::aArtCompra[::oBrwCom:nArrayAt][_CodArt] ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ( ::aArtCompra[::oBrwCom:nArrayAt][_PrcVta]:= nPrcUVta, ::Totaliza() ), msgBeep() ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ::oBrwCom:Refresh() 聽), ) }
聽 聽END

Evidentemente no es lo que corresponde, ya que ejecuta ::Totaliza y este me da error por tener un campo nil en una multiplicaci贸n.
Se puede?, como?
gracias
Resistencia - "Ciudad de las Esculturas"

Chaco - Argentina
Posts: 1380
Joined: Fri Oct 14, 2005 01:28 PM
Re: xBrowse - Editar celda por codigo
Posted: Tue Oct 22, 2013 12:19 PM

...

:idea:

Resistencia - "Ciudad de las Esculturas"

Chaco - Argentina
Posts: 244
Joined: Fri Oct 28, 2005 06:29 PM
Re: xBrowse - Editar celda por codigo
Posted: Tue Oct 22, 2013 12:48 PM

Mario

En mi opinion no estoy seguro que se pueda hacer que la celda de la derecha entre en edicion sin pulsar enter, calculo que porque lo estas llamando de otra celda y otro bOnPostEdit, intent茅 hacerlo pero no lo logro, probe agregando un oBrw:KeyChar( VK_RETURN ) al final del bOnPostEdit de la primer celda pero no hace lo que corresponde.

Saludos

Alejandro Cebolido

Buenos Aires, Argentina
Posts: 1380
Joined: Fri Oct 14, 2005 01:28 PM
Re: xBrowse - Editar celda por codigo
Posted: Tue Oct 22, 2013 02:29 PM

Alejandro;
Muchas gracias por ocuparte. A veces los clientes piden demasiado :)

Resistencia - "Ciudad de las Esculturas"

Chaco - Argentina
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: xBrowse - Editar celda por codigo
Posted: Tue Oct 22, 2013 05:55 PM
Lo que pretendo es que luego de validar lo ingresado en la celda 1, y luego de pasar a la celda 2, inmediatamente a su derecha, la edite sin necesidad de que el operador pusle <Intro/Enter>.

Hola Mario, mira si utilizando alguna de estas instrucciones se te coloca en modo edicion
oBrw:aCols[ n ]:Edit()
oBrw:SelectedCol():Edit()

Saludos.
Francisco J. Alegr铆a P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 1380
Joined: Fri Oct 14, 2005 01:28 PM
Re: xBrowse - Editar celda por codigo
Posted: Wed Oct 23, 2013 04:13 AM

Francisco;
gracias por tu inter茅s. Ninguna de las opciones edita el campo

Resistencia - "Ciudad de las Esculturas"

Chaco - Argentina
Posts: 46
Joined: Tue May 07, 2013 07:27 PM
Re: xBrowse - Editar celda por codigo
Posted: Wed Oct 23, 2013 03:42 PM

Mario

No se si ser谩 lo que buscas, pero para entrar en edici贸n un campo sin pulsar enter el xbrowse trae FASTEDIT que hace la edici贸n con solo escribir sobre 茅l como si fuera una celda de excel.

Saludos y espero sea eso lo que buscas

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse - Editar celda por codigo
Posted: Wed Oct 23, 2013 03:49 PM
Mr MarioG

I am not sure if I understood your requirement. But this sample of Invoice might give some hints on calculations in Xbrowse.

Please compile and run the program as it is
Code (fw): Select all Collapse
#include "FiveWin.Ch"
#include "xbrowse.ch"

function Invoice()

聽 聽local oDlg, oFont, oBrw
聽 聽local aInvoice 聽 聽:= { { 0, 0, 0 } }
聽 聽local aPriceTable := { 120, 234, 323, 456, 532, 619, 758, 821, 945 }
聽 聽local aBlank 聽 聽 聽:= { 0, 0, 0 }

聽 聽DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
聽 聽DEFINE DIALOG oDlg SIZE 600,400 PIXEL TITLE "INVOICE" FONT oFont
聽 聽@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
聽 聽 聽 DATASOURCE aInvoice ;
聽 聽 聽 COLUMNS 1, 1, 2, 3 ;
聽 聽 聽 HEADERS "CODE", "ITEM", "QUANTITY", "PRICE" ;
聽 聽 聽 PICTURES "9", nil, "99999.999", "999.99" ;
聽 聽 聽 COLSIZES nil, 120 ;
聽 聽 聽 CELL LINES FOOTERS NOBORDER FASTEDIT

聽 聽oBrw:Item:bEditValue 聽 聽 聽 := { || If( oBrw:Code:Value > 0, "Item Num " + StrZero( oBrw:Code:Value, 4 ), "" ) }
聽 聽oBrw:AMOUNT 聽 聽 聽 聽 聽 聽 聽 聽:= { || oBrw:Quantity:Value * oBrw:Price:Value }
聽 聽oBrw:Amount:cEditPicture 聽 := "999,999,999.99"
聽 聽oBrw:nEditTypes 聽 聽 聽 聽 聽 聽:= { EDIT_GET, EDIT_NONE, EDIT_GET, EDIT_GET, EDIT_NONE }

聽 聽WITH OBJECT oBrw:Code
聽 聽 聽 :bEditValid 聽 聽 聽 聽 聽 聽 := { |oGet| oGet:VarGet() > 0 }
聽 聽 聽 :bOnChange 聽 聽 聽 聽 聽 聽 聽:= { |oCol| oBrw:aRow[ 3 ] := aPriceTable[ oCol:Value ] }
聽 聽 聽 :bFooter 聽 聽 聽 聽 聽 聽 聽 聽:= { || oBrw:nLen }
聽 聽END
聽 聽WITH OBJECT oBrw:Quantity
聽 聽 聽 :bEditWhen 聽 聽 聽 聽:= { || ! Empty( oBrw:Code:Value ) }
聽 聽 聽 :bOnChange 聽 聽 聽 聽:= { || oBrw:MakeTotals( oBrw:oCol( "Amount" ) ), oBrw:RefreshFooters() }
聽 聽 聽 :bEditValid 聽 聽 聽 := { |oGet| oGet:VarGet() > 0 }
聽 聽 聽 :nFooterType 聽 聽 聽:= AGGR_SUM
聽 聽END

聽 聽WITH OBJECT oBrw:Price
聽 聽 聽 :bEditWhen 聽 聽 聽 聽:= { || ! Empty( oBrw:Code:Value ) .and. ! Empty( oBrw:Quantity:Value ) }
聽 聽 聽 :bOnChange 聽 聽 聽 聽:= { || oBrw:MakeTotals( oBrw:oCol( "Amount" ) ), oBrw:RefreshFooters() }
聽 聽 聽 :bEditValid 聽 聽 聽 := { |oGet| oGet:VarGet() > 0 }
聽 聽END

聽 聽oBrw:Amount:nFooterType := AGGR_SUM

聽 聽WITH OBJECT oBrw
聽 聽 聽 :nStretchCol 聽 聽 聽:= STRETCHCOL_WIDEST

聽 聽 聽 :bPastEof 聽 聽 聽 聽 := { || If( Empty( oBrw:Amount:Value ), nil, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ( AAdd( oBrw:aArrayData, AClone( aBlank ) ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oBrw:GoDown(), oBrw:GoLeftMost(), oBrw:Refresh() ) ) }

聽 聽 聽 :bChange 聽 聽 聽 聽 聽:= { || If( oBrw:nArrayAt < Len( oBrw:aArrayData ) .and. ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ATail( oBrw:aArrayData )[ 2 ] == 0, ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ( ASize( oBrw:aArrayData, Len( oBrw:aArrayData ) - 1 聽), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 oBrw:Refresh() ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 nil ) }
聽 聽 聽 //
聽 聽 聽 :CreateFromCode()
聽 聽END

聽 聽ACTIVATE DIALOG oDlg CENTERED ;
聽 聽 聽 ON INIT ( oBrw:SetFocus(), .f. )
聽 聽RELEASE FONT oFont

聽 聽if ATail( aInvoice )[ 2 ] == 0
聽 聽 聽 ASize( aInvoice, Len( aInvoice ) - 1 )
聽 聽endif

聽 聽xbrowser aInvoice title "Edited Invoice" setup ( oBrw:cHeaders := { "Code", "Qty", "Price" } )

return nil


Regards



G. N. Rao.

Hyderabad, India
Posts: 1380
Joined: Fri Oct 14, 2005 01:28 PM
Re: xBrowse - Editar celda por codigo (SOLUCIONADO)
Posted: Wed Oct 23, 2013 10:03 PM
Hector Pedro Lerda wrote:Mario

No se si ser谩 lo que buscas, pero para entrar en edici贸n un campo sin pulsar enter el xbrowse trae FASTEDIT que hace la edici贸n con solo escribir sobre 茅l como si fuera una celda de excel.

Saludos y espero sea eso lo que buscas


Pedro;
Es lo que estaba buscando!

muchas gracias
Resistencia - "Ciudad de las Esculturas"

Chaco - Argentina
Posts: 1380
Joined: Fri Oct 14, 2005 01:28 PM
Re: xBrowse - Editar celda por codigo
Posted: Wed Oct 23, 2013 10:05 PM
nageswaragunupudi wrote:Mr MarioG
I am not sure if I understood your requirement. But this sample of Invoice might give some hints on calculations in Xbrowse.


Mr. Rao, I'm very pleased with your sample; but is not my problem.
Mr. Lerda, given me the correct solution. I needed FASTEDIT!.
Mr. Rao, many thanks for your time and the sample
(sorry for my english, I use google trans.)
Resistencia - "Ciudad de las Esculturas"

Chaco - Argentina

Continue the discussion