xBrowser + RTF

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

xBrowser + RTF

Post by Otto »

Has someone tried to use a RICHEDIT in the datapaint method of xBrowser.

I would like to have the same outlook in xBrowser as the sample.

Image
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Maybe someone can help

- Does "IsRTF()" work? I saw the function in fget class.
- What does TRichEdit need as a container?
Regards,
Otto


method paintdata
...

if IsRTF( cdata )

??? define a window without frame from {nRow, nCol, nRow + nHeight, Min( nCol + nWidth, ::oBrw:BrwWidth() - 5 ) }
cRtf:= cdata
oRTF := TRichEdit():New( nRow, 0, { | u | If( PCount()==0, cRTF, cRTF:= u ) },oWndTest ,,,, .F.,, .F., .F.,,,, .F., .F., "TestRTF.RTF",, .F., .F., )
ACTIVATE WINDOW oWndRTF




else
oFont:Activate( hDC )
SetTextColor( hDC, aColors[ 1 ] )
SetBkColor( hDC, aColors[ 2 ] )
DrawTextEx( hDC, cData,;
{nRow, nCol, nRow + nHeight, Min( nCol + nWidth, ::oBrw:BrwWidth() - 5 ) },;
::nDataStyle )
oFont:Deactivate( hDC )
ENDIF

endif
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Antonio, is there some news about RTF support for xBrowser?
Regards,
Otto
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

The function IsRTF() works.
Seems you have already done displaying RTF in xbrowse cell. Is it the same code you are using? Can you post your full code for display of rtf ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

NageswaraRao,
no I am sorry. I used ComponentOne’s FlexGrid with VB.NET for the demo screen.
But I think it is very similar what we have in our xBrowser.

Regards,
Otto

Dim _rtf As New RTF
Private Sub _flex_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) Handles _flex.OwnerDrawCell

' check whether the cell contains RTF
Dim rtfText As String = _flex.GetDataDisplay(e.Row, e.Col)

If (rtfText.StartsWith("{\rtf")) Then

' _flex.Rows(e.Row).Height = GetDisplayHeight(_flex(e.Row, 3), _flex.Cols(3).WidthDisplay)
' it does, so draw background
e.DrawCell(DrawCellFlags.Background)

' draw the RTF text
_rtf.Rtf = rtfText
_rtf.ForeColor = e.Style.ForeColor
_rtf.BackColor = e.Style.BackColor
_rtf.RenderTo(e.Graphics, e.Bounds)

' and draw border last
e.DrawCell(DrawCellFlags.Border)

' we're done with this cell
e.Handled = True
Else

End If


End Sub
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Otto,

It is not a simple task:

The richedit control has to paint "itself" so we need to have a richedit control for each visible cell that wants to show formatted text.

So if you have a column that shows 20 rows and each cell shows RTF text, then we need to have 20 richedit controls, childs of the xbrowse.

We can not create a richedit control everytime we paint a cell, as you tried in your code, or the application will collapse. We need to create a certain amount of richedit controls only, and change their contents as the browse scrolls up or down.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

I agree with you Mr Antonio, if we create Richedit controls in each cell.

> _rtf.RenderTo(e.Graphics, e.Bounds)

But there seems to be a way of just rendering richtext content within a rectangle.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

We could start defining a new DATA in the Class TXBrwColumn:

DATA aRichEdits

that will hold an array of richedit controls, one by each visible cell of that column. When the browse is resized, then we have to redimension the array with more or less richedit controls.

When we scroll up or down, then we should change the richedits text with the next cell text. We should test how fast (or slow) this will be.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Antonio,

I think ComponentOne’s FlexGrid does create every time you address a
column a new
Dim _rtf As New RTF.
I don’t have the working code on my HomePC.
But in real use I think you don’t have more than 20 RTF-cells opened at the same time.

Regards,
Otto
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Nageswararao,

> But there seems to be a way of just rendering richtext content within a rectangle.

That would be the perfect solution, but we need to find how to do that.

Thinking about it... if we provide a different hDC to the richedit when it is going to be painted, that could do the trick
Last edited by Antonio Linares on Tue Mar 25, 2008 11:04 pm, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Otto

I haven't used flex grid. Please tell me does this flex grid scrolls up and down like our browses or does it paint in pages and should we flip the pages
Regards

G. N. Rao.
Hyderabad, India
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Mr. NageswaraRao,
I uploaded a small video.
Regards,
Otto
http://www.atzwanger.com/flexGrid//flexGrid.html
Last edited by Otto on Tue Mar 25, 2008 11:29 pm, edited 1 time in total.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

The link is not working please
Regards

G. N. Rao.
Hyderabad, India
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Now it is.

First you see the mdb-database then the grid. There are only 3 rows in it.
Regards,
Otto
Post Reply