To function properly, the XbpRtf class requires a certain system component, the Microsoft Rich Text ActiveX Control Version 6.0, to be installed on your computer. Normally, this component is not installed along with the operating system, so provisions must be taken to distribute it with your Xbase++ application. An installation package with the required system files for using the XbpRtf Xbase Part is available from Alaska Software. The corresponding archive should be located on your Xbase++ disk or CD ROM. For further information, please click the 'Info' button on this page.
Class XbpRtf() Foundation
Class function of the XbpRtf() class
Objects of the XbpRtf class encapsulate the functionality of a Rich Text Edit Control which allows for editing formatted text. An XbpRtf object is able to load, display, print and save RTF-formatted files.
Xbase++ applications can use the XbpRtf object for implementing a full-featured text editor. Also, XbpRtf objects can be used for manipulating RTF-encoded character data created by other applications.
The following instance variables and methods are used to manipulate the selection, that is, the text currently selected in the XbpRtf object. If no text is selected when a certain text attribute is changed, the attribute is set for all text entered at the current insertion point.
//
// Example for using the XbpRtf Xbase Part
//
#include "XBP.CH"
#include "GRA.CH"
#include "AppEvent.CH"
PROCEDURE Main()
LOCAL oRTF
LOCAL nEvent, mp1, mp2, oXbp
SetAppWindow():useShortCuts := .T.
//
// Create the XbpRtf object
//
oRTF := XbpRTF():new()
oRTF:create( ,, {10,10},{300,300},{{XBP_PP_COMPOUNDNAME,"12.Arial"}} )
// Assign text to the RTF object's text buffer
oRTF:text := "Text with varying " + Chr(10) +;
"text attributes. Made possible by the " + Chr(10) +;
"XbpRtf edit control." + Chr(10)
//
// Use the selection manipulation methods to
// assign different attributes to the text
//
// Set the selection using abolute character positions
oRTF:SelStart := 5
oRTF:SelLength := 30
oRTF:SelColor := GRA_CLR_BLUE
// Set the selection by selecting a specific word
// in the text
oRTF:SelStart := 0
oRTF:Find( "Made possible" )
oRTF:SelBold := .T.
// Find a specific word and expand the selection
// to include another one
oRTF:SelLength := 0
oRTF:Find( "XbpRtf" )
oRTF:Span( ".",, .T. )
oRTF:SelColor := GRA_CLR_RED
oRTF:SelFontName := "Courier New"
oRTF:SelFontSize := 15
oRTF:SelBold := .T.
//
// Reset the text cursor
//
oRTF:SelStart := Len( oRTF:Text )
//
// Event Loop
//
nEvent := xbe_None
DO WHILE nEvent != xbeP_Close
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.