This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
WP Get subsection

WP Get subsection 


 

WP Get subsection ( targetObj ) | (wpSection ; subSectionType ) -> Function result 
Parameter Type   Description
targetObj  Object in Range or element
wpSection  Object in 4D Write Pro section
subSectionType  Longint in Subsection type (wk first page, wk left page, or wk right page)
Function result  Object in Subsection

The WP Get subsection command returns first subsection intersected by the targetObj range or element, or to the specified subSectionType subsection of the wpSection section.

  • With the first syntax (using the targetObj parameter), the command returns the first subsection which intersects the range or the element. If no subsection intersects the range or the element, a null object is returned. You can pass in targetObj:
    • a range, or
    • an element (table / row / paragraph / body / text box / header / footer ).

    If the range or element is or belongs to a header, a footer, or a text box, WP Get subsection returns the subsection to which the targetObj is attached. If the targetObj is not attached to a subsection, a null object is returned.
    If the range or element belongs to an anchored picture, an error is returned.

  • With the second syntax (using the wpSection and subSectionType parameters), the command returns a wpSubSection object (child of wpSection) of the the subSectionType type. Pass one of the following constants in the subSectionType parameter:
     
    Constant Type Value
    wk first page Longint 1
    wk left page Longint 2
    wk right page Longint 3

     
    If no subSectionType subsection is defined for the specified wpSection, the command returns an undefined object (no error is returned).

Example  

You want to apply a blue background on left pages:

 C_OBJECT($section;$subsection)
  //Retrieve the reference on the first section
 $section:=WP Get section(wpDoc;1)
  //Retrieve the reference on the left subsection of the first section
 $subsection:=WP Get subsection($section;wk left page)
 
  //If the subsection exists, set the background to blue
 If($subsection#Null)
    WP SET ATTRIBUTES($subsection;wk background color;"#87CEEB")
 Else
    ALERT("Please, create left and right subsections.")
 End if



See also 

WP DELETE SUBSECTION
WP Get section
WP New subsection

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language
Number: 1582

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R3

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v20 R7)