xBrowse refresh problem

xBrowse refresh problem

Postby Wanderson » Sun Mar 04, 2018 7:16 pm

Hi all, I have this code:

Use VENDA INDEX VENDA Shared New alias "VENDA" via "DBFCDX"
Database oVenda

...

oBrwPed := TXBrowse():New( oDlgPed )
oBrwPed:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrwPed:CreateFromResource( 109 )
oBrwPed:nColDividerStyle := 5 //LINESTYLE_BLACK // COLUNAS
oBrwPed:lColDividerComplete := .T.
oBrwPed:nHeaderHeight :=30
oBrwPed:nStretchCol := STRETCHCOL_LAST
oBrwPed:cAlias := "VENDA"

oCol := oBrwPed:AddCol()
oCol:bStrData := { || VENDA->NUMERO }
oCol:cHeader := "PEDIDO"

oCol := oBrwPed:AddCol()
oCol:bStrData := { || DTOC(VENDA->DATA)}
oCol:cHeader := "DATA"

oCol := oBrwPed:AddCol()
oCol:bStrData := { || VENDA->HORA }
oCol:cHeader := "HORA"

oCol := oBrwPed:AddCol()
oCol:bStrData := { || VENDA->CNPJCPF }
oCol:cHeader := "CNPJ/CPF"

oCol := oBrwPed:AddCol()
oCol:bStrData := { || SUBSTR(VENDA->CLIENTE,1,35) }
oCol:cHeader := "NOME CLIENTE"

oCol := oBrwPed:AddCol()
oCol:bStrData := { || Tran(VENDA->VALOR,"@E 9,999,999.99") }
oCol:cHeader := "BRUTO"
oCol:nDataStrAlign := AL_RIGHT

oCol := oBrwPed:AddCol()
oCol:bStrData := { || Tran(VENDA->DESCONTO,"@E 9,999,999.99") }
oCol:cHeader := "DESCONTO"
oCol:nDataStrAlign := AL_RIGHT

oCol := oBrwPed:AddCol()
oCol:bStrData := { || Tran(VENDA->LIQUIDO,"@E 9,999,999.99") }
oCol:cHeader := "LIQUIDO"
oCol:nDataStrAlign := AL_RIGHT


oCol := oBrwPed:AddCol()
oCol:bStrData := { || VENDA->VP }
oCol:cHeader := "V/P"
oCol:nDataStrAlign := AL_CENTER
oCol:nHeadStrAlign := AL_CENTER


oCol := oBrwPed:AddCol()
oCol:bStrData := { || DTOC(VENDA->DTBAIXA)}
oCol:cHeader := "DT BAIXA"

oBrwPed:SetoDbf(oVenda)

I some point i need to delete one record and I use:

oVenda:Delete()

oBrwPed:Refresh()

In File the record is deleted but the xbrowse still display the record, if i close and open again xbrowse are empty.
How I can refresh the xbrowser properly after delete record?

Thanks in advance.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: xBrowse refresh problem

Postby nageswaragunupudi » Mon Mar 05, 2018 6:27 am

Please use the recommended way to define the xbrowse like this

Code: Select all  Expand view


FWNumFormat( "E", .t. )  // Keep this at the beginning of your Main prg

Use VENDA INDEX VENDA Shared New alias "VENDA" via "DBFCDX"
Database oVenda


//  DEFINE DIALOG ....

REDEFINE oBrwPed ID 109 OF oDlgPed DATASOURCE oVenda ;
   COLUMNS "PEDITO", "DATA", "HORA", "CNPJCPF", "LEFT(CLIENTE,35)", "VALOR", "DESCONTO", "LIQUIDO", "VP", "DTBAIXA" ;
   HEADERS nil,      nil,     nil,  "CNPJ/CPF", "NOME CLIENTE",     "BRUTO", nil,         nil,     "V/P","DT BAIXA" ;
   LINES
   
WITH OBJECT oBrwPed
   :nMarqueeStyle       := MARQSTYLE_HIGHLROW
   :nColDividerStyle    := 5 //LINESTYLE_BLACK // COLUNAS
   :nHeaderHeight       :=30
   :nStretchCol         := STRETCHCOL_LAST
   WITH OBJECT aCols[ 9 ]
      :nDataStrAlign    := AL_CENTER
      :nHeadStrAlign    := AL_CENTER
   END
END

ACTIVATE DIALOG oDlgPed
 



Now when you want to delete a record,
CALL
Code: Select all  Expand view

oBrwPed:Delete()
 


No need to call Refresh() also.

Note: XBrowse automatically assigns the picture clause and also decides left/right aligns
Regards

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

Re: xBrowse refresh problem

Postby Wanderson » Mon Mar 05, 2018 4:06 pm

nageswaragunupudi wrote:Please use the recommended way to define the xbrowse like this

Code: Select all  Expand view


FWNumFormat( "E", .t. )  // Keep this at the beginning of your Main prg

Use VENDA INDEX VENDA Shared New alias "VENDA" via "DBFCDX"
Database oVenda


//  DEFINE DIALOG ....

REDEFINE oBrwPed ID 109 OF oDlgPed DATASOURCE oVenda ;
   COLUMNS "PEDITO", "DATA", "HORA", "CNPJCPF", "LEFT(CLIENTE,35)", "VALOR", "DESCONTO", "LIQUIDO", "VP", "DTBAIXA" ;
   HEADERS nil,      nil,     nil,  "CNPJ/CPF", "NOME CLIENTE",     "BRUTO", nil,         nil,     "V/P","DT BAIXA" ;
   LINES
   
WITH OBJECT oBrwPed
   :nMarqueeStyle       := MARQSTYLE_HIGHLROW
   :nColDividerStyle    := 5 //LINESTYLE_BLACK // COLUNAS
   :nHeaderHeight       :=30
   :nStretchCol         := STRETCHCOL_LAST
   WITH OBJECT aCols[ 9 ]
      :nDataStrAlign    := AL_CENTER
      :nHeadStrAlign    := AL_CENTER
   END
END

ACTIVATE DIALOG oDlgPed
 



Now when you want to delete a record,
CALL
Code: Select all  Expand view

oBrwPed:Delete()
 


No need to call Refresh() also.

Note: XBrowse automatically assigns the picture clause and also decides left/right aligns


Thank you Mr Nages
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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