Description

Retrieve format information for the currently selected text within a Rich Edit control.

Applies to

Edit box.

Syntax

charformat = Send_Message(controlID, "GETCHARFORMAT", appliesTo)

Parameters

Parameters are as follows.

ParameterDescription
appliesTo
ValueDescription
0Default formatting information for the control
1Current selection/cursor position

Return value

Same format as SetCharFormat message. A Null field indicates that the particular format does not apply to the requested selection.

See Also

SetCharFormat message

Example

Declare function Send_Message
 
Red = 255
Green = 255 * 256
Blue  = 255 * 65536
 
ApplyFormatTo = 1     // Selection
// Create some test text
x = Set_Property(@window:'.EDIT_AREA', 'TEXT', "This is a test...")
 
// Select "is a"
x = Set_Property(@window:'.EDIT_AREA', 'SELECTION', 6:@fm:4)
 
// Make the "is a" bold and blue
CharFormat = ''
CharFormat<1,1> = '1'
CharFormat<4>   = Blue
x = Send_Message(@window:'.EDIT_AREA', 'SETCHARFORMAT', ApplyFormatTo, CharFormat)
 
// Reset the cursor back to the beginning
x = Set_Property(@window:'.EDIT_AREA', 'SELECTION', 1:@fm:0)
 
// Get the format
x = Set_Property(@window:'.EDIT_AREA', 'SELECTION', 6:@fm:4)
charFormat = Send_Message(@window:'.EDIT_AREA', 'SETCHARFORMAT',ApplyFormatTo)
  • No labels