xBrowser + RTF

xBrowser + RTF

Postby Otto » Sat Feb 02, 2008 11:15 am

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: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Otto » Sat Feb 02, 2008 4:47 pm

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: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Otto » Tue Mar 25, 2008 6:30 pm

Antonio, is there some news about RTF support for xBrowser?
Regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Tue Mar 25, 2008 10:12 pm

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
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Otto » Tue Mar 25, 2008 10:47 pm

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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Tue Mar 25, 2008 10:51 pm

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
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby nageswaragunupudi » Tue Mar 25, 2008 10:55 pm

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
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Antonio Linares » Tue Mar 25, 2008 10:59 pm

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
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Tue Mar 25, 2008 11:01 pm

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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Tue Mar 25, 2008 11:03 pm

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
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby nageswaragunupudi » Tue Mar 25, 2008 11:04 pm

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
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Otto » Tue Mar 25, 2008 11:26 pm

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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Tue Mar 25, 2008 11:28 pm

The link is not working please
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Otto » Tue Mar 25, 2008 11:30 pm

Now it is.

First you see the mdb-database then the grid. There are only 3 rows in it.
Regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests