PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Table column
  • rtfColor attribute
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Changes or lists the attributes of the text currently selected in an RTF control (found in a window or in a WINDEV report). This function can also be used on a character string containing text in RTF format.
Note: In a window, the text can be selected by the user or by programming with ..Cursor and ..CursorEnd.
Example
// Switches the selection to Arial
RTFSelection(EDT_Edit1, rtfFontName, "Arial")
// Switches the size of the font to 12
RTFSelection(EDT_Edit1, rtfFontSize, 12)
// Switches the selection to bold
RTFSelection(EDT_Edit1, rtfBold, True)
// Modifies the color of the selection
RTFSelection(EDT_Edit1, rtfColor, RGB(134, 345, 255))
// If the selection contains different values
IF RTFSelection(EDT_Edit1, rtfBold) = "" THEN
// Switch everything to bold
RTFSelection(EDT_Edit1, rtfBold, True)
ELSE
// Reverse the status
bBold is boolean = RTFSelection(EDT_Edit1, rtfBold)
RTFSelection(EDT_Edit1, rtfBold, not bBold)
END
// Switch all the occurrences of "WINDEV" to red and underlined
I is int
I = RTFSearch(EDT_Edit1, "WINDEV")
WHILE I > 0
// Switch to red
RTFSelection(EDT_Edit1, rtfColor, LightRed, I, 6)
// Switch to underlined
RTFSelection(EDT_Edit1, rtfUnderlined, True, I, 6)
// Find the next occurrence of "WINDEV"
I = RTFSearch(EDT_Edit1, "WINDEV", rtfCaseSensitive, I + 1)
END
// Transform a RTF text
MyText is string
MyRTFText is string
MyText = "Unformatted text coming from a WLanguage character string"
MyRTFText = RTFSelection(MyText, rtfBold, True, 1, Length(MyText))
EDT_RTFInput = MyRTFText
Syntax

Selection in an RTF control Hide the details

<Result> = RTFSelection(<RTF Control>, <Attribute> [, <New Value> [,<Start>, <Size>]]])
<Result>: Character string, integer, boolean
  • Former value of the attribute. The type depends on the specified attribute.
  • Empty string ("") if the selection contains different versions of the same attribute (selection in bold and non-bold for example).
<RTF Control>: Character string (with or without quotes)
Name of RTF control.
<Attribute>: Constant
Attribute to retrieve or to modify:
rtfAlignmentAlignment of selected paragraphs. Possible values:
  • haLeft: to the left
  • haRight: to the right
  • haCenter: centered
  • haJustified: justified
rtfStrikethroughStruck out characters (type of the attribute: Boolean)
rtfBackgroundColorBackground color of the text (type of attribute: Integer)
rtfColorColor of the text (type of the attribute: Integer)
rtfBoldBold characters (type of the attribute: Boolean)
rtfItalicItalic characters (type of the attribute: Boolean)
rtfFontNameName of the font used (type of the attribute: Character string)
rtfUnderlinedUnderlined characters (type of the attribute: Boolean)
rtfFontSizeSize of the font (in pixels) (type of the attribute: Integer)
<New Value>: Character string, integer, boolean (optional)
For a modification, new value of the specified attribute.
<Start>: Optional integer
Position of the character from which the type of the attribute must be retrieved or changed. If this parameter is not specified, the attribute of the text currently selected in the edit control is retrieved or changed.
<Size>: Optional integer
Number of characters whose type of attribute must be retrieved or modified. If this parameter is not specified, the attribute of the text currently selected in the edit control is retrieved or changed.

Selection in an RTF string Hide the details

<Result> = RTFSelection(<RTF String> , <Attribute> , <New Value> , <Start> , <Size>)
<Result>: Character string
New character string where the different changes have been performed. The initial string is not modified.
<RTF String>: Character string (with quotes)
Character string in RTF format.
<Attribute>: Constant
Attribute to retrieve or to modify:
rtfAlignmentAlignment of selected paragraphs. Possible values:
  • haLeft: to the left
  • haRight: to the right
  • haCenter: centered
  • haJustified: justified
rtfStrikethroughStruck out characters (type of the attribute: Boolean)
rtfBackgroundColorBackground color of the text (type of attribute: Integer)
rtfColorColor of the text (type of the attribute: Integer)
rtfBoldBold characters (type of the attribute: Boolean)
rtfItalicItalic characters (type of the attribute: Boolean)
rtfFontNameName of the font used (type of the attribute: Character string)
rtfUnderlinedUnderlined characters (type of the attribute: Boolean)
rtfFontSizeSize of the font (in pixels) (type of the attribute: Integer)
<New Value>: Character string, integer, boolean
For a modification, new value of the specified attribute.
<Start>: Integer
Position of the character from which the type of the attribute must be retrieved or changed. Caution: This position ignores the RTF tags.
<Size>: Integer
Number of characters whose type of attribute must be retrieved or modified.
Remarks

Table column

RTFSelection is used to modify the selection of the cell currently in edit. No other cell can be modified.
The following code triggers an error:
RTFSelection({ControlCurrent()}[TableSelect(TABLE_Table1)], rtfColor, LightGray)
The following code must be used:
RTFSelection({ControlCurrent()}, rtfColor, LightGray)

rtfColor attribute

The rtfColor attribute can return or receive the DefaultColor value: the color of the text depends on the color parameters defined in the control panel of Windows.
Components
WINDEVReports and Queries wd230obj.dll
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment