Page 1 of 2

xBrowse – memofields

PostPosted: Thu Nov 18, 2010 8:42 am
by Otto
Is there a row stretch depending on the amount of text and lines possible for memofields?
Thanks in advance
Otto

Re: xBrowse – memofields

PostPosted: Sun Nov 21, 2010 9:08 am
by Otto
Here is a screenshot from the application I would like to program.
It would be fine if RowHeight would be set automatically depending on the rows of test inside the memofield.

Best regards,
Otto

Best regards,
Otto

Image

Re: xBrowse – memofields

PostPosted: Mon Nov 22, 2010 8:35 am
by StefanHaupt
Otto,

with MlCount () you can count the lines of a memofield dependig on its lenght

MLCount( <cString> , ;
[<nLineLen>] , ;
[<nTabSize>] , ;
[<lWrap>] , ;
[<lLongLines>] ) --> nLineCount


Try
Code: Select all  Expand view
nRowHeight := MlCount (...)

Re: xBrowse – memofields

PostPosted: Mon Nov 22, 2010 9:55 am
by Otto
Thank you Stefan,

I think nRowHeight is part of paint method and can only be set for all rows not for a unique row as I want.
This would be possible if nRowHeight would be part of PaintData.

Best regards,
Otto

Re: xBrowse – memofields

PostPosted: Mon Nov 22, 2010 4:27 pm
by James Bott
Otto,

I tried to do this a long time ago with TWBrowse and found it to be very difficult. One problem is with the display of the browse. Each time the screen is drawn you have to figure out if there is enough room to display each record depending on the number of rows that will be required to display the amount of text in the memo field. Or, you have to display as many lines of the memo as will fit, and then display one more line when the browse is scrolled up.

Of course these things can be solved, but there will still be a tremendous calculation overhead when displaying the browse which will cause a slowdown in the display speed.

I don't believe this capability is built into the XBrowse either.

Regards,
James

Re: xBrowse – memofields

PostPosted: Mon Nov 22, 2010 4:55 pm
by Otto
Hello James,
thank you.
But if you look into paint method you will see that immediately after the DATAPAINT method
nRowPos++ follows.

I will try what happens if I switch the nRowPos calculation into DATAPAINT.
Sure it will be necessary to limit the amount of text.

Best regards,
Otto

Re: xBrowse – memofields

PostPosted: Tue Nov 23, 2010 12:48 pm
by nageswaragunupudi
Mr. Otto

This is possible.
Step 1. Find the longest memoline.
Step 2. Find the height in pixels required to accommodate this line with the help of this code:
Code: Select all  Expand view
nHeight := DrawTextEx( hDC, cLine, aRect, nOr( DT_CALCRECT, DT_WORDBREAK ) )

hDC is oBrw's DC
cLine is the longest line.
aRect := { 0,0,oBrw:nHeight,oCol:nWidth }

Step 3. Now set this height as oBrw:nDataHeight

A little trial and error may be needed at your end.

Re: xBrowse – memofields

PostPosted: Tue Nov 23, 2010 3:10 pm
by James Bott
Rao,

Unfortunately, he wants EACH record to have a height based on the length of the memo of that record.

This would be a nice feature if there is a lot of variability in the length of the memos. But as I pointed out in my previous message, this could cause a significant calculation overhead which may make it too slow to be acceptable.

Regards,
James

Re: xBrowse – memofields

PostPosted: Tue Nov 23, 2010 3:46 pm
by nageswaragunupudi
Mr James

XBrowse (or any other browse I know) can not have different heights for different rows, unlike column widths. I understood, rightly or wrongly, that Mr. Otto wanted to set rowheight of the browse in such a way that the longest memoline is fit snugly.

Many times, I too felt the need to have varying rowheights for different rows like Excel, but it needs major changes in xbrowse. At many places the logic of xbrowse depends on fixed number of rows and rowheight (unless the window is resized).

Hope someday xbrowse will provide this facility too.

How to browse memo text (effectively)

PostPosted: Fri Nov 26, 2010 7:55 am
by frose
Hi Otto and all others,

yes, there are a lot of situation where you need to browse additional text.

Here one example: In an order we want to show additional parts of some positions and/or text, the user can toggle (show or not to show) the additional parts:

