KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Determine if a 4D Write Pro object contains a header programmatically
PRODUCT: 4D | VERSION: 16R5 | PLATFORM: Mac & Win
Published On: November 22, 2017

4D Write Pro has a feature in v16R5 to insert headers. Initially, when a 4D Write Pro object is created, the header is not initialized. Here is a utility method that will detect if the Write Pro object has the header present:

// ----------------------------------------------------------------------
// Name: WP_HEADER_PRESENT
// Description: Method will determine if the 4D Write Pro object has a header
//
// Parameters:
// $1 (POINTER) - Write Pro object
//
// Output:
// $0 (BOOLEAN) - True - Contains a header, False - No header
// ----------------------------------------------------------------------
C_POINTER($1;$writeProObj)
C_BOOLEAN($0)
C_TEXT($writeProVar)
C_LONGINT($pos)

$writeProObj:=$1

WP EXPORT VARIABLE($writeProObj->;$writeProVar;wk web page html 4D)

$pos:=Position("div.section1Header";$writeProVar)

If ($pos>0)
  $0:=True
Else
  $0:=False
End if


Example #1 - No header set



C_LONGINT($status)

$status:=WP_HEADER_PRESENT(->WriteProArea) // False



Example #2 - Having a header with no text




$status:=WP_HEADER_PRESENT(->WriteProArea) // True


Note: Clicking on the header area will initialize the object to contain the header placeholder.


Example #3 - Having a header with text




$status:=WP_HEADER_PRESENT(->WriteProArea) // True