@...RICHEDITBOX / DEFINE RICHEDITBOX
Creates a RichEditBox Control

 

 

 

Standard Syntax (xBase Style):

 

 

      @ <nRow>,<nCol> RICHEDITBOX <ControlName>

            [ OF | PARENT> <ParentWindowName> ]

            [ WIDTH <nWidth> ]

            [ HEIGHT <nHeight> ]

            [ FIELD <Field> ]

            [ VALUE <cValue> ]

            [ READONLY ]

            [ FONT <cFontName> ]

            [ SIZE <nFontSize> ]

            [ BOLD ]

            [ ITALIC ]

            [ UNDERLINE ]

            [ STRIKEOUT ]

            [ TOOLTIP <cToolTip> ]

            [ BACKCOLOR <aBackColor> ]

            [ MAXLENGTH <nMaxLength> ]

            [ ON GOTFOCUS <OnGotFocusProcedure> | <bBlock> ]

            [ ON CHANGE <OnChangeProcedure> | <bBlock> ]

            [ ON LOSTFOCUS <OnLostFocusProcedur> | <bBlock> ]

            [ HELPID <nHelpId> ]

            [ INVISIBLE ]

            [ NOTABSTOP ]

            [ NOHSCROLL ]

            [ NOVSCROLL ]

            [ ON SELECT <OnSelectChangeProcedure> | <bBlock> ]

            [ ON LINK <OnLinkProcedure> | <bBlock> ]

            [ ON VSCROLL  <OnVScrollProcedure> | <bBlock> ]

 

 

Alternate Syntax:

 

 

      DEFINE RICHEDITBOX <ControlName>

            PARENT <ParentWindowName>

            ROW <nValue

            COL <nValue>

            WIDTH <nWidth>

            HEIGHT <nHeight>

            FIELD <Field>

            VALUE <cValue>

            READONLY <lValue>

            FONTNAME <cFontName>

            FONTSIZE <nFontSize>

            FONTBOLD <lvalue>

            FONTITALIC <lValue>

            FONTUNDERLINE <lValue>

            FONTSTRIKEOUT <lValue>

            TOOLTIP <cToolTip>

            BACKCOLOR <aBackColor>

            MAXLENGTH <nMaxLength>

            ONGOTFOCUS <OnGotFocusProcedure>

            ONCHANGE <OnChangeProcedure>

            ONLOSTFOCUS <OnLostFocusProcedure>

            HELPID <nHelpId>

            VISIBLE <lValue>

            TABSTOP <lValue>

            HSCROLL <lValue>

            VSCROLL <lValue>

            ONSELECT <OnSelectChangeProcedure>

            ONLINK <OnLinkProcedure>

            ONVSCROLL <OnVScrollProcedure>

 

      END RICHEDITBOX

 

 

Properties:

 

 

      - Value

      - Enabled

      - Visible

      - Row

      - Col

      - Width

      - Height

      - FontName

      - FontSize

      - FontBold

      - FontItalic

      - FontUnderline

      - FontStrikeout

      - ToolTip

      - BackColor

      - CaretPos

      - Name (R)

      - Field (D)

      - Parent (D)

      - ReadOnly

      - MaxLength (D)

      - HelpId (D)

      - Break (D)

      - TabStop (D)

 

      D: Available at control definition only

      R: Read-Only

 

 

Events:

 

 

      - OnGotFocus

      - OnChange

      - OnLostFocus

      - OnSelect

      - OnLink

      - OnVScroll

 

 

Methods:

 

 

      - Show

      - Hide

      - SetFocus

      - Release

      - Save

      - Refresh

 

 

 

