Richedit( ) function problems

Richedit( ) function problems

Postby TimStone » Fri Jun 24, 2016 5:39 pm

Many months ago you created a Richedit function and more recently you modified the class. This may have broken elements of the function. In this example:

cTitle := "Test Rich Edit Function"
cText := "this is a test line of the rich edit function. It should be editable very easily"
RichEdit( @cText, cTitle, 0,0,40,200 )

Using this sequence, the following is happening

1) After making changes, and exiting the function, the changes are not saved to a memo field.
2) The icons for position ( left, center, right ), and those that follow on the button bar, are not displaying. The buttons are there but no bitmap display

I thought about using the elements of the new class, but for documentation it says to local at a sample code piece that is very confusing and uses far more than a richedit text

1) Can we get the function fixed so it returns the cText to be saved in a memo field ?
2) Using the PRINT class, can you show me a sample of keeping RTF formatting when printing using @ Row, Column print syntax ( just like I do with a normal memo field )
3) Can we recall and display the RTF in PREVIEW mode ( PRINT class ), and in normal edit field display
4) Can we use the new class with an RC file ( once again, @ x,y syntax doesn't help out with a .rc controlled dialog ).
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Richedit( ) function problems

Postby cnavarro » Fri Jun 24, 2016 11:58 pm

Tim, last version not modified class TRichedit, new class TRichEdit5 developed and included
Function RichEdit(), not modified in last version, and continue use old version class TRichEdit

Regards
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Richedit( ) function problems

Postby TimStone » Sat Jun 25, 2016 12:00 am

OK, but still, the function I described is not fully functional. I've shown the code and noted the problems.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Richedit( ) function problems

Postby Silvio.Falconi » Sat Jun 25, 2016 6:43 am

wich error you have?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Richedit( ) function problems

Postby TimStone » Sat Jun 25, 2016 6:48 am

Please read the first post in this thread.
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Richedit( ) function problems

Postby Silvio.Falconi » Sat Jun 25, 2016 8:12 am

Tim
for the old trichedit class
> the changes are not saved to a memo field.
this is a problem I wrote two mounth ago also to Cristobal

Before it run (2002) ok
then Someone changed the save of rtf into Memofile and something not run ok

I would like to make it clear to this someone who should put things as they were and RTF files should be saved to a RTF file and a memo file to a memo file

if the RTF file is stored on a memo file creates the error.
Now I'm trying some functions Reinaldo Reinaldo perhaps has found the solution
because it seems that the function resavefile work good
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: Richedit( ) function problems

Postby Antonio Linares » Sat Jun 25, 2016 8:51 am

Tim,

The function RichEdit() was not saving changes previously. In order to save them these changes
are required in memoedit.prg:

Remove static function Save() and modify these lines

static function BuildRichEditBar( oWnd, oRtf, bSave )

...

DEFINE BUTTON oBtn OF oBar ;
MESSAGE "Save a file" TOOLTIP "Save" NOBORDER ;
ACTION If( ! Empty( bSave ), Eval( bSave, oRtf:SaveAsRTF() ),)

...

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( BuildRichEditBar( oDlg, oMemo, { | c | cText := c } ), oDlg:ReSize() )

The missing bitmaps are not yet implemented. For now you have to provide these resources
yourself: "Left", "Center", "Right", "Justify", "Number", "Bullet" and "Exit"

These changes will be included in next FWH 16.05
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

Re: Richedit( ) function problems

Postby TimStone » Tue Jun 28, 2016 4:31 pm

I made the changes ... tried it ... but it's not really going to resolve my problem.

Here is what I want to do. I have some text stored in .fpt memo fields. I want to bring it up in a Rich Text editor, Format it, then save it back to the .fpt file. Then, I want it to print on the final document ( invoice ) in it's modified form. When I bring it up on the screen, I want to also see it in the rich text format.

Do we have a simple sample that shows this created within a dialog ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Richedit( ) function problems

Postby Antonio Linares » Tue Jun 28, 2016 5:54 pm

Tim,

Your example with my changes is working fine. What problems do you get ?

cTitle := "Test Rich Edit Function"
cText := "this is a test line of the rich edit function. It should be editable very easily"
RichEdit( @cText, cTitle, 0,0,40,200 )

You have to press the save button in order to save the changes. The saved text is RTF format,
so it can be directly stored in your field.
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

Re: Richedit( ) function problems

Postby Antonio Linares » Tue Jun 28, 2016 5:59 pm

I tested your example this way:

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local cTitle := "Test Rich Edit Function"
   local cText := "this is a test line of the rich edit function. It should be editable very easily"

   RichEdit( @cText, cTitle )

   MsgInfo( cText )

return nil
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

Re: Richedit( ) function problems

Postby Antonio Linares » Tue Jun 28, 2016 6:07 pm

I have modified function RichEdit() this way so we can know if the text was "saved":

Code: Select all  Expand view
function RichEdit( cText, cTitle, nTop, nLeft, nBottom, nRight )

   local oFont, oDlg, oMemo
   local hDLL
   local uTemp := If( ! Empty( cText ), cText, '' )
   local lRich := .F., lGTF := .F., lSaved := .F.

   DEFAULT nTop := 9, nLeft := 9, nBottom := 27, nRight := 71.5,;
           cTitle := "RichEdit"

   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -10

   DEFINE DIALOG oDlg FROM nTop, nLeft TO nBottom, nRight ;
      TITLE cTitle FONT oFont
   oDlg:lTruePixel   := .f.

   hDLL  = LoadLibrary( 'riched20.dll' )

   @ 30, 3 RICHEDIT oMemo VAR uTemp OF oDlg PIXEL SIZE 200, 200

   oDlg:oClient = oMemo

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( BuildRichEditBar( oDlg, oMemo,;
                { | c | lSaved := .T., cText := c } ), oDlg:ReSize() )

   oFont:End()

   if hDLL != nil
      FreeLibrary( hDLL )
   endif

return lSaved


You can test it this way:
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local cTitle := "Test Rich Edit Function"
   local cText := "this is a test line of the rich edit function. It should be editable very easily"

   while RichEdit( @cText, cTitle )
      MsgInfo( cText )
   end  

return nil


It will remain editing the text meanwhile you save it
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

Re: Richedit( ) function problems

Postby TimStone » Tue Jun 28, 2016 10:09 pm

OK ... so I use the function, and I take the first 10 words of the text and make them bold.

MsgInfo now shows the text this way:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 ARIAL;}}
\viewkind4\uc1\pard\b\f0\fs20 I, the Registered Owner hereby authorize the above repair work to be done \b0 along with the necessary materials,

