- Code: Select all Expand view
- sCondic:= "SELECT number, name, cSex, color, comments FROM my_DB WHERE " + ;
"father='" oDbf:number"' ORDER BY cSex, birth_date"
aResult := oDbf:SqlQuery( sCondic )
...
oBrwD:=TXBrowse():New(oFld:aDialogs[6])
oBrwD:SetArray( aResult )
oBrwD:cHeaders:= {"Number", "Name", "cSex", "Color", "Comment"}
IF !empty( oBrw:aArrayData ) //if we have data or else we have an error
oBrwD:aCols[3]:nWidth := 90
oBrwD:aCols[5]:nWidth := 170
oBrwD:aCols[1]:nDataStyle:= AL_RIGHT
oBrwD:aCols[4]:nDataStyle:= AL_RIGHT
ENDIF
oBrwD:CreateFromResource(101)
There is an inconsistency in TXBrowse: If the original array is empty or smaller than a newer record array (when skipping through records), then TXBrowse would not change the display and will keep the original SetArray size with only one column (???) even though the SQL statement specifies 5 in this case, If you land in an empty SQL (returning an empty array) it would show you a 1 column array with the heading "Number" and the next registers (if non-empty) will only have 1 column and will show only the number field.
Further more, if you now happen to do a new query like the following one, an assign it to the same TXBrowse (for the sake of saving space in the same dialog tab):
- Code: Select all Expand view
- sCondic:="SELECT father, cSex, birth, color, grandad, nany, family, comments FROM family " + ;
"ORDER BY cSex, birth"
DATABASE oDbfP
oDbfP:LOAD()
aCondic := oDbfP:SqlQuery( sCondic )
oBrwD:aArrayData := aCondic //new array over old browse window
oBrwD:cHeaders:= {"Number", "cSex", "Birth", "Color", "GD", "GM", "Family", "Comment"}
since the old browse window had only 5 columns (and in this example was not empty in the 1st place; number, name, cSex, color, and comments) the new browse will not re-dimension correctly to 8 columns and will display only 5 columns (at least correctly!). If in the 1st place you landed in an empty register and then you navigate to a non-empty one, then you will have the 2nd case, that is, several registers showing only one column ("Number" in my case).
Any explanation or solution?