Skip to content

piFontWeight - DfBaseRichEdit

Sets or returns font weight of selected text

Type: Property
Access: Read/Write
Data Type: integer
Parameters: None

Syntax

Property integer piFontWeight
Access Type Syntax
Read Access: Get piFontWeight to integerVariable
Write Access: Set piFontWeight to integerVariable/Value

Description

Sets or returns the font weight of selected text in the control.

FontWeight specifies the weight of the font in the range 0 through 1000. For example, 400 is normal and 700 is bold. If this value is zero, a default weight is used.

The following values are defined for convenience: FW_DONTCARE FW_THIN FW_EXTRALIGHT FW_ULTRALIGHT FW_LIGHT FW_NORMAL FW_REGULAR FW_MEDIUM FW_SEMIBOLD FW_DEMIBOLD FW_BOLD FW_EXTRABOLD FW_ULTRABOLD FW_HEAVY FW_BLACK

Sample

This sample sets the font weight of control oRichEdit 1 to FW_SEMIBOLD.

set FontWeight of oRichEdit1 to FW_SEMIBOLD

If you get this property and it is not consistent throughout the selection, it will return the piFontWeight value for the first character of the selection, and LastErrorCode will equal ERR_RE_ATTR_INCONSISTENT_THROUGH_SELECTION.

Sample

This sample gets the value of piFontWeight, then checks if piFontWeight was not consistent throughout the selected text by checking if LastErrorCode is equal to ERR_RE_ATTR_INCONSISTENT_THROUGH_SELECTION. If so, you can do any special handling you wish in the begin...end code block.

integer iFontWeight iLastErrorCode
get piFontWeight to iFontWeight
get LastErrorCode to iLastErrorCode
if (iLastErrorCode = ERR_RE_ATTR_INCONSISTENT_THROUGH_SELECTION) begin
    // do something
end