xBrowse array problem

xBrowse array problem

Postby Wanderson » 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.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: xBrowse array problem

Postby gkuhnert » Mon Jul 12, 2010 2: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
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: xBrowse array problem

Postby nageswaragunupudi » Mon Jul 12, 2010 2: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
User avatar
nageswaragunupudi
 
Posts: 10628
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse array problem

Postby Wanderson » Mon Jul 12, 2010 3:06 pm

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

Regards,
Wanderson.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 51 guests