FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Xbrowse & Arrays of different sizes
Posts: 883
Joined: Tue Oct 11, 2005 11:57 AM
Xbrowse & Arrays of different sizes
Posted: Tue Apr 08, 2014 08:02 PM

Hi everyone

I define a xBrowse, Columns are days of a month, I assign a function to paint the header with the name of the day and its number.

All data is contained in a multidimensional array ( columns are days of the month )
I recreate the array.
But I get errors when reasigning the headers.

oBrwPla:SetArray(aChangingArray,.T.)
For X= 1 to Len(Arreglo)
oBrwPla:aCols[x]:cHeader:=AnotherFunction()
Next

If I change from a 30 days month to a 31 days month, I get Array Access error.
I found the the xBrowse keeps the number of columns to 30, and the SETARRAY() function does not change it.

Any Idea on how to do it

Thanks in advance

;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Xbrowse & Arrays of different sizes
Posted: Wed Apr 09, 2014 10:08 AM

Adolfo,

You could add a new column using oBrw:AddCol( no parameters ) or oBrw:AddColumn( ... parameters... )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse & Arrays of different sizes
Posted: Wed Apr 09, 2014 02:50 PM
Initially create the browse for 31 days, with headings for 31 days. Depending on the month, Hide or Show 29th column onwards.

For substituting a new array, please do not use SetArray() again. Simply assign the new array oBrw:aArrayData := aNewArray and call oBrw:Refresh( .t. ).

Code (fw): Select all Collapse
oBrw:aArrayData  := aNewArray
nDays := Len( aNewArray[ 1 ] )
AEval( oBrw:aCols, { |o| if( o:nCreationOrder <= nDays, o:Show(), o:Hide() ) }, 29 )
oBrw:Refresh( .t. )
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion