FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse array problem
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
xBrowse array problem
Posted: Mon Jul 12, 2010 12:48 PM

Hi, i have been change my wbrowses to xbrowses and i have a error in one ocasion:

This my xbrowse

oBrw := TXBrowse():New( oDlg )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:CreateFromResource( 109 )
oBrw:nColDividerStyle := 5 //LINESTYLE_BLACK // COLUNAS
oBrw:lColDividerComplete := .T.
oBrw:nHeaderHeight :=30
oBrw:nStretchCol := STRETCHCOL_LAST
oBrw:bClrSel := {|| { Frente, Fundo } }
oBrw:bClrSelFocus := {|| { Frente, Fundo } }

oCol := oBrw:AddCol()
oCol:cHeader := "CLI"
oCol:nArrayCol := 1
oCol:nWidth := 30

oCol := oBrw:AddCol()
oCol:cHeader := "Nº NOTA"
oCol:nArrayCol := 2
oCol:nWidth := 80

My Add line:

AADD( VetNotas, { NrAge , oCtoPar:NOTAS })
oBrw:SetArray( VetNotas )

I have a button to delete a element of array

Adel(VetNotas,oBrw:nAt,.t.)

But if the array have 2 elements the first deletes ok but the last give me a Array bound error. If i put oBrw:SetArray( VetNotas) next Adel the xbrowse hangs.
Any sugestion?
Thanks in advance.

Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: xBrowse array problem
Posted: Mon Jul 12, 2010 02:12 PM

If you delete the last record, you might skip one record higher before deleting. Something like
oBrw:Skip(-1)
aDel(VetNotas, oBrw:nAt+1, .t.)
aSize(Vetnotas, len(VetNotas)-1)

(after deleting an element, you should resize your array)

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse array problem
Posted: Mon Jul 12, 2010 02:30 PM

Not oBrw:nAt
Please use oBrw:nArrayAt

Adel(VetNotas,oBrw:nArrayAt,.t.)

That is one major difference between wbrowse and xbrowse

Regards



G. N. Rao.

Hyderabad, India
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Re: xBrowse array problem
Posted: Mon Jul 12, 2010 03:06 PM

Thanks G. N. Rao. and Gilbert about xbrowse tips.

Regards,
Wanderson.

Continue the discussion