It saved it, but that is what I get instead of I, the Registered Owner hereby authorize the above repair work to be done along with the necessary materials.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Richedit( ) function problems

Postby Antonio Linares » Wed Jun 29, 2016 6:03 am

Tim,

What do you get ?

It seems as your msg is uncomplete
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

Re: Richedit( ) function problems

Postby TimStone » Wed Jun 29, 2016 3:25 pm

Antonio,

I took the function and placed it in a "full program". The program actually has disclaimer text used on various documents. These are all stored in memo fields in a .dbf/.fpt file. They are all normally edited with a REDEFINE GET cText MEMO ID 2155 OF oDlg . There is no problem. The full text is quite long ( about 20 lines ).

I would like to format these text items as Rich Text, and then save them back to the memo field when completed. So, I added the following button to do the editing:

DEFINE BUTTON oWBtn2 OF oBarS3 RESOURCE "FEEDIT" ;
ACTION ( RichEdit( @cText, cTitle, 0,0,40,200 ), MsgInfo( cText ) )

The first part of the text is:

I, the Registered Owner hereby authorize the above repair work to be done along with the necessary materials.

After using the editor, in MsgInfo() I should get:

I, the Registered Owner hereby authorize the above repair work to be done along with the necessary materials.

Instead it gives me:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 ARIAL;}}
\viewkind4\uc1\pard\b\f0\fs20 I, the Registered Owner hereby authorize the above repair work to be done \b0 along with the necessary materials,
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Richedit( ) function problems

Postby Antonio Linares » Wed Jun 29, 2016 9:30 pm

Tim,

You get the text in RTF format. You need to display it in a RichEdit control to see it properly.

In my example I use a loop to show the modified text in the same RichEdit() function
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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 69 guests