Class TWPCustomRtfEdit

Hierarchy

System.TObject | System.Classes.TPersistent | System.Classes.TComponent | Vcl.Controls.TControl | Vcl.Controls.TWinControl | Vcl.Controls.TCustomControl | WPRTEDefs.TWPCustomRTFControl | TWPCustomRtfEdit

Subclasses

WPCTRMemo.TWPPreview | WPCTRRich.TWPCustomRichText | WPCTRStyleScroller.TWPStyleScroller

Description

This is the central component in WPTools, the editor. It hosts the 'RTF-Engine' which is defined in class RTFEngineMemo.RTFDataA) The editor will always creates line breaks to fit the lines on the current page width (

Properties

Property AcceptFiles : Boolean

Property AcceptFilesOptions : TWPAcceptFilesOptions

Property ActiveFirstPar : TParagraph

Property ActiveLineLen : Integer

Property ActiveLineStart : Integer

Property ActiveParagraph : TParagraph

Property ActivePosInPar : Integer

Property ActiveSection : TWPRTFSectionProps

Property ActiveStyleName : string

Property ActiveText : TWPRTFDataBlock

Property AsString : string

Property AsWebpage : TWPWebPageFormat

Property Attr : TAttr

Property AutomaticTextAttr : TCharacterAttr

Property AutoZoom : TWPAutoZoom

Property AutoZoomMin : Integer

Property AvailableDialogs : TWPCustomRtfEditDialogs

Property BevelEdges : TBevelEdges

Property BevelKind : TBevelKind

Property BodyText : TWPRTFDataBlock

Property BookmarkTextAttr : TCharacterAttrTags

Property BorderStyle : TBorderStyle

Property Canvas : TCanvas

Property Caret : TWPCaret

Property CaretDisabled : Boolean

Property Cell[RowNr][ColNr] : TParagraph

Property ClickableCodes : TWPTextObjTypes

Property ClipboardOptions : TWPClipboardOptions

Property ClipboardOptionsEx : TWPClipboardOptionsEx

Property ColorDesktop : TColor

Property ColorDesktopTo : TColor

Property Columns : Integer

Property CPChar : Char

Property CPCharAttr : Cardinal

Property CPChars[index] : Char

Property CPColNr : Integer

Property CPLine : string

Property CPLineNr : Integer

Property CPLineNrLog : Integer

Property CPObj : TWPTextObj

Property CPPage : Integer

Property CPPageLineNr : Integer

Property CPPar : string

Property CPParNr : Integer

Property CPPosInPar : Integer

Property CPPosition : Integer

Property CPPrevChar : Char

Property CPPrevWideChar : Char

Property CPWideChar : Char

Property CPWord : string

Property CPXPos : Integer

Property CPYPos : Integer

Property CurrentMouseButton : TMouseButton

Property CurrentZooming : Integer

Property CursorOnText : TWPRTFDataBlock

Property CustomSyntax : TWPAbstractCustomSyntax

Property DebugMode : TWPDebugMode

Property DefaultNumberIndent : Integer

Property DeskGradientHorizontal : Boolean

Property DisabledDialogsInPreview : TWPCustomRtfEditDialogs

Property DisplayedText : TWPRTFDataBlock

Property DropHandled : Boolean

Property EditBoxModes : TWPEditBoxModes

Property EditOptions : TWPEditOptions

Property EditOptionsEx : TWPEditOptionsEx

Property EditOptionsEx2 : TWPEditOptionsEx2

Property EditOptionsEx3 : TWPEditOptionsEx3

Property FieldObjectTextAttr : TCharacterAttr

Property Finder : TWPTextFinder

Property FirstPar : TParagraph

Property Font : TWPFont

Property FormatOptions : TWPFormatOptions

Property FormatOptionsEx : TWPFormatOptionsEx

Property FormatOptionsEx2 : TWPFormatOptionsEx2

Property FormatOptionsEx3 : TWPFormatOptionsEx3

Property FormCompletion : Boolean

Property GraphicPopupMenu : TPopupMenu

Property HandleRichEditMsg : Boolean

Property Header : TTextHeader

Property HeaderFooter : TWPRTFDataCollection

Property HiddenTextAttr : TCharacterAttr

Property HideTableBorders : TWPHideTableBordersMode

Property HighLightColor : TColor

Property HighLightTextColor : TColor

Property HyperLinkCursor : TCursor

Property HyperlinkObj : TWPTextObj

Property HyperlinkTextAttr : TCharacterAttrTags

Property ImeMode : TImeMode

Property ImeName : TImeName

Property InBeforeChange : Boolean

Property InScrollTrackMode : Boolean

Property Inserting : Boolean

Property InsertPointAttr : TCharacterAttrTags

Property InWaitForPaintEditor : Boolean

Property KeyInLock : Boolean

Property LabelDef : TWPLabelDef

Property LastFileName : string

Property LastLoadPath : string

Property LastPar : TParagraph

Property LastSavePath : string

Property LayoutMode : TWPLayoutMode

Property LeftOffset : Integer

Property Lines : TStrings

Property Memo : TWPRTFEnginePaint

Property Modified : Boolean

Property MouseMarginArea : TWPMouseMarginArea

Property MousePage : Integer

Property MouseX : Integer

Property MouseY : Integer

Property OneClickHyperlink : Boolean

Property PageColumns : Integer

Property PageCount : Integer

Property PageHintColor : TColor

Property PageMaxCount : Integer

Property PageMinCount : Integer

Property Pagenumber : Integer

Property PaperColor : TColor

Property PaperDefs : TWPPaperDefinitionCollection

Property PopupMenu : TPopupMenu

Property PrintParameter : TWPPrintParameter

Property ProtectedProp : TProtectProp

Property ProtectedTextAttr : TCharacterAttr

Property Readonly : Boolean

Property Resizing : Integer

Property Rows : Integer

Property RTFData : TWPRTFDataCollection

Property RTFText : TWPRTFBlobContents

Property RTFVariables : TWPRTFExtraDataCollection

Property ScrollBars : TScrollStyle

Property ScrollHorzMultiplicator : Single

Property ScrollVertMultiplicator : Single

Property SecurityOptions : TWPSecurityModes

Property SelectedObject : TWPTextObj

Property SelectionAsString : string

Property SelLength : Integer

Property SelRect : TRect

Property SelStart : Integer

Property SelText : string

Property ShowMergeFieldNames : Boolean

Property ShowPagenumber : Boolean

Property SinglePageMode : Boolean

Property SPANObjectTextAttr : TCharacterAttrTags

Property SpeechReconitionInterfaceMode : TWPSpeechReconitionInterfaceMode

Property SpellCheckStrategie : TWPSpellCheckStrategie

Property SpellIgnoredForObj : TWPTextObjTypes

Property Table : TParagraph

Property TableAtEndOfCell : Boolean

Property TableCell : TParagraph

Property TableCellWidth : Integer

Property TableColCount : Integer

Property TableColNumber : Integer

Property TableRow : TParagraph

Property TableRowCount : Integer

Property TableRowNumber : Integer

Property text : string

Property TextColorCount : Integer

Property TextColorDefault : TColor

Property TextColors[Index] : TColor

Property TextLength : Integer

Property TextLoadFormat : string

Property TextLoadFormatClipboard : string

Property TextLoadSaveOptions : string

Property TextObjectCursor : TCursor

Property TextObjects : TWPObjectEnv

Property TextSaveFormat : string

Property TextSaveFormatClipboard : string

Property TopOffset : Integer

Property TopVisiblePar : TParagraph

Property Transparent : Boolean

Property ViewOptions : TWPViewOptions

Property ViewOptionsEx : TWPViewOptionsEx

Property ViewOptionsEx2 : TWPViewOptionsEx2

Property ViewPage : Integer

Property ViewRTFData : TWPRTFDataCollection

Property WantReturns : Boolean

Property WantTabs : Boolean

Property WordWrap : Boolean

Property WPDataSetAdapter : TWPDataSetAbstractAdapter

Property WPRTFPropsComponent : TWPRTFProps

Property WPTextObjectClasses : TWPTextObjectClasses

Property WriteObjectMode : TWPObjectWriteRTFModeGlobal

Property XBetween : Integer

Property XOffset : Integer

Property YBetween : Integer

Property YOffset : Integer

Property YOffsetNormal : Integer

Property Zooming : Integer

Methods

Procedure _BeforeChangeTopLeftOffset(offset_top:Integer; offset_left:Integer)

Procedure _MakeDynamic

Procedure _MakeEditable

Procedure _RefreshMsglist

Function ActivePar : TParagraph

Function AddDynamicGrid(tablename:string; adapter:TWPDataSetAbstractAdapter; parent_grid:TParagraph; rowheigth:Integer; Options:TWPTableAddOptions; fieldlist:TStrings; RowGroupLevel:Integer; StyleForCells:TWPTextStyle; StyleForHeader:TWPTextStyle; StyleForFooter:TWPTextStyle; DoPrepareTemplateRow:TWPPrepareTemplateRow; TableAddCellCallBack:TWPTableAddCellEvent) : TParagraph

Function AddParagraphs(type_outside:TWPParagraphType; count_inside:Integer; type_inside:TWPParagraphType; Options:TWPAddParagraphsOptions) : TParagraph

Function AddTable(colcount:Integer; lincount:Integer; Border:Boolean) : TParagraph

Procedure ADel(WPAT_Code:Byte)

Function AGet(WPAT_Code:Byte; Value:Integer) : Boolean

Function AHasStyleDef(WPAT_Code:Integer) : Boolean

Function AppendAsSection(FromEditor:TWPCustomRtfEdit; Options:TWPAppendAsSectionOptions) : TWPRTFSectionProps

Function AsANSIString(FormatName:string; OnlySelection:Boolean; CellsAsParagraphs:Boolean) : AnsiString

Procedure ASet(WPAT_Code:Byte; Value:Integer)

Procedure ASetAdd(WPAT_Code:Byte; Value:Cardinal)

Procedure ASetDel(WPAT_Code:Byte; Value:Cardinal)

Procedure Assign(Source:TPersistent)

Procedure AssignPrintProperties(Source:TWPCustomRtfEdit)

Procedure AssignToFooter(Source:TObject; Range:TWPPagePropertyRange)

Procedure AssignToHeader(Source:TObject; Range:TWPPagePropertyRange)

Function AttrHelper : TWPStoredCharAttrInterface

Function BasisRowCompare(Item1:TParagraph; Item2:TParagraph; Param:Integer; mode:TWPParagraphCompareModes; SortData:TObject) : Integer

Procedure BeforeDestruction

Function BeginPrint(Title:string; StartPageNumber:Integer; aPrinter:TPrinter) : Boolean

Procedure BeginTable(TableName:string; trgap:Integer; l:Integer; r:Integer)

Procedure BeginUpdate(DisableReadonly:Boolean)

Function Bof : Boolean

Function BookmarkAtCP : TWPTextObj

Function BookmarkAtParLin(par:TParagraph; pos_in_par:Integer) : TWPTextObj

Function BookmarkAtXY(X:Integer; Y:Integer; Bookmark:TWPTextObj) : Boolean

Procedure BookmarkDelete(AName:string; Marks:Boolean; text:Boolean)

Procedure BookmarkDeleteAllMarkers

Function BookmarkDeleteInPar(NameStart:string; par:TParagraph) : Boolean

Procedure BookmarkDeleteMarkers(AName:string)

Function BookmarkFind(AName:string; DoGlobalSearch:Boolean) : Integer

Function BookmarkFirstInPar(par:TParagraph) : string

Function BookmarkFirstObjInPar(par:TParagraph) : TWPTextObj

Function BookmarkForceInPar(par:TParagraph; frmstr:string) : string

Procedure BookmarkGetList(list:TStrings; FromAllBlock:Boolean)

Function BookmarkInput(AName:string; PlaceCursorBetweenTags:Boolean) : TWPTextObj

Function BookmarkMoveTo(AName:string; DoGlobalSearch:Boolean) : Boolean

Function BookmarkMoveToNext(AName:string; FindAnyName:Boolean) : Boolean

Function BookmarkSelect(AName:string; OnlyText:Boolean) : Boolean

Procedure BrushApply

Procedure BrushEnd

Procedure BrushStart(Mode:TWPFormatBrushMode)

Function CalcMousePageAtXY(WindowX:Integer; WindowY:Integer; UseMargins:Boolean) : Integer

Function CanRedo : Boolean

Function CanUndo : Boolean

Procedure ChangeApplied

Function Changing : Boolean

Function CheckHasBody : Boolean

Procedure CleanTemporaryCharAttr

Procedure Clear

Procedure ClearBody

Procedure ClearEx(DontClearStyles:Boolean; DontResetPageSize:Boolean; ResetWritingAttr:Boolean)

Procedure ClearHeaderFooter

Procedure ClearSections

Function ClearSelection(OverwriteProtection:Boolean; UpdateCursorPosition:Boolean) : Boolean

Function ClipbrdFormatName(cfFormat:Integer) : string

Function CodeDeletePairs(ObjType:TWPTextObjType; AName:string; Contents:Boolean) : Integer

Function CodeExistInText(Code:TWPTextObjType; GlobalSearch:Boolean; startpar:TParagraph) : Boolean

Function CodeInsideOf(X:Integer; Y:Integer; objtype:TWPTextObjType) : TWPTextObj

Function CodeListTags(Code:TWPTextObjType; AName:string; GlobalSearch:Boolean) : TWPTextObjList

Function CodeLoadSaveEmbeddedText(Stream:TStream; format:string; SaveText:Boolean; AName:string; Code:TWPTextObjType; LocateOptions:TWPCodeLocateOptions) : Boolean

Function CodeLocate(ResultPar:TParagraph; ResultPosInPar:Integer; AName:string; Code:TWPTextObjType; CmpModes:TWPTextObjModes; LocateOptions:TWPCodeLocateOptions; CmpStr2:string) : Boolean

Function CodeMoveTo(AName:string; Code:TWPTextObjType; CmpModes:TWPTextObjModes; LocateOptions:TWPCodeLocateOptions) : Boolean

Function CodeObjectAtXY(X:Integer; Y:Integer; Code:TWPTextObj) : Boolean

Function CodeRename(objtype:TWPTextObjType; OldName:string; NewName:string; FromAllBlocks:Boolean; CaseSensitive:Boolean) : Integer

Function CodeSelect(AName:string; Code:TWPTextObjType; OnlyText:Boolean; StopAtParEnd:Boolean; LocateOptions:TWPCodeLocateOptions) : Boolean

Function CodeSelectText(StartTag:TWPTextObj; IncludingTags:Boolean) : Boolean

Function CombineCells : Boolean

Function CombineCellsVertHorz : Boolean

Function CombineCellsVertically : Boolean

Function CombineTables : Boolean

Function ConvertTablesToText(poConversionMode:TWPConversionMode; psOther:string) : Integer

Function ConvertTableToText(poConversionMode:TWPConversionMode; psOther:string; aTable:TParagraph) : Boolean

Function ConvertToCPPosition(CountOfChar:Integer; CountForCR:Integer) : Integer

Function CopyAttr : string

Procedure CopyToClipboard(CompleteText:Boolean)

Procedure CopyToClipboardAttr(Mode:TWPFormatBrushMode)

Function CountLines : Integer

Function CountPages : Integer

Function CountParagraphs : Integer

Function CountWords : Integer

Function CPAttr : TWPTAttrEmulator

Function CPLogicalParagraphEnd : Integer

Function CPMoveBack : Boolean

Function CPMoveDownLine : Boolean

Function CPMoveDownPar : Boolean

Function CPMoveNext : Boolean

Function CPMoveTo(X:Integer; Y:Integer; DontLeaveDataBlock:Boolean) : Boolean

Function CPMoveToItem(Mode:TWPMoveItemMode; Previous:Boolean) : Boolean

Function CPMoveUpLine : Boolean

Function CPMoveUpPar : Boolean

Function CPPagenrAsDisplayed : Integer

Create(aOwner:TComponent)

CreateDynamic

Function CreateTableOfContents(AName:string; BookMarkId:string; Mode:TWPCreateTableOfContentsMode; StopPar:TParagraph; TitleText:string; FirstPar:TParagraph) : Integer

Function CurrentCharAttr : TWPCursorCharAttrInterface

Function CurrentEditField : string

Procedure CutToClipboard

Function DBChanging : Boolean

Function DefaultAttr : TWPOwnedCharAttrInterface

Procedure DelayedInvalidate(Code:Integer)

Procedure DelayedReformat(keepscrollposition:Boolean)

Procedure DeleteChar(Count:Integer)

Function DeleteColumn : Boolean

Procedure DeleteField(AName:string; Contents:Boolean)

Function DeleteFieldAtCP : Boolean

Procedure DeleteFields

Procedure DeleteFocusValues

Procedure DeleteHyperlink(RemoveText:Boolean)

Function DeleteLeadingSpace(EmptyFieldsToo:Boolean; InFirstPar:Boolean) : Boolean

Procedure DeletePage(index:Integer)

Procedure DeleteParagraphBreaks(Mode:TWPDeleteParagraphBreakModes)

Function DeleteParWithCondition(Condition:TWPCheckParagraph) : Boolean

Function DeleteParWithEmptyFields : Boolean

Function DeleteParWithText(FindText:string) : Boolean

Function DeleteRow : Boolean

Function DeleteTable : Boolean

Function DeleteTrailingSpace(EmptyFieldsToo:Boolean; KeepPageBreakAtEnd:Boolean) : Boolean

Destroy

Procedure DoAfterImageSaving(RTFData:TWPRTFDataCollectionBase; Writer:TWPCustomTextWriter; TextObject:TWPTextObj)

Procedure DoPrepareImageforSaving(RTFData:TWPRTFDataCollectionBase; Writer:TWPCustomTextWriter; TextObject:TWPTextObj; DontSave:Boolean)

Procedure DoRequestHTTPImage(RTFData:TWPRTFDataCollectionBase; Reader:TWPCustomTextReader; LoadPath:string; URL:string; TextObject:TWPTextObj; Ok:Boolean)

Procedure DoRequestHTTPString(RTFData:TWPRTFDataCollectionBase; Reader:TWPCustomTextReader; LoadPath:string; URL:string; LoadedString:AnsiString; Ok:Boolean)

Procedure DoUpdateCharAttr

Procedure DoUpdateEditState

Procedure DoUpdateEditStateEx(selection_marked:Boolean; clipboard_not_empty:Boolean; sel:TWPSelectionContents)

Procedure DoUpdateParAttr

Procedure DoUpdateState(State:TWPEditBoxLinkMsg)

Procedure DoUpdateUndoState

Procedure DragDrop(Source:TObject; X:Integer; Y:Integer)

Function Draw(outCanvas:TCanvas; X:Integer; Y:Integer; H:Integer; xres:Integer; yres:Integer; starty:Integer; HandlePageBreaks:Boolean) : Integer

Function EndPrint(aPrinter:TPrinter) : Boolean

Procedure EndTable

Procedure EndUndolevel

Procedure EndUpdate

Procedure EnumText(Callback:TWPEnumTextCallback; Mode:TWPEnumTextModes; AllTexts:Boolean)

Function Enviroment : TWPToolsBasicEnviroment

Function Eof : Boolean

Function ExitEditor : Boolean

Function FastAppendActiveLine(Source:TWPCustomRtfEdit) : Boolean

Function FastAppendText(Source:TWPCustomRtfEdit; AsNewSection:Boolean; Mode:TWPFastAppendTextMode) : TWPRTFSectionProps

Procedure FastAppendTextParID(Source:TWPCustomRtfEdit; id:Integer; ProtectedFlag:Boolean)

Procedure FastAppendTextWithParID(Source:TWPCustomRtfEdit; id:Integer)

Function FieldAtCP(aField:TWPTextObj) : Boolean

Function FieldExists(FieldName:string) : Boolean

Function FieldGetInPar(par:TParagraph; posinpar:Integer) : TWPTextObj

Procedure FieldGetList(list:TWPTextObjList; FromAllBlock:Boolean; NameStartWith:string)

Function FieldGetNameInPar(par:TParagraph; posinpar:Integer) : string

Procedure FieldGetNames(list:TStrings; FromAllBlock:Boolean)

Function FieldLocate(FieldName:string; fieldcommand:string; FromStart:Boolean; Modes:TWPFieldLocateOptions) : TWPTextObj

Function FieldReadText(FieldName:string) : string

Function FieldRename(OldName:string; NewName:string; FromAllBlocks:Boolean; CaseSensitive:Boolean) : Integer

Function FindCell(paragraphname:string) : TParagraph

Function FindNext : Boolean

Function FindParagraph(paragraphname:string) : TParagraph

Function FindParWithText(searchtext:string) : TParagraph

Function FindTable(TableName:string) : TParagraph

Function FindTextBoxPar(name:string; AutoCreate:TWPTextBoxAutoCreate) : TParagraph

Function FindTextMethod(FindText:string; Options:TWPFindTextMethodOptions; WildCard:Char; ShowMessageBox:HWND) : Boolean

Function FixFontsOfText(RelacementFonts:; Charset:Integer) : Integer

Function FontListAssign(list:TStrings; Modes:TWPFontListAssignMode) : Integer

Function FooterText(Range:TWPPagePropertyRange) : TWPRTFDataBlock

Function FootNoteAtCP : TWPTextObj

Function FootnoteFindNext : Boolean

Function FootnoteFindPrior : Boolean

Procedure FootnoteGetList(list:TWPTextObjList; FromAllBlock:Boolean)

Function FootNoteInsert(nr:Integer; str:string) : TWPTextObj

Procedure FrameLine(Mode:TWPFrameLineMode; ScreenPos:Integer)

Procedure GetCellCommands(list:TStrings)

Procedure GetCellNames(list:TStrings)

Procedure GetCharAttr(Lock:TThreeState)

Function GetCodeTags(list:TWPTextObjList; Code:TWPTextObjType; AName:string; GlobalSearch:Boolean) : Boolean

Function GetColorNr(aColor:TColor) : Integer

Function GetCPXYPoint(ScreenPoint:TPoint) : Boolean

Function GetFontName(nr:Integer) : TFontName

Function GetFontNr(AName:TFontName) : Integer

Function GetHistoryChars(Count:Integer) : string

Function GetImageAtXY(X:Integer; Y:Integer; img_x:Integer; img_y:Integer; img_w:Integer; img_h:Integer) : TWPTextObj

Function GetLineFromXY(ScreenX:Integer; ScreenY:Integer; par:TParagraph; posinpar:Integer) : Boolean

Function GetLogCPPos : Integer

Function GetLogParPos(cppos:Integer; par:TParagraph; posinpar:Integer) : Boolean

Function GetObjectFromXY(ScreenX:Integer; ScreenY:Integer; TextObject:TWPTextObj) : Boolean

Function GetObjXYBottomlineScreen(obj:TWPTextObj; X:Integer; Y:Integer; right_pos:Boolean) : Boolean

Function GetPagesAsString(FromPage:Integer; ToPage:Integer; format:string) : string

Function GetPageXYfromXY(ScreenX:Integer; ScreenY:Integer; PageNr:Integer; PageXTW:Integer; PageYTW:Integer; par:TParagraph) : Boolean

Procedure GetPaperBins(aPrinter:TPrinter; list:TStrings; FirstName:string)

Function GetPar(ParIndex:Integer) : TParagraph

Function GetParXYBaselineScreen(par:TParagraph; posinpar:Integer; X:Integer; Y:Integer) : Boolean

Function GetPointFromParLin(par:TParagraph; posinpar:Integer) : TPoint

Procedure GetPosition(Pos:Integer; lin:Integer; par:Integer; pos_in_par:Integer)

Function GetRTData : TWPRTFDataCollectionBase

Function GetRTFEngine : TWPRTFEngineBasis

Procedure GetSelectedCells(All:TList; Outer:TList)

Function GetSelPosLen(Pos:Integer; len:Integer) : Boolean

Function GetSelStartEnd(startpar:TParagraph; startpos:Integer; endpar:TParagraph; endpos:Integer) : Boolean

Function GetStyleNameForNr(StyleNr:Integer) : string

Function GetStyleNrForName(StyleName:string) : Integer

Function GetTextBuf(Buffer:PAnsiChar; BufSize:Integer) : Integer

Function GetTextFast : string

Function GetTextLen : Integer

Function GetTextScreenRect(par:TParagraph; posinpar:Integer; X:Integer; Y:Integer; W:Integer; H:Integer; CharOffset:Boolean) : Boolean

Function GetUNICODE(OnlySelection:Boolean) : WideString

Function GetXPositionTw : Integer

Function GetYPositionTw : Integer

Procedure GotoBody(LastLine:Boolean)

Function HeaderText(Range:TWPPagePropertyRange) : TWPRTFDataBlock

Function HideParWithCondition(Condition:TWPCheckParagraph; DontShowOther:Boolean) : Boolean

Function HideSelection : Boolean

Function HyperlinkAtCP : TWPTextObj

Function HyperlinkConvertOldWPT3Links(OnlyIfHiddenTextWasFound:Boolean) : Integer

Function HyperlinkMoveTo(AName:string) : Boolean

Function HyperlinkSelect(URL:string; OnlyText:Boolean) : Boolean

Procedure IgnoreMouse

Procedure ImageGetList(list:TWPTextObjList; FromAllBlock:Boolean)

Procedure InplaceEditorGetList(list:TWPInplaceEditorList; ParInplace:Boolean; ObjInplace:Boolean; InParagraph:TParagraph; Modes:TWPLoopAllInplaceEditorModes; GroupFilter:Integer)

Function InputCode(Code:TWPTextObjType; AName:string; Command:string; Options:TWPInputCodeOptions) : TWPTextObj

Function InputEditField(FieldName:string; DisplayText:string; PlaceCaret:Boolean; Command:string; format:Integer) : TWPTextObj

Function InputFootnote(PlaceCursor:Boolean; CreateNumber:Boolean; InitText:string) : TWPTextObj

Function InputHyperlink(link_text:string; link_url:string) : TWPTextObj

Function InputInplaceEdit(EditName:string; InplaceClass:string; FieldWidth:Integer; FieldHeight:Integer; EditText:string; EditCommand:string; Params:string) : TWPTextObj

Function InputMergeField(FieldName:string; DisplayText:string; Command:string; format:Integer; DisplayChar:Char) : TWPTextObj

Function InputNewObject(objtype:TWPTextObjType; HasClosing:Boolean; IsClosing:Boolean; CharAttrIndex:Cardinal) : TWPTextObj

Function InputObject(obj:TWPObject) : TWPTextObj

Function InputParagraph(Count:Integer) : TParagraph

Function InputSection(Select:TWPRTFSectionPropsSelect; Mode:TWPInputSectionMode) : TWPRTFSectionProps

Function InputSingleCode(Code:TWPTextObjType; AName:string; Command:string) : TWPTextObj

Function InputSpanObjects(Attributes:TWPAbstractCharAttrInterface) : TWPTextObj

Procedure InputString(text:string; CodePage:Integer; PreserveSelectionAttr:Boolean)

Procedure InputStringInt(Value:Integer)

Procedure InputStringW(text:WideString; PreserveSelectionAttr:Boolean)

Function InputSymbol(aChar:Char; FontName:string) : TWPTextObj

Function InputTextbox(InitString:AnsiString; w:Integer; h:Integer; activate:Boolean; relx:Integer; rely:Integer) : TWPTextObj

Function InputTextField(Typ:TWPTextFieldType; FieldMask:string; FieldParams:string) : TWPTextObj

Function InputTextFieldName(FieldName:string; FieldMask:string; FieldParams:string) : TWPTextObj

Function InputTextProtection(Options:TWPInputCodeOptions) : TWPTextObj

Function InsertColumn(Before:Boolean) : Boolean

Function InsertPar : TParagraph

Function InsertRow : Boolean

Function InsertRowAbove : Boolean

Function InTable : Boolean

Procedure Invalidate

Function IsEmpty : Boolean

Function IsFirstLine : Boolean

Function IsLastLine : Boolean

Function IsSelected : Boolean

Function LoadCSSFile(CSSFileName:string; Merge:Boolean) : Integer

Function LoadCSSheet(StyleString:string; Merge:Boolean) : Integer

Procedure Loaded

Function LoadFromBuffer(Buffer:PAnsiChar; bufferlen:Integer; FormatName:string; WithClear:Boolean) : Boolean

Function LoadFromFile(FileName:string; WithClear:Boolean; FormatName:string) : Boolean

Function LoadFromStream(s:TStream; FormatName:string; WithClear:Boolean) : Boolean

Function LoadFromString(X:WideString; FormatString:string; WithClear:Boolean) : Boolean

Procedure LoadPropertiesFromDFM

Function LoadSelectionFromFile(aFileName:string; FormatName:string; SelectText:Boolean) : Boolean

Function LoadSelectionFromStream(s:TStream; FormatName:string; SelectText:Boolean) : Boolean

Function LockRichtext : Boolean

Procedure LockScreen(allowpaint:Boolean; lock_cursorpos:Boolean)

Procedure MergeActiveText(FieldName:string)

Procedure MergeEnumFields(FieldName:string; AllTexts:Boolean)

Procedure MergeText(FieldName:string; fieldcommand:string; AllTexts:Boolean)

Procedure MergeTextEx(FieldName:string; fieldcommand:string; MergeObjType:TWPTextObjType; Options:TWPMergeTextOptions)

Function MovePosition(how:TWPMoveMode; DoSelection:Boolean) : Boolean

Function MoveToCell(col:Integer; row:Integer; TableName:string) : Boolean

Function MoveToField(FieldName:string; from_start:Boolean) : Boolean

Function MoveToNextField(from_start:Boolean) : string

Function MoveToPreviousField(from_end:Boolean) : string

Function MoveToTable(TableName:string) : Boolean

Procedure NewUndolevel

Procedure NormalizeText(NormalizeTextMode:TWPNormalizeTextMode)

Function NrToColor(ColorIndex:Integer) : TColor

Function NumberStyles : TWPRTFNumberStyleCollection

Procedure OnToolBarSelection(Sender:TObject; Typ:TWpSelNr; str:string; num:Integer)

Function OpenCodeAt(par:TParagraph; posinpar:Integer; CheckedCodes:TWPTextObjTypes) : TWPTextObj

Function OpenCodeAtCP(Code:TWPTextObjType) : TWPTextObj

Function OpenCodes(X:Integer; Y:Integer; list:TWPTextObjList; CheckedCodes:TWPTextObjTypes; MaxCount:Integer) : TWPTextObj

Function OpenCodesAtCP(list:TWPTextObjList; Codes:TWPTextObjTypes) : TWPTextObj

Function OpenCodesAtCPDepth(Code:TWPTextObjType) : Integer

Function OpenDialog(DialogType:TWPCustomRtfEditDialog; Param:string) : Boolean

Procedure Paint

Function PaintPageOnCanvas(PaintPageNr:Integer; X:Integer; Y:Integer; pw:Integer; ph:Integer; DestCanvas:TCanvas; PaintMode:TWPPaintModes; DestXRes:Integer; DestYRes:Integer; ClipY:Integer; ClipH:Integer; PaintPageMode:TWPRTFEnginePaintPagesModes) : Boolean

Procedure PaintTo(DC:HDC; X:Integer; Y:Integer)

Function ParStyleCPMoveTo(StyleName:string) : Boolean

Function ParStyleLocateFirst(StyleName:string; startpar:TParagraph) : Boolean

Function ParStyleMarkForReformat(StyleName:string) : Integer

Function ParStyleNormalizePar(StyleName:string) : Integer

Function ParStylePaint(StyleName:string; toCanvas:TCanvas; r:TRect) : Integer

Function ParStyles : TWPRTFStyleCollection

Procedure PasteAttr(atr:string)

Procedure PasteFromClipboard(Mode:TWPPasteTextMode)

Function PendingUpdate(WPUPD_Code:Integer) : Boolean

Procedure PopAttr

Function Print(aPrinter:TPrinter) : Boolean

Function PrintBottomPos : Integer

Function Printing : Boolean

Function PrintPage(n:Integer; xoff:Integer; yoff:Integer; Options:TWPPrintOptions; aPrinter:TPrinter) : Boolean

Function PrintPageOnCanvas(toCanvas:TCanvas; r:TRect; Pagenumber:Integer; Mode:TPrintPageMode; przooming:Integer) : Boolean

Function PrintPages(FromPage:Integer; ToPage:Integer; aPrinter:TPrinter) : Boolean

Procedure ProcessDelayedUpdates

Procedure ProcessScrollEvent(Message:TWMScroll; vertical:Boolean)

Procedure PushAttr

Function ReadHyperlink(link:string; stamp:string) : Boolean

Function RecalcText(pars:Boolean; fields:Boolean) : Boolean

Function Redo : Boolean

Function ReformatAll(InitializeAll:Boolean; RepaintMemo:Boolean; ReformatProcedure:TWPAbstractRTFDataBlockFormatter) : Boolean

Procedure Refresh(SpellCheck:Boolean)

Function RefreshAniImages : Boolean

Procedure RemoveRTFData

Procedure Repaint

Function ReplaceTextMethod(FindText:string; ReplaceText:string; Options:TWPReplaceTextMethodOptions; WildCard:Char; StyleName:string; ShowMessageBox:HWND) : Integer

Function ReplaceTokens(opening:string; closing:string; FieldPreText:string; Mode:TWPReplaceTokensMode) : Integer

Function ReplaceTokensInAllTexts(opening:string; closing:string; FieldPreText:string; Mode:TWPReplaceTokensMode) : Integer

Procedure Resize

Function SaveChanging : Boolean

Procedure SaveCSSFile(CSSFileName:string)

Function SaveCSSheet : string

Function SaveSelectionToStream(s:TStream; FormatName:string) : Boolean

Function SaveToFile(FileName:string; SelectionOnly:Boolean; FormatName:string) : Boolean

Function SaveToStream(s:TStream; FormatName:string) : Boolean

Function SaveToString(FormatName:string; OnlySelection:Boolean) : WideString

Function ScreenToRTFPage(ScreenX:Integer; ScreenY:Integer; X:Integer; Y:Integer; RTFPageNr:Integer; IgnoreX:Boolean) : Boolean

Procedure ScrollLinePos(par:TParagraph; posinpar:Integer; LimitScrolling:Boolean)

Procedure ScrollToPosition(Pos:Integer; RelX:Integer; RelY:Integer)

Procedure SelectAll

Procedure SelectCell(par:TParagraph; Add:Boolean)

Function SelectedTextAttr : TWPSelectedTextAttrInterface

Function SelectFieldAtCP(IncludingTags:Boolean; PlaceCursorBetweenTags:Boolean) : Boolean

Procedure SelectLine

Function SelectPage(PageNr:Integer) : Boolean

Function SelectPages(startpage:Integer; endpage:Integer) : Boolean

Procedure SelectParagraph(par:TParagraph)

Procedure SelectThisCell

Procedure SelectThisColumn

Procedure SelectThisRow

Procedure SelectThisTable

Procedure SelectWord

Function SelectWordAtXY(X:Integer; Y:Integer; Extend:Boolean) : Boolean

Procedure SetBorderProperties(Inner:TWPTextStyle; Outer:TWPTextStyle; ApplyMode:TWPParagraphBordApply; Mode:TWPUpdateBorderProperties)

Procedure SetFocus

Procedure SetFocusValues(Always:Boolean)

Procedure SetImageMode(Mode:TWPSetImageMode)

Procedure SetInnerCellBorders(Activate:Boolean; BorderWidth:Integer; Mode:TWPParagraphBordApply)

Procedure SetOuterCellBorders(Activate:Boolean; BorderWidth:Integer; Mode:TWPParagraphBordApply)

Function SetParStyle(X:string) : TWPRTFStyleElement

Procedure SetPosition(topos:Integer; tolin:Integer; topar:Integer; topos_in_par:Integer)

Procedure SetPositionXY(X:Integer; Y:Integer)

Procedure SetRTFData(RTFData:TWPRTFDataCollection)

Procedure SetRTFDataOrProps(NewRTFData:TWPRTFDataCollection; NewRTFProps:TWPRTFProps)

Procedure SetScrollBarSize(horz:Boolean)

Procedure SetSelPosLen(Pos:Integer; len:Integer; UpdateDisplay:Boolean)

Procedure SetUNICODE(data:WideString; InsertText:Boolean)

Procedure SetZoom(ZoomValue:string)

Procedure SetZoomMode(ZoomShortcutValue:Integer)

Procedure ShowCursor

Procedure Spell_FromCursorPos

Procedure Spell_FromStart

Function Spell_GetNextWord : string

Procedure Spell_IgnoreWord(AWord:string; MarkCorrect:Boolean)

Procedure Spell_RemoveMarkers

Procedure Spell_ReplaceWord(s:string)

Procedure Spell_SelectWord

Procedure Spell_SelectWordXY(X:Integer; Y:Integer)

Function Spell_TopPosition : Integer

Function SplitCells(Before:Boolean) : Boolean

Function SplitCellsVertically : Boolean

Function SplitRow(mode:TWPSplitRowMode) : Boolean

Function SplitTable(PushApart:Boolean) : Boolean

Function StartSpellCheck(Mode:TWPStartSpellcheckMode) : Boolean

Procedure StartUndolevel

Procedure StartUpdate(WPUPD_Code:Integer; Param:Integer)

Function TableAdd(colcount:Integer; RowCount:Integer; Options:TWPTableAddOptions; StyleForNewCells:TWPTextStyle; CallBackForText:TWPTableAddCellEvent; StyleForHeader:TWPTextStyle; StyleForFooter:TWPTextStyle; WidthSourceRow:TParagraph; RowGroupLevel:Integer) : TParagraph

Procedure TableAdjustCellWidth(MinimumRightMargin:Integer)

Procedure TableFilterSort(CompareMode:TWPParagraphCompareModes; RowCompare:TWPParagraphListCompareObj; RowFilterMethod:TWPParagraphListCheckFilter; TableCell:TParagraph; Mode:TWPListLoadItemsMode; CompareContext:TObject)

Procedure TableFixAllCellWidths(SnapValue:Integer)

Procedure TableMakeCellWidthPC(AlsoSetTableWidthPC:Boolean)

Procedure TableNormalizeColCount(table:TParagraph; modes:TWPTableFillinColspanCellsModes; res:Integer)

Function TabstopAdd(PosInTwips:Integer; Kind:TTabKind; FillMode:TTabFill; FillColor:Integer) : Boolean

Procedure TabstopClear

Function TabstopDelete(PosInTwips:Integer) : Boolean

Function TextCursor : TWPRTFDataCursor

Function TextHeight(resolution:Integer) : Integer

Procedure TextObjectsGetList(list:TWPTextObjList; ObjTypes:TWPTextObjTypes; FromAllBlock:Boolean)

Function TextWidth(resolution:Integer) : Integer

Function Undo : Boolean

Procedure UndoBufferSaveTo(aStyle:TWPTextStyle; Typ:TWPUndoType; Kind:TWPUndoKind)

Procedure UndoClear

Procedure UndoRestoreState

Procedure UndoSaveState(Kind:TWPUndoKind)

Procedure UnLockScreen(RestoreScrollPosition:Boolean)

Procedure UpdateEditBox

Procedure UpdateMonitorDPI

Procedure UpdatePrinterProperties(aPrinter:TPrinter; PaintPageNr:Integer; pw:Integer; ph:Integer)

Procedure UpdateRulerValues

Procedure UpdateThemedColors(mode:TWPUpdateThemedColorsMode)

Function WritingAttr : TWPCurrentWritingmodeAttrInterface

Events

AfterCompleteWordEvent : TWPAfterCompleteWordEvent= TWPAfterCompleteWordEvent

You can use this event to implement text macros or automatic correction

AfterCopyToClipboard : TWPAfterCopyToClipboardEvent= TWPAfterCopyToClipboardEvent

This event can be used to add custom objects to the clipboard

AfterDelayedUpdate : TWPOnDelayedUpdate= TWPOnDelayedUpdate

AfterImageSaving : TWPAfterImageSaving= TWPAfterImageSaving

This event is triggered after an image was saved.

AfterLoadText : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered after text was loaded using LoadFromStrea, AsString or LoadFromFile. It will also be triggered if text was inserted or pasted! This event can be used to preprocess the loaded text, for example to set protection markers.

AfterObjectSelection : TNotifyWPTextObjEvent= TNotifyWPTextObjEvent

AfterPaintDesktopBackground : TWPOnPaintDesktopBackground= TWPOnPaintDesktopBackground

This event makes it possible to draw on the desktop after the previous paint routine (OnPaintDesktopBackground or the default) was executed

AfterPasteImage : TWPOnAfterPasteImage= TWPOnAfterPasteImage

This event is triggered after a single image (not beeing part of a RTF stream) has been pasted into the text. Using the provided txtobj reference it is possible to change its size and position.

BeforeChange : TWPBeforeChangeEvent= TWPBeforeChangeEvent

This event is triggered before the text is changed.

BeforeCopyText : TOnBeforeCopyEvent= TOnBeforeCopyEvent

BeforeCutText : TOnBeforeCopyEvent= TOnBeforeCopyEvent

BeforeDestroyPaintPage : TWPBeforeDestroyPaintPage= TWPBeforeDestroyPaintPage

BeforeDropText : TWPOnBeforeDropText= TWPOnBeforeDropText

BeforeEditBoxNeedFocus : TWPAbortNotifyEvent= TWPAbortNotifyEvent

BeforeInitializePar : TWPInitializeParEvent= TWPInitializeParEvent

This event is triggered before a paragraph is initialized. This happens after each change in the paragraph. This event makes it possible to prepocess the paragraph, for example to hide it "include(par.prop, paprHidden)" or to change the attributes depending on the contents of the paragraph.
This example hides paragraphs which contain empty merge fields and spaces only:

 
      if par.HasObjects(false,[wpobjMergeField]) and
      not par.IsNonSpace([wpobjMergeField]) then
      include(par.prop, paprHidden)
      else  exclude(par.prop, paprHidden);
       

This code applies a special character style to bookmarked text. It needs a global integer variable "charstyleid".
 
      var i  : Integer;
          inner_book : TWPTextObj;
      begin
         // This only done once!
         if charstyleid=0 then
         with WPRichText1.ParStyles.Add('CH1') do
         begin
            TextStyle.ASetColor( WPAT_CharBGColor, clGreen);
            TextStyle.ASetCharStyle(tsTRUE, WPSTY_BOLD  );
            charstyleid := id;
         end;


         for I := 0 to par.CharCount-1 do
         begin
            inner_book := WPRichText1.CodeInsideOf(par,i,wpobjBookmark);
               if inner_book>nil then
               begin
                 WPRichText1.AttrHelper.CharAttr := par.CharAttr[i];
                 WPRichText1.AttrHelper.ASet(WPAT_CharStyleSheet, charstyleid );
                 par.CharAttr[i] := (par.CharAttr[i] and $FF000000)  or
                    WPRichText1.AttrHelper.CharAttr;
               end;
         end;
      end;
       

BeforeObjectSelection : TNotifyWPTextObjEventIgnore= TNotifyWPTextObjEventIgnore

BeforeOverwriteFile : TWPBeforeOverwriteFile= TWPBeforeOverwriteFile

This event is triggered before a file is overwritten by the editor. We suggest to make a backup copy of the existing file, maybe even support different versions. Backup copies can be also created in special designated 'backup' directories.

BeforePaintLayer : TWPInternBeforePaintLayerEvent= TWPInternBeforePaintLayerEvent

With WPTools Premium this event allows it to draw a colored background for the text boxes. The background can vary depending on the current cursor position.
 
       if InEditor and IsEditing and (RTFData.Kind = wpIsOwnerSelected) then
        begin
          Canvas.Brush.Style := bsSolid;
          Canvas.Brush.Color := $eaefea;
          Canvas.FillRect(r);
        end;
        

BeforePasteImage : TWPOnBeforePasteImage= TWPOnBeforePasteImage

This event is triggered before an image was pasted into the text. It will be nalso triggered for each image which is part of an RTF stream.
The property InsertedObj is assigned when the event BeforePasteImage has been triggered for images which are part of pasted RTF text. If an image was pasted as object loaded from the clipboard, InsertedObj will be nil since the event happens before the bitmap is actually inserted into the text.

BeforePasteText : TWPOnBeforePaste= TWPOnBeforePaste

This event is executed after text was loaded from the clipboad and before it is inserted at the cursor position. This event makes it possible to modify the text before it is inserted!
This Example changes the attributes of the inserted text to 'Courier, 10.5, blue':
 
      procedure TForm1.WPRichText1BeforePasteText(Sender: TObject;
      RTFData: TWPRTFDataCollection; par: TParagraph; Stream: TStream;
      Reader: TWPCustomTextReader; OnlyBodyText: Boolean;
      var LoadedText: TWPRTFDataBlock);
      var i : Integer;
      CharAttrIndex : Cardinal;
      begin
      // This is an example to change the format
      // of all inserted text to a given font and size


      // 'AttrHelper' is our working horse to create the attribute
      RTFData.RTFProps.AttrHelper.Clear;
      RTFData.RTFProps.AttrHelper.SetFontName('Courier New');
      RTFData.RTFProps.AttrHelper.SetFontSize(10.5);
      RTFData.RTFProps.AttrHelper.SetColor(clBlue);
      CharAttrIndex := RTFData.RTFProps.AttrHelper.CharAttr;


      // At this point we can calculate another CharAttrIndex


      while par>nil do
      begin
      for i:=0 to par.CharCount-1 do
      begin
      par.CharAttr[i] := CharAttrIndex;
      end;
      par := par.next;
      end;
      end;
       

This example converts a hyperlink before it is pasted:
 
          procedure TForm1.WPRichText1BeforePasteText(Sender: TObject;
            RTFData: TWPRTFDataCollection; par: TParagraph; Stream: TStream;
            Reader: TWPCustomTextReader; OnlyBodyText: Boolean;
            var LoadedText: TWPRTFDataBlock);
          var
              s : string;
              a : Cardinal;
          begin
            if (par.Next=nil)
               and (par.StartWithW('http://') or par.StartWithW('https://'))
               and not par.HasText(#32)
            then
            begin
               s := par.GetText(false, false);
               a := par.CharAttr[0];
               par.ClearText;
               par.AppendNewObjectPair(wpobjHyperlink,'link',a).Source := s;
            end;
          end;
       

BeforeResize : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered before the control is resized - you can use it to adjust the zooming value.

HyperLinkEvent : THyperLinkEvent= THyperLinkEvent

This event is triggered wheh the user clicks on a link. The parameter 'IgnoredNumber' has no meaning. The link object is accessible as property HyperlinkObj
>.>

OnActivateHint : TWPActivateHintEvent= TWPActivateHintEvent

OnActivatingHotStyle : TWPActivatingHotStyle= TWPActivatingHotStyle

OnCalcPageNr : TWPOnCalcPageNr= TWPOnCalcPageNr

This event can be used to overwrite the page numbers which are internally calculated. You can check for the name of the TextObject. It can have the following values: PAGE, NUMPAGES, NEXTPAGE, PRIORPAGE and SECTIONPAGES. The passed RTFPageNr is 0 based. The passed PaintPageNr can be -1 if the event is not executed from painting code, othewise it is the 0 based number of the current page page (see WPRichText1.Memo.ExternPageRefAdd).
Note, if the var PrintedPageNr is set to 0 nothing will be printed!

OnChange : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered after the text was changed.

OnChangeCursorPos : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered after the cursor has been moved. It is triggered asynchronly, in the next idle state.

OnChangeLastFileName : TNotifyEvent= procedure (Sender : TObject) of Object

OnChangeSelection : TNotifyEvent= procedure (Sender : TObject) of Object

OnChangeViewMode : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered when the layout mode, autozoom or zooming is changed

OnChangeZooming : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered when the CurrentZooming
> is changed. If you need to update the GUI you should use OnChangeViewMode since OnChangeZooming is triggered when the actual zoom value is changed. This value is controlled by many properties, most important AutoZoom>.>

OnCheckProtection : TWPCheckProtectedEvent= TWPCheckProtectedEvent

OnClear : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered after a Clear of the TWPRTFDataCollection

OnClick : TWPCustomRtfEditClick= TWPCustomRtfEditClick

OnClickCreateHeaderFooter : TWPClickCreateHeaderFooterEvent= TWPClickCreateHeaderFooterEvent

This event makes it possible to set the 'range' for a newly created header or footer. It is triggered after a double click in the header or footer area. To abort the creation of a header or footer set the 'Range' to wpraIgnored. This is the default value unless the flag wpDblClickCreateHeaderFooter was used in property EditOptionsEx.

OnClickHotText : TWPClickHotTextEvent= TWPClickHotTextEvent

This event is triggered when the use clicks on text which is surrounded by objects which types are present in the property ClickableCodes
>.>

OnClickPage : TOnClickPageEvent= TOnClickPageEvent

OnClickText : TWPClickTextEvent= TWPClickTextEvent

OnCustomLinePaintAfter : TWPVirtPagePaintEvent= TWPVirtPagePaintEvent

This event is used like OnCustomLinePaintBefore but is triggered after the text has been rendered. This makes it possible to draw over the text. Param is an object which is usually reused for each paragraph. FirstRect is initialized to the rectangle of the first line of this paragraph on the page. Rect is the current rectangle. If the property UseUntilIncludingPar is set to a certain paragraph the object is reused for all paragraphs until the given one. If CallAgainToClose has been set to TRUE the event is triggered again after the last line.
The following example draws a line around each paragraph or consecuative paragraphs starting with one which contains $start and ends with one which containes $end.
 
      procedure Form1.WPRichText1CustomLinePaintAfter(Sender: TObject;
      RTFEngine: TWPRTFEngineBasis; Param: TWPVirtPagePaintParam;
      EndOfPageRun: Boolean);
      var r: TRect; par: TParagraph;
      begin
      if not EndOfPageRun then
      begin
      if Param.Tag = 0 then
      begin
      par := Param.Par;
      if par.HasText('$start') then
      begin
      while par > nil do
      begin
      if par.HasText('$end') then
      break;
      par := par.next;
      end;
      Param.UseUntilIncludingPar := par;
      end;
      end;
      Param.Tag := 1;
      Param.CallAgainToClose := TRUE;
      end
      else
      begin
      r := Param.UnionRect;
      Param.Canvas.Brush.Style := bsClear;
      Param.Canvas.Pen.COlor := clRed;
      Param.Canvas.Pen.Width := 0;
      Param.Canvas.Rectangle(
      r.Left, r.Top, r.Right, r.Bottom);
      end;
      end;  

Note: The API UnionRect() deals differently with rectangle which have a height of 0 than Param.UnionRect!.

OnCustomLinePaintBefore : TWPVirtPagePaintEvent= TWPVirtPagePaintEvent

This event is used like OnCustomLinePaintAfter but is triggered before the text has been rendered. This makes it possible to draw to the background of the text.
This example code will draw brackets into the left margin to show how paragraphs are linked together using the KeepN property:

 
      procedure TWPTBXForm.WPRichText1CustomLinePaintBefore(Sender: TObject;
      RTFEngine: TWPRTFEngineBasis; Param: TWPVirtPagePaintParam;
      EndOfPageRun: Boolean);
      var r: TRect; o: Integer; par: TParagraph; thiskeep, prevkeep, nextkeep: Boolean;
      begin
      if (Param.Par.ParentTable = nil) and (Param.PaintingInEditor) then
      begin
      if not EndOfPageRun then
      begin
      Param.CallAgainToClose := TRUE; // Make sure we get that EndOfPageRun!
      end else
      begin
      par := Param.Par.prev;
      prevkeep := (par > nil) and (par.AGetDef(WPAT_ParKeepN, 0) = 1);
      thiskeep := Param.par.AGetDef(WPAT_ParKeepN, 0) = 1;
      nextkeep := TRUE;
      par := Param.Par.next;
      if (par = nil) or (par.AGetDef(WPAT_ParKeepN, 0) = 0) then
      begin
      nextkeep := FALSE;
      end;
      r := Param.UnionRect;
      o := 30;
      Param.Canvas.Pen.Width := 0;
      Param.Canvas.Pen.Color := clRed;
      if thiskeep and not prevkeep then
      begin
      Param.Canvas.MoveTo(r.Left, r.Top);
      Param.Canvas.LineTo(r.Left - o, r.Top);
      end;


      if thiskeep or prevkeep then
      begin
      Param.Canvas.MoveTo(r.Left - o, r.Top);
      Param.Canvas.LineTo(r.Left - o, r.Bottom);
      end;


      if not thiskeep and prevkeep and not nextkeep then
      begin
      Param.Canvas.MoveTo(r.Left - o, r.Bottom);
      Param.Canvas.LineTo(r.Left, r.Bottom);
      end;
      end;
      end;
      end;




       

OnDblClick : TWPCustomRtfEditClick= TWPCustomRtfEditClick

OnDeactivateHotStyle : TWPDeactivateHotStyle= TWPDeactivateHotStyle

OnDelayedUpdate : TWPOnDelayedUpdate= TWPOnDelayedUpdate

This event is triggered in the next idle cycle after the StartUpdate procedure

OnDrawUnderline : TWPOnDrawUnderlineEvent= TWPOnDrawUnderlineEvent

This event is triggered before a text underline is drawn. It makes it possible to either change the LineMode and LineColor according to the context or to capture the rectangle where a hyperlink is located. If the original line drawing code should not be executed, set Ignore=true.
Example:
 
    procedure TWPMiniEd.DoDrawUnderline(
               Sender : TObject;
               Engine: TWPRTFEnginePaint;
               Stage : TWPDrawStage;
               Canvas: TCanvas;
               R        : TRect;
               SpecialTextFlags: TWPSpecialCharacterAttrKinds;
               BaseY    : Integer;
               var LineMode : Integer;
               var LineColor: TColor;
               PaintMode : TWPPaintModes;
               xres,yres : Integer;
               par   : TParagraph;
               posinpar : Integer;
               var Ignore : Boolean
             );
    var obj : TWPTextObj;
    begin
      if (wpHyperlink in SpecialTextFlags) and (wpDrawBackground in Stage) then
      begin
           obj := par.ObjectRef[posinpar];
           if (obj=nil) or (obj.ObjType>wpobjHyperlink) then
           obj := (Sender as TWPRichText).CodeInsideOf(par,posinpar,wpobjHyperlink);
           if (obj>nil) and (Pos('wpcubed.com',obj.Source)>0) then
           Canvas.Brush.Color := $FAAAFA
           else  Canvas.Brush.Color := $FAAAAA;
           Canvas.Rectangle(r);
      end;
    end;
     

OnDropFile : TWPOnDropFileEvent= TWPOnDropFileEvent

OnEditBoxChangeHeight : TWPChangeBoxEvent= TWPChangeBoxEvent

This event is used with EditBoxModes
> in LayoutMode>. Before the editor resizes itself you may modify the new height according to the needs of the application or modify the layout of the form.>

OnEditBoxChangeWidth : TWPChangeBoxEvent= TWPChangeBoxEvent

This event is used with EditBoxModes
> in LayoutMode>. Before the editor resizes itself you may modify the new width according to the needs of the application or modify the layout of the form. OnEditBoxChangeWidth is triggered before OnEditBoxChangeHeight to make it possible to adjust, when the WordWrap> mode has been activated, the width before the height is measured again.>

OnEditFieldCheckInputString : TWPEditFieldCheckInputStringEvent= TWPEditFieldCheckInputStringEvent

This event is only used when ppAllExceptForEditFields was used in ProtectedProp. Then it is possible to check the text and validate it against type and length constraints of an attached field.

OnEditFieldFocus : TWPEditFieldFocusEvent= TWPEditFieldFocusEvent

OnEditFieldGetSize : TWPEditFieldGetSize= TWPEditFieldGetSize

OnEditStateChanged : TEditStateEvent= TEditStateEvent

OnGetAttributeColor : TWPGetAttrColorEvent= TWPGetAttrColorEvent

This event can be used to customize the display of special text at runtime. The event is only called if the UseOnAttrColorEvent flag has been set in the special attribute property, i.e. InsertPointTextAttr.
 
     procedure TWPMiniEd.WPRichText1GetAttributeColor(Sender: TObject;
            var CharStyle: TCharacterAttr; par: TParagraph; posinpar: Integer);
     begin
          if CharStyle.CharStyle=wpInsertpoints then
          begin
               CharStyle.BackgroundColor := clYellow;
               CharStyle.UseBackgroundColor := true;
          end;
     end;
      
In the event you can modify the flag "AlsoUseForPrintout" which defaults to the setting in the special text property. Only if AlsoUseForPrintout is true, the setting will be used at printtime.
If you
    WPRichText1.Memo.SpecialTextFlagsForAllText := [wpBookmarkedText];
    
>> >

OnGetPageGapText : string= string

This function can be used to calculate the the string which should be displayed under thumbnails or between the pages. It is activated by the Viewption wpShowPageNRinGap. Please note that the 'Sender' of this event is the RTF.Engine class (TWPRTFEnginePaint) not the editor box

OnGetSpecialText : TWPOnGetSpecialTextEvent= TWPOnGetSpecialTextEvent

This event makes it possible to select special header or footer for certain pages. To select the header or footer text block, the name can be used. Use WPRichText.HeaderFooter.Get(...) to get a reference to a text block.

OnHyperlinkObjGetTextEx : TWPOnTextObjGetTextEvent= TWPOnTextObjGetTextEvent

This event is triggered to modify the text displayed for a hyperlink start and end tag. It can be used the same way as OnTextObjGetTextEx.
The event will only be triggered if FormatOptions include the flag wpShowHyperlinkCodes!

OnInitializedRTFData : TWPOnInitializeRTFDataObjectEvent= TWPOnInitializeRTFDataObjectEvent

This event is triggered after the RTFData has been created and the FormatOptions and Header properties have been assigned. Please note that this event will be only triggered for RTFData objects which are created by the memo control, not for objects which are created outside. If you want to attach a global RTFData or RTFProps object use .

OnInitializeRTFDataObject : TWPOnInitializeRTFDataObjectEvent= TWPOnInitializeRTFDataObjectEvent

This event is triggered when the RTFData or RTFProps are required the first time. This is the chance to get the objects from a different RTFEditor to have 2 editors working with the same text.
Alternatively you can assign a global TWPRTFProps object to make different RTF editors work with different texts but the same properties, such as style and color tables:
 
      WPGlobalRTFProps : TWPRTFProps; // global variable


      // in the main form, the MDI parent
      procedure TWPGlobalStyle.FormCreate(Sender: TObject);
      begin
      // Inititialize WPGlobalRTFProps
      WPGlobalRTFProps := TWPRTFProps.Create(nil);
      end;
      // in the MDI child:
      procedure TWPGlobalStyleChild.WPRichText1InitializeRTFDataObject(
      Sender: TObject; var RTFDataObject: TWPRTFDataCollection;
      var RTFPropsObject: TWPRTFProps);
      begin
      RTFPropsObject := WPGlobalRTFProps;
      end;
       

OnInternPaintPar : TWPInternPaintParEvent= TWPInternPaintParEvent

This event makes it possible to modify the paragraph before and after it was painted. It is called in four stages, before and after text output and before and after cell line drawing. So it is possible to change the paragraph text attributes (mostly colors) and draw custom borders.


 
      // Color paragraphs which are inside of an bookmark
      procedure TForm1.WPRichText1InternPaintPar(Sender: TObject;
            Stage: TWPInternPaintParEventStage; Editor: TWPRTFEnginePaint;
            var LineData: TWPVirtPageImageLineRef; ThisRTFpage: TWPVirtPage;
            Par: TParagraph; LineNr: Integer; Canvas: TCanvas; var ParColorOverride,
            TextColorOverride: TColor; var AnyObject: TObject; var IgnoreOutput: Boolean); begin
            if (Stage=wpBeforeLineText) and
               not Par.HasObjects(false, [wpobjBookmark]) and
               (WPRichText1.CodeInsideOf(par,0,wpobjBookmark)=nil)
            then
            begin
               Canvas.Brush.Color := clLime;
               Canvas.FillRect(Rect(LineData.x, LineData.Y, LineData.x+LineData.w, LineData.Y+LineData.h));
            end;
          end;
       



 
      // Check each character in a line and color background
           var i, l, x : Integer;
          inner_book : TWPTextObj;
      begin
          if (Stage=wpBeforeLineText)  then
          begin
             Canvas.Brush.Color := clLime;
             l := par.LineLength(LineNr);
             i := Par.LineOffset(LineNr);
             x := LineData.x;


             while l>0 do
             begin
                 inc(x, par.CharPos[i].xoff);
                 inner_book := WPRichText1.CodeInsideOf(par,i,wpobjBookmark);
                 if inner_book>nil then
                 begin
                    // set color based on    inner_book.Name
                    Canvas.FillRect(Rect(x, LineData.Y, x+par.CharPos[i].Width, LineData.Y+LineData.h));
                 end;
                 inc(i);
                 dec(l);
             end;
          end;
      end;
       

OnLeaveRTFDataBlock : TWPLeaveRTFDataBlockEvent= TWPLeaveRTFDataBlockEvent

This event can be used to verify if a change of the current data block is allowed. You can check the current and the new RTFDataBlock and set Allowed to true to allow the change or to false to forbid it.
This code will disable the editing of any footer text:
 
      procedure TForm1.WPRichText1LeaveRTFDataBlock(Sender: TObject; FromBlock,
        ToBlock: TWPRTFDataBlock; var Allowed: Boolean);
      begin
       Allowed := ToBlock.Kind > wpIsFooter;
      end; 
Please note: If the anchor of a text box is in the header and the tex box is clicked, the header will be activated anyway. This is necessary because otherwise reizing and moving would not be possible. You can use EditOptionsEx2: wpDontSelectImageIn

OnMailMergeGetText : TWPMailMergeGetTextEvent= TWPMailMergeGetTextEvent

This event is triggered when the MergeText or MergeEnumFields procedure is used

OnMeasureTextPage : TWPMeasurePageEvent= TWPMeasurePageEvent

This event makes it possible to change the size of any page.

OnMouseDown : TMouseEvent= TMouseEvent

OnMouseDownWord : TWPMouseDownRightEvent= TWPMouseDownRightEvent

This event is used for context menuse. It is triggered usually when the ContextMenu key was pressed, or the right mouse button. You can set the flag wpDontTriggerPopupInContextEvent in EditOptionsEx, then this event will be always triggered in the MouseDown event.

OnMouseEnter : TNotifyEvent= procedure (Sender : TObject) of Object

OnMouseLeave : TNotifyEvent= procedure (Sender : TObject) of Object

OnMouseUp : TMouseEvent= TMouseEvent

OnNewRTFDataBlock : TWPNewRTFDataBlockEvent= TWPNewRTFDataBlockEvent

This event is triggered when a new RTFDataBlock is created. This happens at load time or when the text is cleared. Please note that header and footer also are RTFDataBlocks.

 
      procedure TForm1.WPRichText1NewRTFDataBlock(Sender: TObject;
      RTFDataBlock: TWPRTFDataBlock);
      begin
      if RTFDataBlock.Kind=wpIsBody then
      begin
      // a) Set first paragraph attribute
      // RTFDataBlock.FirstPar.ASetColor(WPAT_CharColor, clRed);
      // RTFDataBlock.FirstPar.ASetFontName('Courier New');


      // b) Set default character attribute
      RTFDataBlock.RTFProps.AttrHelper.Clear;
      RTFDataBlock.RTFProps.AttrHelper.SetFontName('Times new Roman');
      RTFDataBlock.RTFProps.AttrHelper.SetFontSize(9.5);
      RTFDataBlock.FirstPar.LoadedCharAttr :=
      RTFDataBlock.RTFProps.AttrHelper.CharAttr;


      // c) create a default text
      RTFDataBlock.FirstPar.SetText('Please type here ...');
      end;
      end;
       

OnOpenDialog : TWPCustomRtfEditDialogEvent= TWPCustomRtfEditDialogEvent

This event can be used to attach custom dialogs. You can also use it to display page setup and tabstop dialogs for clicks on the ruler and the section page properties after a click on the arrow which marks a section:
 
      procedure TForm1.WPRichText1OpenDialog(Sender: TObject;
      DiaType: TWPCustomRtfEditDialog; var ResultValue: Boolean);
      begin
      if DiaType in [wpdiaSectionPageSetup, wpdiaPageSetup] then
      begin
      WPPagePropDlg1.Execute;
      ResultValue := true;
      end else
      if DiaType=wpdiaTabstops then
      begin
      WPTabDlg1.Execute;
      ResultValue := true;
      end;
      end;
       
wpTriggerOpenDialogForSectionProps must be used in EditOptionsEx
>.>

OnPaint : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered after the controls content was painted. Since v5.19.8 it is possible to paint flickerfree since while this event is triggered the property 'Canvas' will provide the reference to the current double buffer canvas.

OnPaintDesktopBackground : TWPOnPaintDesktopBackground= TWPOnPaintDesktopBackground

If this event is assigned the desktop will not be filled. You can use external code to paint the background. This can be used with TMS components to draw the shading of the TAdvOfficePager.
 
      procedure TForm1.WPRichText1PaintDesktopBackground(Sender: TObject;
      Canvas: TCanvas; R: TRect);
      begin
      // This would paint the TWPRichText, too - but TWPRichText is locked for repaint during this event
      AdvOfficePager1.PaintTo(Canvas, -WPRichText1.Left, -WPRichText1.Top);
      end;
       

OnPaintExternPage : TWPOnPaintExternPageEvent= TWPOnPaintExternPageEvent

This event makes it possible to inject page into the text. This pages are pure virtual, they can be painted by the event OnPaintExternPage, but they do not contain any text.

 
    procedure TWPExternalP.WPRichText1PaintExternPage(Sender: TObject;
        RTFEngine: TWPRTFEnginePaint; prCanvas: TCanvas; xoff, yoff: Integer;
        r: TRect; PaintPageNr: Integer; ExternPageRef: TObject; DestXRes,
        DestYRes: Integer);
      begin
        prCanvas.StretchDraw( r, ExternPageRef as TGraphic );
      end;
     
This code adds external pages to the document:
 
    var PageRef : TWPRTFExternPageRef;
    begin
         // We add a page at a certain location. The data object we added
         // Is freed automatically unless we set in the
         // returned TWPRTFExternPageRef object the property DontFreeExternPage
         // to true
         PageRef := WPRichText1.Memo.ExternPageRefAdd(
             wpAsPageX,
             PageNr,
             0,
             aPage,
             nil
            );
         // This values are optional
         PageRef.PageWidth  := MulDiv( pw, 1440, WPScreenPixelsPerInch);
         PageRef.PageHeight := MulDiv( ph, 1440, WPScreenPixelsPerInch);


    end;
     

OnPaintPageHint : TWPPaintPageHintEvent= TWPPaintPageHintEvent

This event makes it possible to either paint the page hint in your own code - then set Ignore to TRUE or to modify the Canvas.Brush, -Pen and -Font properties and let the engine use its usual paint code.

OnPaintTextFrameRect : TWPPaintTextFrameRect= TWPPaintTextFrameRect

This event let You paint a border around the page text, or, with premium license, also around columns and custom text frames. Custom text frames can be created on event .
 
      Canvas.Brush.Style := bsSolid;
      Canvas.Brush.Color := $fffffa;
      Canvas.FillRect(Rect(x1,y1,x2,y2));
       

OnPaintWatermark : TWPOnPaintWatermarkEvent= TWPOnPaintWatermarkEvent

This event can be used to paint a watermark on the page. You can even use a different TWPRichText to paint the background of the page. This is a perfect feature to print letterheads.

 
   uses ... WPRTEPaint, WPRTEDefsConsts, WPRTEEdit;


   procedure TForm2.WPRichText1PaintWatermark(Sender: TObject;
        RTFEngine: TWPRTFEnginePaint; toCanvas: TCanvas; PageRect: TRect; PaintPageNr,
        RTFPageNr: Integer; WaterMarkRef: TObject; XRes, YRes: Integer;
        CurrentZoom: Single; PaintMode: TWPPaintModes);
      begin
        // You can also draw an image in the background
        // toCanvas.StretchDraw(PageRect, Image1.Picture.Graphic);
        BackgroundRTF.Memo.OverridePageCount := WPRichText1.PageCount;
        BackgroundRTF.Memo.OverridePageOffset := PaintPageNr;
        BackgroundRTF.PaintPageOnCanvas(
           0,
           PageRect.Left,
           PageRect.Top,
           PageRect.Width,
           PageRect.Height,
           toCanvas,
           [wppGrayAll, wppGrayHeaderFooter, wppWhiteIsTransparent ],
           0,
           0,
           -1,
           -1,
           [wpNoViewPortAPI, // Internally used
             wpNoViewPortOrgAPI]
            );
      end;
     

OnPrepareImageforSaving : TWPPrepareImageforSavingEvent= TWPPrepareImageforSavingEvent

This event is triggered before an image is saved. You can use this event to compress the image or save it to file and store the link.

 
      procedure TForm1.WPRichText1PrepareImageforSaving(
      RTFData: TWPRTFDataCollection; Writer: TWPCustomTextWriter;
      TextObject: TWPTextObj; var DontSave: Boolean);
      begin
      // use WPIOHTML, WPOBJ_IMAGE
      if (Writer is TWPHTMLWriter) and TextObject.IsImage and
      (TextObject.Source='') and (TextObject.ObjRef.FileName='') and
      (TextObject.ObjRef.StreamName='') then
      begin
      TextObject.ObjRef.FileName :=
      TextObject.ObjRef.SaveToFile(Writer.SavePath,Writer.SaveName,'_img%d');
      end;
      end;
       
note: To clean up you can use the event AfterImageSaving.

OnPrepareParForPaint : TWPInitializeParEvent= TWPInitializeParEvent

This event is triggered by the paint routine for a paragraph which uses the flag paprNeedPreparePaintEvent in 'props'. This event may update some character properties but no properties which change the width of a character. Normally this event is used best to implement SpellAsYouGo, otherwise better use .

OnPrintPage : Boolean= Boolean

This event makes it possible to intercept the printing to integrate different printing code, i.e. to scale the printed page ot to print additional data. If this event is used, this code is NOT called and should be called within the event handler.
 
            Result := WPRichText1.PaintPageOnCanvas(n - 1, xoff, yoff,
                  0, 0, Printer.Canvas, Mode, 0,
                  0, -1, -1, []);
           

OnQueryDrag : TWPQueryDragEvent= TWPQueryDragEvent

This event is triggered before a drag&drop operation is started. The parameter DoIt will default to false if no text is selected or the selected text is a range of table cells. DragMode must be set to "dmManual"!

OnRequestHTTPImage : TWPRequestHTTPImageEvent= TWPRequestHTTPImageEvent

This event is triggered when a linked image (an image without image blob) is loaded.

OnRequestHTTPString : TWPRequestHTTPStringEvent= TWPRequestHTTPStringEvent

This event is triggered by the HTML reader when a linked style sheet is requested.

OnRequestStyle : TWPOnRequestStyleEvent= TWPOnRequestStyleEvent

OnResize : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered when the control is resized. Please use the event BeforeResize (not published) if you need to change the zooming value of a control which also uses property WordWrap set to true.

OnSearchReplaceMessage : TWPSearchReplaceMessageEvent= TWPSearchReplaceMessageEvent

This event is triggered by the function "ReplaceTextMethod" which is called by the Search and Replace dialog. The event can be used to show a custom message. If ToStart is set to true, search will be started from the beginning. It is possible to load a new document inside the event, for example to implement a search through several database records

OnSetFocus : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered inside the SetFocus procedure.

OnSetupPrinterEvent : TWPSetupPrinterEvent= TWPSetupPrinterEvent

This event is triggered at print time before printing starts and between each page

OnStartSpellCheck : TWPStartSpellcheckEvent= TWPStartSpellcheckEvent

OnTestForLinkEvent : TWPTestForLinkEvent= TWPTestForLinkEvent

This event is used to check the word under the cursor if it is a hyperlink or not.
 
      procedure TForm1.DoTestLink(Sender: TObject; par : TParagraph;
      var posinpar, len : Integer; var IsLink : Boolean);
      var s : string;
      begin
      if par.CompareW(posinpar,'http://') then IsLink := TRUE;
      end;
       

OnTextObjectClick : TTextObjectClickEvent= TTextObjectClickEvent

This event can be used to react on click on text objects. It is very useful for TextBoxes (part of WPTools Premium). Here it can be used to activate the edit mode for a textbox (=text inside of frame):
 
    procedure TForm1.WPRichText1TextObjectClick(Sender: TWPCustomRtfEdit;
      pobj: TWPTextObj; obj: TWPObject; var Ignore: Boolean);
    begin
      if (obj>nil) and
        ((WPRichText1.TextCursor.SelectedObject>pobj)
         or (GetAsyncKeyState(VK_CONTROL)  0)
        )then
         obj.Edit;
    end;


    procedure TForm1.WPRichText1TextObjectDblClick(Sender: TWPCustomRtfEdit;
      pobj: TWPTextObj; obj: TWPObject; var Ignore: Boolean);
    begin
       if (obj>nil) then
       begin
         obj.Edit;
         Ignore := true;
       end;
    end;
     

OnTextObjectDblClick : TTextObjectClickEvent= TTextObjectClickEvent

OnTextObjectMouseDown : TTextObjectMouseEvent= TTextObjectMouseEvent

This even is triggered when the user presses the mouse button while the mouse pointer is over an image object. It is also triggered by codes, such as mail merge fields - (Alternative

OnTextObjectMouseMove : TTextObjectMouseEvent= TTextObjectMouseEvent

This even is triggered when the user moves the mouse pointer over an image object. It is also triggered by codes, such as mail merge fields. If it is triggered by an image object the X and Y coordinates are relative to the objects upperl left coordinate, for usual text objects the client coordinates in the editor are passed.

OnTextObjectMouseUp : TTextObjectMouseEvent= TTextObjectMouseEvent

This even is triggered when the user releases the mouse button while the mouse pointer is over an image object. It is now also triggered by codes, such as mail merge fields - (Alternative

OnTextObjectMove : TTextObjectResizeEvent= TTextObjectResizeEvent

OnTextObjectMovePosition : TTextObjectResizeEvent= TTextObjectResizeEvent

This event is triggered when an object is moved. In contrary to OnTextObjectMove (it was named wrongly) is triggered when the object is resized

OnTextObjectPaint : TWPTextObjectPaintEvent= TWPTextObjectPaintEvent

This event is called to paint any embedded object. It can be also used to replace place holder images with the real data. In this example it applies a place holder image for all images which use the property Name.
 
      procedure TForm1.WPRichText1TextObjectPaint(Sender: TObject; pobj: TWPTextObj;
        toCanvas: TCanvas; XRes, YRes, X, Y, W, H, BASE: Integer;
        PageRef: TWPVirtPage; Modes: TWPTextObjectPaintModes;
        const CanvasExtraAttr: TWPPaintExtraParams;
        var ContinueMode: TWPTextObjectPaintResult);
      var mem : TMemoryStream;
      begin
            if (pobj.Name>'') and pobj.IsImage  then
            begin
              mem := TMemoryStream.Create;
              Placeholder.Picture.Bitmap.SaveToStream(mem);
              mem.Position := 0;
              pobj.LoadObjFromStream(
                      'BMP',
                      mem
                      );
              mem.Free;


              pobj.Name := ''; // dont call me again


            end;
      end;
     
Please note that the "Sender" ofd this event is the innner Memo control of type TWPRTFEnginePaint, not the TWPRichText.

OnTextObjGetTextEx : TWPOnTextObjGetTextEvent= TWPOnTextObjGetTextEvent

This event is triggered for all TWPTextObj ecxept for hyperlinks, images and horizontal lines.
It can be used to to calculate dynamic contents for text objects. You can access the current page as WPRichText.Memo._MeasureObjectCurrPage. This reference may be nil! You can also read the current page number: WPRichText.Memo._CurrPaintedObjPageNumber
You can either pass a result value and / or paint the string directly.

 
        procedure TForm1.OnPaintSum(Sender: TWPTextObj; OutCanvas: TCanvas; xres, yres: Integer; x, Y, w, h, BASE: Integer);
        begin
          if Sender.NameIs('anyname') then
          begin
             OutCanvas.TextOut(X+w-OutCanvas.TextWidth(Sender.Params),Y+base,Sender.Params);
          end;
        end;


        procedure TForm1.WPRichText1TextObjGetTextEx(RefCanvas: TCanvas;
          TXTObject: TWPTextObj; var PrintString: WideString; var WidthInPix,
          HeightInPix: Integer; var PaintObject: TWPTextObj; Xres, YRes: Integer);
        begin
          if TXTObject.NameIs('anyname') then
          begin
             PrintString := '                ';
             PaintObject := TXTObject;
             TXTObject.Params := '99.12';
             PaintObject.OnPaint := OnPaintSum;
          end;
        end;
        

This example code will render date and time fields as MS Word would do. It requires the "Source" to hold the format in the form \@ d. mmmmm yyyyy

 
       procedure TWPMiniEd.WPRichText1TextObjGetTextEx(RefCanvas: TCanvas;
        TXTObject: TWPTextObj; var PrintString: WideString; var WidthInPix,
        HeightInPix: Integer; var PaintObject: TWPTextObj; Xres, YRes: Integer);
      var s : string;
      begin
        // Interpret \@ d. mmmmm yyyyy
        if (Pos('\@',TXTObject.Source)>0) and TXTObject.NameIs('TIME') or TXTObject.NameIs('DATE') then
        begin
          s := Trim(StringReplace( TXTObject.Source, '\@', '', [rfReplaceAll]));
          s := AnsiDequotedStr(s,'"');
          PrintString := FormatDateTime(s, Now);
        end;
      end; 

OnToolBarSelectionEvent : TWPToolBarSelectionEvent= TWPToolBarSelectionEvent

OnUndoStateChanged : TNotifyEvent= procedure (Sender : TObject) of Object

OnUpdateExternScrollbar : TWPUpdateExternScrollbar= TWPUpdateExternScrollbar

This event makes it possible to update the position of an external scrollbar. The parameters are automatically limited to a maximal value of 20000 my calculating a multiplicator value. This values are accessible through the properties ScrollVertMultiplicator and ScrollHorzMultiplicator.
Example:
 
      // Update the position of the scrollbar
      procedure TForm1.WPRichText1UpdateExternScrollbar(
      Sender: TWPCustomRtfEdit; ScrollBar: TScrollStyle; Range, Page,
      Pos: Integer);
      begin
      if ScrollBar=ssVertical then
      begin
      ScrollBar1.PageSize := Page;
      ScrollBar1.Max := Range;
      ScrollBar1.Position := Pos;
      end;
      end;


      // Change position when Scroll event happens
      procedure TForm1.ScrollBar1Scroll(Sender: TObject;
      ScrollCode: TScrollCode; var ScrollPos: Integer);
      begin
      WPRichText1.TopOffset := Round(ScrollPos / WPRichText1.ScrollVertMultiplicator);
      end;
       

OnWorkOnTextChanged : TNotifyEvent= procedure (Sender : TObject) of Object

Used or referenced by

-Function TWPSuperMerge.GetEditor : TWPCustomRTFControl
-Function TWPSuperMerge.GetEditor : TWPCustomRTFControl
-Procedure TWPCustomAttrDlg.ChangeApplied(aEditBox:TWPCustomRtfEdit)