Hi,
there are some problems using xbrowse with an array that changes its elements number until to come an empty array.
The problem is that when it come empty it lost the original header structure.
In the attached self-contained sample, the xbrowse start with some elements, then if you press the "RemoveData" button, a new empty array will be assigned and as you can see the xbrowse lost its headers.
This is due to the samearray method. I also tried to change this method returning always .t. in a test.
In this situation the problem is that the headers remains after setting the empty array but when I try to assign a new fill array pressing the "GetData" button then the xbrowse always displayed empty.
Any solution ?
Thanks in advance.
#include "FiveWin.ch" #include "xbrowse.ch"
function Main() local oBtn, oDlg,aNames,aArray, oBrw2, oCol
aArray:=BrwGetData()
DEFINE dialog oDlg TITLE "xBrowse tests" FROM 5,5 TO 70,100
@1,1 XBROWSE oBrw2 ARRAY AARRAY OF oDlg
ADD COLUMN oCol TO XBROWSE oBrw2 DATA ARRAY ELEM 1; HEADER "Num"
SIZE 80 ADD COLUMN oCol TO XBROWSE oBrw2 DATA ARRAY ELEM 2;
HEADER "Type" SIZE 200
oBrw2:CreateFromCode()
@10,10 BUTTON "GetData" OF ODLG; ACTION
(aArray:=BrwGetData(),oBrw2:SetArray(aArray),oBrw2:Refresh())
@12,10 BUTTON "RemoveData" OF ODLG; ACTION
(aArray:=array(0,2),oBrw2:SetArray(aArray),oBrw2:Refresh())
ACTIVATE dialog oDlg return
Function BrwGetData() local aArray
aArray:=array(0,4) aadd(aArray,{1,"RED"}) aadd(aArray,{2,"GREEN"})
aadd(aArray,{2,"GREEN"}) aadd(aArray,{1,"RED"}) return(aArray)