Richedit( ) function problems
- TimStone
- Posts: 2961
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Richedit( ) function problems
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 ).
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
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
- cnavarro
- Posts: 6573
- Joined: Wed Feb 15, 2012 8:25 pm
- Location: España
- Has thanked: 4 times
- Been thanked: 6 times
Re: Richedit( ) function problems
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
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
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
- TimStone
- Posts: 2961
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Richedit( ) function problems
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
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
- Silvio.Falconi
- Posts: 7187
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 9 times
Re: Richedit( ) function problems
wich error you have?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 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
I use : FiveWin for Harbour March-April 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
- Silvio.Falconi
- Posts: 7187
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 9 times
Re: Richedit( ) function problems
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
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 March-April 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
I use : FiveWin for Harbour March-April 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
- Antonio Linares
- Site Admin
- Posts: 42652
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 67 times
- Been thanked: 94 times
- Contact:
Re: Richedit( ) function problems
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
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
- TimStone
- Posts: 2961
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Richedit( ) function problems
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 ?
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
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
- Antonio Linares
- Site Admin
- Posts: 42652
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 67 times
- Been thanked: 94 times
- Contact:
Re: Richedit( ) function problems
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.
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.
- Antonio Linares
- Site Admin
- Posts: 42652
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 67 times
- Been thanked: 94 times
- Contact:
Re: Richedit( ) function problems
I tested your example this way:
Code: Select all | Expand
#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
- Antonio Linares
- Site Admin
- Posts: 42652
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 67 times
- Been thanked: 94 times
- Contact:
Re: Richedit( ) function problems
I have modified function RichEdit() this way so we can know if the text was "saved":
You can test it this way:
It will remain editing the text meanwhile you save it
Code: Select all | Expand
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
#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
- TimStone
- Posts: 2961
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Richedit( ) function problems
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.
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
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
- Antonio Linares
- Site Admin
- Posts: 42652
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 67 times
- Been thanked: 94 times
- Contact:
- TimStone
- Posts: 2961
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Richedit( ) function problems
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,
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
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
- Antonio Linares
- Site Admin
- Posts: 42652
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 67 times
- Been thanked: 94 times
- Contact:
Re: Richedit( ) function problems
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
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