Page 1 of 1
XBrowse Muliple Rows per record
Posted: Sat Feb 02, 2008 1:22 am
by James Bott
I understand that XBrowse can display mutliple lines per record, but I can't figure out how to do it.
oBrw:nDataLines := 2
Has no effect, and I don't know why you would need that. It seems that the browse should figure that out itself by the data specification.
And I can't figure out the syntax for displaying the data using oCol:bStrData. I have tried CRLF, CR, LF, and arrays.
Can someone explain the syntax?
[I am using FWH 8.01/xHarbour]
James
Posted: Sat Feb 02, 2008 1:57 am
by James Bott
Solved.
You have to also increase the row height. If you don't do that, the data appears with the CRLF symbols on the same row. So all three of these lines are required.
Code: Select all
oCol:bStrData := {|| trim( oCust:last) + ", " + oCust:first +CRLF+ oCust:street}
oBrw:nDataLines := 2
oBrw:nRowHeight := 30
This does not seem to be the best solution. It would be better if XBrowse figured out that if there were two lines of data in bStrData, then nDataLines should be set to 2, and nRowHeight should be adjusted. Actually, it should figure out the minum row height needed and use that unless nRowHeight has been specified and is greater than the minimum row height. That way we could still make the row height larger.
James
Posted: Sat Feb 02, 2008 8:08 am
by Robert Frank
James
You can also use xBrowse to show multiple lines without using CR+LF in each line. xBrowse will do it automaticaly.
...
oBRWR:nRowHeight :=50
...
oCol:= oBRWR:AddCol()
oCol:bStrData := {|| BRWR_SPIS_BADAN() }
oCol:cHeader := "Zlecone badania"
oCol:nWidth:=200
...
Function BRWR_SPIS_BADAN()
Local xRESZTA:=''
Local XXX:=0
Local xRECNO:=RR->RECNO
Local warea:=Select()
Select(2)
If DbSeek(xRECNO)
Do While xRECNO=FF->RECNO .AND. .NOT. Eof()
XXX+=1
xRESZTA+=AllTrim(OemToAnsi(5->NAZWA_S))+' '
If XXX=5
// NOT NESSESARY to divide lines for xBROWSE
//xRESZTA+=sCRLF
XXX:=0
EndIf
DbSkip(1)
EndDo
Else
Select(warea)
xRESZTA:="nothing to show"
EndIf
Return xRESZTA
Posted: Sat Feb 02, 2008 8:48 am
by James Bott
Robert,
From your code it looks like you are just building one long string. Does XBrowse just word-wrap at spaces?
James
Posted: Sat Feb 02, 2008 10:16 am
by Robert Frank
James Bott wrote:Robert,
From your code it looks like you are just building one long string. Does XBrowse just word-wrap at spaces?
James
Exactly.
Remaind to keep oBrw:nRowHeight :=XXX up to your needs.