Browse ‘order positions’ with additional parts and text:
Image

Browse ‘order positions’ without additional parts only with text:
Image

(The screen shots are from our DOS-styled app, not yet migrated to FiveWin ;-) )

In addition to the fixed height of the rows – as Mr. Rao explained - there is another limitation of the commonly known browses: For each row in the browse you need a record in the leading table (Alias). With other words: As far as I know, it’s not possible to alter the leading table, you can’t do something like this:
Row 1: table1->Field1… n
Row 2: table1->Field1…n

Row n: table2->Field1…n

Row n+k: table1->Field1…n


So all informations you want to browse, must have a (leading) record in the leading table. This applies also to memo text (fields): So, if you want to show (browse) the content of a memo text (field), you have to break down the content in a corresponding amount of records, that’s all!

To show how flexible and effective this approach is, let’s take a look at the following table:
    Name C/32 – Name of anything
    Sort N/2 – Sort number of all records belonging to <Name>
    P01 C/32 – The first parameter/property/etc. you want to store for <Name>
    P02 C/32 – The second parameter/property/etc. you want to store for <Name>

    Pnn C/32 – The nn-th parameter/property/etc. you want to store for <Name>
Assuming that the fields <P01> … <Pnn> have very variable different lengths, e.g. from “” up to 3168 (99 * 32) characters, the corresponding browse can looks like :
Image
Of course you can build a browse method to toggle between “show only first records of each <Name>”/”Show all records” as shown in the example ‘order positions’ and you can even simulate ‘variable field length’ with DBF-tables!

Conclusion: There is no need to deal with memo fields. Quite contrary to: You have some big advantages, e.g. browsing, full text search, etc. Of course, you have some more expenditure by handling (Get - Show/Edit - Store) the additional fields and so on, but for me the advantages are convincingly.

Re: xBrowse – memofields

PostPosted: Fri Nov 26, 2010 10:01 am
by nageswaragunupudi
So all informations you want to browse, must have a (leading) record in the leading table. This applies also to memo text (fields): So, if you want to show (browse) the content of a memo text (field), you have to break down the content in a corresponding amount of records, that’s all!

This is not necessary for xbrowse.
XBrowse can display long text content wrapped in the column depending on the height and width of the row. So, memofields ( even photos ) can be displayed in the cells with multiple rows within the cell.

The only problem is that different rows can not have different row-heights.

Re: xBrowse – memofields

PostPosted: Fri Nov 26, 2010 10:35 am
by frose
Dear Mr. Rao,

yes, you are right. Sorry, if my explanation are misleading. I'm loving the tremendous features of xBrowse and I admit that I havn't utilised all of them yet :D

Of course you can display fields, pictures, memo fields or other informations from other tables in the columns, but you cannot browse informations without having a record - might be comletely empty - in the 'leading' table!

Can you confirm?

My intention was and still is to introduce a method to display long text (continuous text) without using memo fields and with a normal row height!

Re: xBrowse – memofields

PostPosted: Fri Nov 26, 2010 3:38 pm
by Otto
Hello Frank, hello Mr. Rao,

Therefore I asked in another post
if ColDividerStyle/RowDividerStyle could be selected for each row and col.

Do you think it is possible to move the drawing of the dividers from the Paint to the PaintData method?


This way one could read all data which you want show into an array and you can draw the dividers individually.
You could split memofields this way into different lines. This way I could simulate different row heights.


Best regards,
Otto

Re: xBrowse – memofields

PostPosted: Sat Nov 27, 2010 5:20 pm
by James Bott
Frose,

Of course you can display fields, pictures, memo fields or other informations from other tables in the columns, but you cannot browse informations without having a record - might be comletely empty - in the 'leading' table!


You could just put all the data into an array and then browse that.

Regards,
James

Re: xBrowse – memofields

PostPosted: Sat Nov 27, 2010 5:23 pm
by James Bott
Otto,

Therefore I asked in another post if ColDividerStyle/RowDividerStyle could be selected for each row and col.


Instead you could try turning off the separators and using different background colors. You could alternate the colors but sometimes more than one row would be the same color making it look like there was a taller single row.

Regards,
James