Page 1 of 1
how to use different Font Size in RICHEDITBOX ?
Posted: Fri Jun 17, 2022 10:17 am
by AUGE_OHR
hi,
i want to use different Font Size in RICHEDITBOX , how ?
Code: Select all
DEFINE WINDOW Helpfile ;
ON INIT DoInit2( ThisWindow.Name, lImage, cMemo ) ;
DEFINE RICHEDITBOX Edit_1
VALUE ""
FONTNAME "Arial"
FONTSIZE 12
READONLY .T.
Code: Select all
STATIC PROCEDURE DoInit2( cForm, lImage, cMemo )
LOCAL iMax := LEN( aTip )
* IF EMPTY( iMax )
* SetProperty( cForm, "Edit_1", "FONTSIZE", 48 )
Helpfile.Edit_1.FontSize := 48
* ENDIF
SetProperty( cForm, "Edit_1", "VALUE", cMemo )
RETURN
but Font Size does not change ...

what i´m doing wrong

Re: how to use different Font Size in RICHEDITBOX ?
Posted: Fri Jun 17, 2022 11:28 am
by gfilatov
AUGE_OHR wrote: ↑Fri Jun 17, 2022 10:17 am
hi,
i want to use different Font Size in RICHEDITBOX , how ?
...
what i´m doing wrong
Hi Jimmy,
You can use two ways for this need:
1) low-level formatting of the RTF-text via his internal RTF structure.
Example:
LOCA cDBAbout := ;
"{\rtf1\ansi\ansicpg1254\deff0\deflang1055\deflangfe1055{\fonttbl{\f0\fswiss\fprq2\" + ;
"fcharset162 Verdana;}{\f1\fswiss\fprq2\fcharset0 Verdana;}}{\colortbl;\red0\green0\blue255;}"+;
"{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\nowidctlpar\ri-1418\f0\fs18\par"+;
" HMG Data Base Assistant v." + ExeFD2Vrs() + "\par"+;
"\pard\nowidctlpar\ri-1748\qj\fs16\par \'a9 \cf1
esgici@gmail.com\par"+;
"\cf0\b\par \b0 DBA\b \b0 is an imitative work to the \'a9 \b dBASE III'\b0 s Assistant.\par"+;
"\par It may be an easy tool for people who are familiar to \par"+;
" this \b base\b0 architecture of the whole xBase family. \par"+;
"\par Many thanks to : \par\par"+;
" \b Antonio Linares \b0 ( Initiator of \'a9 \b Harbour\b0 ) and\par"+;
" \i Le Roy \b\i0 Roberto Lopez \b0 ( Initiator of \'a9 \b MiniGUI \b0 ).\par"+;
"\par Without this two big men and their volunteer coworkers, \par"+;
"\b \b0 DBA ( and many others of course) couldn't be exist.\par"+;
"\par\pard\sb100\sa100 \cf1\lang1033\f1 https://harbour.github.io\cf0\lang1055\f0\par"+;
"\pard\nowidctlpar\ri-1748\qj\cf1 http://harbourminigui.googlepages.com\cf0\par}"
...
DEFINE RICHEDITBOX rtfAbout
ROW 0
COL 0
WIDTH frmAbout.WIDTH - 4
HEIGHT frmAbout.HEIGHT - 24
VALUE cDBAbout
READONLY .T.
END RICHEDITBOX // rtfAbout
...
2) using the extra class RichText via the predefined commands (included in the Minigui Advanced samples).
Example:
Code: Select all
STATIC FUNCTION CoverPage( oRTF )
*********************************************************************
* Description: Generate a cover page.
* Arguments:
* Return:
*
*--------------------------------------------------------------------
* Date Developer Comments
* 01/28/97 TRM Creation
*
*********************************************************************
LOCAL i
LOCAL aTitle[3]
LOCAL aBullet[5]
// First, load some text...
aTitle[1] := "RichText() Sample Report Summary"
aTitle[2] := "NOTE: This report includes an automated table of contents. " + ;
"If you are using MS-Word, you can create the table of contents " + ;
"via the Insert\Indexes and Tables... option. Be sure to tell " + ;
'MS-Word to generate the table from "table entries", rather ' + ;
'than from "styles".'
aBullet[1] := "This report is a demonstration of some of the capabilities " + ;
"of the RichText() class for Clipper & Fivewin, Version 1.0, written " + ;
"by Tom Marchione. This is the free version, which contains a " + ;
"basic feature set (please review the README file for certain " + ;
"minor usage restrictions). If you have any comments or questions, " + ;
"feel free to send an E-Mail to tmarchione@compuserve.com."
aBullet[2] := "RichText() lets you generate reports to RTF files, like this " + ;
"one. RTF files can be read by most word processors, so this " + ;
"is a way to move fully-formatted information into word processor " + ;
"format, without lots of extra spaces and carriage returns. " + ;
"The class can form the basis of a true database publishing system."
aBullet[3] := "RichText() is not meant to be a front-line report engine in " + ;
"its current form, in the sense that database programmers " + ;
"expect report generators to have certain standard features. " + ;
"Nevertheless, it can be very useful for meeting specialized, " + ;
"custom reporting requirements, particularly if you need to edit or " + ;
"manipulate the output."
aBullet[4] := "In its current form, the system is fairly quirky. " + ;
"The good news is that, generally, you can get exactly what you " + ;
"want in one or two code iterations. I plan to address " + ;
"various usability issues in future versions."
aBullet[5] := "The pages that follow contain some examples of the types of " + ;
"things that can be done with RichText(). Remember, RichText() " + ;
"is designed to link to a word processor, so its capabilities " + ;
"focus on standard word processing features, rather than the " + ;
"kinds of things that are important in a standard report " + ;
"generator. Hope you find it useful!"
// Write the title lines
NEW PARAGRAPH oRTF TEXT aTitle[1] ;
FONTNUMBER 1 ;
FONTSIZE 18 ;
APPEARANCE BOLD_ON ;
ALIGN CENTER ;
SETDEFAULT ;
TOCLEVEL 1 // 10/24/97 -- mark this for the Table of Contents.
NEW PARAGRAPH oRTF TEXT ""
NEW PARAGRAPH oRTF TEXT aTitle[2] ;
FONTSIZE 10 ;
APPEARANCE BOLD_OFF + ITALIC_ON ;
ALIGN LEFT ;
INDENT -.5 ;
RIGHTINDENT -.5
NEW PARAGRAPH oRTF TEXT "" ;
APPEARANCE BOLD_OFF + ITALIC_OFF ;
SETDEFAULT
// Write the bullet items
FOR i := 1 TO LEN( aBullet )
NEW PARAGRAPH oRTF TEXT aBullet[i] ;
FONTNUMBER 2 ;
FONTSIZE 11 ;
ALIGN LEFT ;
INDENT .25 ;
FIRSTINDENT -.25 ;
BULLETED ;
SPACEBEFORE .4 ;
SETDEFAULT
NEXT
NEW PARAGRAPH oRTF TEXT "" SETDEFAULT
RETURN NIL
************************ END OF CoverPage() ***********************
I've attached the result output RTF-file for your review.

Re: how to use different Font Size in RICHEDITBOX ?
Posted: Fri Jun 17, 2022 11:58 am
by AUGE_OHR
hi Grigory,
thx for Help.
have found out that i have to "Select" Part which i want to "modify"
Code: Select all
SetProperty( cForm, "Edit_1", "VALUE", cMemo )
IF EMPTY( iMax )
DoMethod( cForm, "Edit_1", "SelectAll" )
SetProperty( cForm, "Edit_1", "FONTSIZE", 36 )
DoMethod( cForm, "Edit_1", "UnSelectAll")
ENDIF
here i use "SelectAll" but normal it need "SelectRange" when just want 1 Word to "modify"