4D v16

WP Get range

Home

 
4D v16
WP Get range

WP Get range 


 

WP Get range ( wpArea ; startRange ; endRange ) -> Function result 
Parameter Type   Description
wpArea  Object in 4D Write Pro object variable or field
startRange  Longint in Starting offset of range in the area
endRange  Longint in Ending offset of range in the area
Function result  Object in Range object

The WP Get range command returns a new text range object (rangeObj) containing the selection between startRange and endRange in the wpArea 4D Write Pro area.

Pass a 4D Write Pro object variable or field in wpArea. If no valid 4D Write Pro area is passed in the wpArea parameter, an empty rangeObj is returned.

In startRange and endRange, pass values corresponding to the position of the first and last characters to select in the document. You can pass wk start text in startRange to define the beginning of the document, and wk end text in endRange to define the end of the document. Keep in mind that a 4D Write Pro document not only contains visible text but also formatting tags that are included in the range.

The command returns a new rangeObj. A rangeObj is a 4D Write Pro text range object which can be used to handle attributes on a text selection (with the new WP GET ATTRIBUTES and WP SET ATTRIBUTES commands). It contains 3 private read-only attributes (wk range start, wk range end and wk range owner) that are used to defined the range itself.

Example  

You want to select a range of 12 characters starting from the beginning of the 4D Write Pro field. The field is displayed in a form object:

If you execute:

 $range2:=WP Get range([SAMPLE]WP;wk start text;12)
 WP SELECT(*;"WParea";$range2)

...the result is:



See also 

WP Get selection
WP SELECT

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v15 R4

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v16)