XBrowse Muliple Rows per record

Post Reply
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

XBrowse Muliple Rows per record

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Robert Frank
Posts: 95
Joined: Fri Nov 23, 2007 4:43 am
Location: Gdynia-Poland
Contact:

Post 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
Robert Frank
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Robert Frank
Posts: 95
Joined: Fri Nov 23, 2007 4:43 am
Location: Gdynia-Poland
Contact:

Post 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.
Robert Frank
Post Reply