# RICHEDITBOX Control improvement

 

 

   - New Properties:

 

 

     <FormName>.<ControlName>.FontName        --> cFontName

     <FormName>.<ControlName>.FontSize        --> nFontSize

     <FormName>.<ControlName>.FontBold        --> lBoolean

     <FormName>.<ControlName>.FontItalic      --> lBoolean

     <FormName>.<ControlName>.FontUnderline   --> lBoolean

     <FormName>.<ControlName>.FontStrikeOut   --> lBoolean

     <FormName>.<ControlName>.FontColor       --> aRGBcolor

     <FormName>.<ControlName>.FontBackColor   --> aRGBcolor

     <FormName>.<ControlName>.FontScript      --> RTF_SUBSCRIPT | RTF_SUPERSCRIPT | RTF_NORMALSCRIPT

     <FormName>.<ControlName>.Link            --> lBoolean

 

     <FormName>.<ControlName>.FontName        :=  cFontName

     <FormName>.<ControlName>.FontSize        :=  nFontSize

     <FormName>.<ControlName>.FontBold        :=  lBoolean

     <FormName>.<ControlName>.FontItalic      :=  lBoolean

     <FormName>.<ControlName>.FontUnderline   :=  lBoolean

     <FormName>.<ControlName>.FontStrikeOut   :=  lBoolean

     <FormName>.<ControlName>.FontColor       :=  aRGBcolor | RTF_FONTAUTOCOLOR

     <FormName>.<ControlName>.FontBackColor   :=  aRGBcolor | RTF_FONTAUTOBACKCOLOR

     <FormName>.<ControlName>.FontScript      :=  RTF_SUBSCRIPT | RTF_SUPERSCRIPT | RTF_NORMALSCRIPT

     <FormName>.<ControlName>.Link            :=  lBoolean

 

 

     ThisRichEditBox.GetClickLinkRange --> { nMinPos, nMaxPos } // only valid into ON LINK Procedure

     ThisRichEditBox.GetClickLinkText  --> cLinkText            // only valid into ON LINK Procedure

 

 

 

     <FormName>.<ControlName>.RTFTextMode     --> lBoolean

     <FormName>.<ControlName>.AutoURLDetect   --> lBoolean

     <FormName>.<ControlName>.Zoom            --> nZoomPercentage

     <FormName>.<ControlName>.SelectRange     --> { nMinPos, nMaxPos }

     <FormName>.<ControlName>.CaretPos        --> nPos

     <FormName>.<ControlName>.Value           --> cText

     <FormName>.<ControlName>.ViewRect        --> { nLeft, nTop, nRight, nBottom }

     <FormName>.<ControlName>.GetSelectText   --> cSelectText

     <FormName>.<ControlName>.GetTextLength   --> nLengthText

     <FormName>.<ControlName>.GetTextRange ( {nMinPos, nMaxPos} ) --> cTextRange

     <FormName>.<ControlName>.GetPosChar   ( nPos ) --> { nScreenRow, nScreenCol }

                                                        or { -1, -1 } if character is not displayed

 

     <FormName>.<ControlName>.RTFTextMode     :=  lBoolean

     <FormName>.<ControlName>.AutoURLDetect   :=  lBoolean

     <FormName>.<ControlName>.Zoom            :=  nZoomPercentage

     <FormName>.<ControlName>.SelectRange     :=  { nMinPos, nMaxPos }

     <FormName>.<ControlName>.CaretPos        :=  nPos

     <FormName>.<ControlName>.Value           :=  cText

     <FormName>.<ControlName>.ViewRect        :=  { nLeft, nTop, nRight, nBottom }

 

 

 

     <FormName>.<ControlName>.AddText          ( nPos ) := cText

     <FormName>.<ControlName>.AddTextAndSelect ( nPos ) := cText

 

     <FormName>.<ControlName>.CanPaste        --> lBoolean

     <FormName>.<ControlName>.CanUndo         --> lBoolean

     <FormName>.<ControlName>.CanRedo         --> lBoolean

 

     <FormName>.<ControlName>.BackGroundColor :=  aRGBcolor | RTF_AUTOBACKGROUNDCOLOR

 

 

 

     <FormName>.<ControlName>.ParaAlignment       --> RTF_LEFT | RTF_RIGHT | RTF_CENTER | RTF_JUSTIFY

     <FormName>.<ControlName>.ParaNumbering       --> RTF_NOBULLETNUMBER | RTF_BULLET | RTF_ARABICNUMBER |

                                                      RTF_LOWERCASELETTER | RTF_UPPERCASELETTER |

                                                      RTF_LOWERCASEROMANNUMBER | RTF_UPPERCASEROMANNUMBER |

                                                      RTF_CUSTOMCHARACTER

     <FormName>.<ControlName>.ParaNumberingStyle  --> RTF_NONE | RTF_PAREN | RTF_PARENS | RTF_PERIOD |

                                                      RTF_PLAIN | RTF_NONUMBER | RTF_NEWNUMBER

     <FormName>.<ControlName>.ParaNumberingStart  --> nNumberingStart

     <FormName>.<ControlName>.ParaOffset          --> nParagraphOffset  // in millimeters

     <FormName>.<ControlName>.ParaLineSpacing     --> nInterLineSpacing

     <FormName>.<ControlName>.ParaIndent          --> nParagraphIndent  // in millimeters

 

 

     <FormName>.<ControlName>.ParaAlignment       :=  RTF_LEFT | RTF_RIGHT | RTF_CENTER | RTF_JUSTIFY

     <FormName>.<ControlName>.ParaNumbering       :=  RTF_NOBULLETNUMBER | RTF_BULLET | RTF_ARABICNUMBER |

                                                      RTF_LOWERCASELETTER | RTF_UPPERCASELETTER |

                                                      RTF_LOWERCASEROMANNUMBER | RTF_UPPERCASEROMANNUMBER |

                                                      RTF_CUSTOMCHARACTER

     <FormName>.<ControlName>.ParaNumberingStyle  :=  RTF_NONE | RTF_PAREN | RTF_PARENS | RTF_PERIOD |

                                                      RTF_PLAIN | RTF_NONUMBER | RTF_NEWNUMBER

     <FormName>.<ControlName>.ParaNumberingStart  :=  nNumberingStart

     <FormName>.<ControlName>.ParaOffset          :=  nParagraphOffset  // in millimeters

     <FormName>.<ControlName>.ParaLineSpacing     :=  nInterLineSpacing

     <FormName>.<ControlName>.ParaIndent          :=  nParagraphIndent  // in millimeters

 

 

 

     <FormName>.<ControlName>.FindText       ( cFind, lDown,    lMatchCase, lWholeWord, lSelectFindText ) --> { nMinPos, nMaxPos }

     <FormName>.<ControlName>.ReplaceText    ( cFind, cReplace, lMatchCase, lWholeWord, lSelectFindText ) --> { nMinPos, nMaxPos }

     <FormName>.<ControlName>.ReplaceAllText ( cFind, cReplace, lMatchCase, lWholeWord, lSelectFindText ) --> { nMinPos, nMaxPos }

 

 

     - Note:

 

       - ParaNumbering

 

            RTF_NOBULLETNUMBER       --> No paragraph numbering or bullets

            RTF_BULLET               --> Insert a bullet at the beginning of each selected paragraph

            RTF_ARABICNUMBER         --> Use Arabic numbers          ( 0,  1,   2, ... )

            RTF_LOWERCASELETTER      --> Use lowercase letters       ( a,  b,   c, ... )

            RTF_UPPERCASELETTER      --> Use lowercase Roman letters ( i, ii, iii, ... )

            RTF_LOWERCASEROMANNUMBER --> Use uppercase letters       ( A,  B,   C, ... )

            RTF_UPPERCASEROMANNUMBER --> Use uppercase Roman letters ( I, II, III, ... )

            RTF_CUSTOMCHARACTER      --> Uses a sequence of characters beginning with the Unicode

                                        character specified by the ParaNumberingStart value

 

       - ParaNumberingStyle

 

            RTF_NONE    

            RTF_PAREN     --> Follows the number with a right parenthesis

            RTF_PARENS    --> Encloses the number in parentheses

            RTF_PERIOD    --> Follows the number with a period

            RTF_PLAIN     --> Displays only the number

            RTF_NONUMBER  --> Continues a numbered list without applying the next number or bullet

            RTF_NEWNUMBER --> Starts a new number with ParaNumberingStart value

 

 

   - New Methods:

 

 

     <FormName>.<ControlName>.SelectAll

     <FormName>.<ControlName>.UnSelectAll

 

     <FormName>.<ControlName>.SelCopy

     <FormName>.<ControlName>.SelPaste

     <FormName>.<ControlName>.SelCut

     <FormName>.<ControlName>.SelClear

 

     <FormName>.<ControlName>.Undo

     <FormName>.<ControlName>.Redo

     <FormName>.<ControlName>.ClearUndoBuffer

 

     <FormName>.<ControlName>.RTFLoadFile ( cFileName | cResouceName , lSelectText )

     <FormName>.<ControlName>.RTFSaveFile ( cFileName , lSelectText )

 

     <FormName>.<ControlName>.RTFPrint ( { nMinPos, nMaxPos } , nLeft , nTop , nRight , nBottom , PrintPageCodeBlock )

 

Note:

- Before invoking the RTFPrint() method you should call the SELECT PRINTER

- nLeft , nTop , nRight , nBottom are the margins of the paper expressed in millimeters

- PrintPageCodeBlock is a code block that is executed to send each page of the document to the printer,

  e.g. PrintPageCodeBlock := { || @ nRow , nCol PRINT "Pag. " + HB_NTOS( nPag++ ) CENTER }

 

 

 

See demo:

    \SAMPLES\Controls\RichEditBox