Description

Used to set selected text’s character format within an Edit Box control

Applies to

Edit Box Control

Syntax

Status = Send_Message(CtrlEntID, "SETCHARFORMAT", ApplyFormatTo, CharFormat)

Parameters

Parameters are as follows:

ParameterDescription
ApplyFormatTo

An integer value determining where the format should be applied.

ValueDescription
0Default
1Selection
2Word
4All
CharFormatan @FM-delimited array of character formats

All of these items are only set only if there is a value in the field (or value). If the field (or value) is empty, then that characteristic does not change.

CharFormat<1> Effects Flags
CharFormat<1,1>BooleanBold
CharFormat<1,2>BooleanItalic
CharFormat<1,3>BooleanUnderline
CharFormat<1,4>BooleanStrike Out
CharFormat<1,5>BooleanProtected
CharFormat<1,6>BooleanLink
CharFormat<1,7>BooleanAuto Color
CharFormat<2>IntegerSize
CharFormat<3>IntegerOffset
CharFormat<4>IntegerColor
CharFormat<5>IntegerCharacter Set
CharFormat<6>IntegerPitch And Family
CharFormat<7>StringFace Name
CharFormat<8>IntegerWeight
CharFormat<9>IntegerSpacing
CharFormat<10>IntegerBack Color
CharFormat<11>IntegerLcid
CharFormat<12>IntegerStyle
CharFormat<13>IntegerKerning
CharFormat<14>IntegerUnderline Type
CharFormat<15>IntegerAnimation
CharFormat<16>IntegerRevision Author

Return value

If successful returns a 1, otherwise returns a null.

Example

Declare function Send_Message
 
Red = 255
Green = 255 * 256
Blue  = 255 * 65536
//ApplyFormatTo = 0     // Default
  ApplyFormatTo = 1     // Selection
//ApplyFormatTo = 2     // Word
//ApplyFormatTO = 4     // All
 
// All of these items are only set only if there
// is a value in the field (or value).  If the field
// (or value) is empty, then that characteristic
// does not change.
 
// CharFormat<1>                // Effects Flags
 
// CharFormat<1,1> = Boolean    // Bold
 
// CharFormat<1,2> = Boolean    // Italic
 
// CharFormat<1,3> = Boolean    // Underline
 
// CharFormat<1,4> = Boolean    // Strike Out
 
// CharFormat<1,5> = Boolean    // Protected
 
// CharFormat<1,6> = Boolean    // Link
 
// CharFormat<1,7> = Boolean    // Auto Color
 
// CharFormat<2>   = Integer    // Size
 
// CharFormat<3>   = Integer    // Offset
 
// CharFormat<4>   = Integer    // Color
 
// CharFormat<5>   = Integer    // Character Set
 
// CharFormat<6>   = Integer    // Pitch And Family
 
// CharFormat<7>   = String     // Face Name
 
// CharFormat<8>   = Integer    // Weight
 
// CharFormat<9>   = Integer    // Spacing
 
// CharFormat<10>  = Integer    // Back Color
 
// CharFormat<11>  = Integer    // Lcid
 
// CharFormat<12>  = Integer    // Style
 
// CharFormat<13>  = Integer    // Kerning
 
// CharFormat<14>  = Integer    // Underline Type
 
// CharFormat<15>  = Integer    // Animation
 
// CharFormat<16>  = Integer    // Revision Author
 
// 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)
  • No labels