Skip to main content
Version: 20 R10 BETA

WP Selection range

WP Selection range ( {* ;} wpArea ) : Object

ParameterTypeDescription
*OperatorIf specified, wpArea is a form object name (string). If omitted, wpArea is an object field or variable.
wpAreaTextForm object name (if * is specified) or 4D Write Pro object variable or field (if * is omitted)
Function resultObjectRange or Picture object

This command is not thread-safe, it cannot be used in preemptive code.

Description

The WP Selection range command returns a new range object or a picture object based upon the currently selected content in the wpArea 4D Write Pro area.

If you pass the optional * parameter, you indicate that wpArea is a form object name (string). If you do not pass this parameter, you indicate that wpArea is a 4D Write Pro object variable or field. If no 4D Write Pro area is passed in the wpArea parameter, an empty object is returned.

Note: This command can only be used if the wpArea is associated with a form object (i.e. it is displayed in the current form/page).

If an anchored image (picture at a fixed location) is selected in wpArea, WP Selection range returns a picture reference object and not a range object (for more information, please refer to the WP Add picture command description). Otherwise, WP Selection range returns a new range object. For more information on range objects, please refer to Range handling commands.

Example

You want to get the selected text from a 4D Write Pro area:

 $range:=WP Selection range(*;"WParea")

See also

WP Paragraph range
WP Picture range
WP Text range