Command WR Get text property

4D Write

WR Get text property

version 2003 (Modified)


WR Get text property (area; property; sameProperty) Real

ParameterTypeDescription
areaLongint4D Write area
propertyIntegerProperty number
samePropertyInteger1 if the whole selection has that property,
0 if part or all of the selection does not have
the property

Function result Real Depends on the property

Description

The WR Get text property command allows you to determine whether the property passed in property is used in the current selection of the 4D Write area referenced by area.

• If sameProperty is equal to 1, the property is applied to the whole selection.

• If sameProperty is equal to 0, the property is not applied to the whole selection.

The returned value then corresponds to the status of the last character of the selection.

The property parameter lets you set the property to be examined. For more information, refer to the description of the WR SET TEXT PROPERTY command.

If you pass an invalid property number, the error 1075 is returned.

Examples

(1) You want to make sure that margin sizes do not exceed a fixed value:

   Left:=WR Get text property(Area;wr left margin;$Uniform)
   If(Left<3)   `Setting the left margin to 3
      WR SET TEXT PROPERTY(Area;wr left margin;3)   
   End if
   Right:=WR Get text property(Area;wr right margin;$Uniform)
   If(Right>43)   `Setting the right margin to 43
      WR SET TEXT PROPERTY(Area;wr right margin;43)   
   End if

(2) You want users to be able to set the line spacing and alignment, but you do not want them to have access to menus and rulers. The input form contains a button labeled Info and two variables, LineSpacing and Alignment, each of them attached to a method.

- The following is the object method for the Info button, it retrieves information about the current cursor position:

   LineSpacing:=WR Get text property(Area;wr line spacing;$Uniform)
   If($Uniform=0)
      ALERT("The selection contains several types of line spacings.")
      $Assign:=True
   Else
      $Assign:=False
   End if
   Alignment:=WR Get text property(Area;wr justification;$Uniform)
   If($Uniform=0)
      ALERT("The selection contains several types of alignments.")
   End if

- LineSpacing object method sets the user's choice for line spacing:

   WR SET TEXT PROPERTY(Area;LineSpacing)

- Alignment object method sets the user's choice for alignment:

   WR SET TEXT PROPERTY(Area;Alignment)

- In the On load form event, you hide menus and rulers:

   If(Form event=On load)
      WR SET DOC PROPERTY(Area;wr view menubar;0)
      WR SET DOC PROPERTY(Area;wr view rulers;0)
   End if

See Also

WR SET TEXT PROPERTY.