Skip to main content
Version: 20 R7 BETA

WP Get frame

WP Get frame ( {* ;} wpArea {; textBoxID} ) -> Function result

ParameterTypeDescription
*OperatorIf specified, wpArea is a form object name (string). If omitted, wpArea is an object field or variable.
wpAreaStringForm object name (if * is specified) or 4D Write Pro object variable or field (if * is omitted)
textBoxIDString🡘ID of the text box (only filled if a text box has the focus)
Function resultLongintFrame where the cursor is currently set

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

Description

The WP Get frame command returns the frame where the cursor is currently set within the 4D Write Pro wpArea 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.

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).

The returned value can be compared to one of the following constants from the 4D Write Pro Constants theme:

ConstantTypeValueComment
wk bodyLongint0Body frame of the section
wk current section default footerLongint10Default footer of the section (available only if there is no active subsection footer)
wk current section default headerLongint9Default header of the section (available only if there is no active subsection header)
wk current section first footerLongint4Footer of the first page of the section
wk current section first headerLongint3Header of the first page of the section
wk current section left footerLongint6Footer of the left page(s) of the section
wk current section left headerLongint5Header of the left page(s) of the section
wk current section right footerLongint8Footer of the right page(s) of the section
wk current section right headerLongint7Header of the right page(s) of the section
wk text boxLongint11Text box

If the cursor is currently set in a text box element, the element id of the text box is returned in the textBoxID parameter. In all other cases, this parameter is returned empty.

Example

You want to make sure the user has set the cursor in a header or a footer frame:

 var $frameGet : Integer
 $frameGet:=WP Get frame(*;"WParea")
 If($frameGet=wk body)|($frameGet=wk text box)
    ALERT("Please select a footer or a header.")
 End if

See also

WP Get footer
WP SET FRAME