KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method that returns the list of all objects on a form page
PRODUCT: 4D | VERSION: 13.3 | PLATFORM: Mac & Win
Published On: October 2, 2013

The command FORM GET OBJECTS returns the list of all objects present in the current form in the form. Here is a utility method that returns the list of all objects present only in a specific page of the form.

  // Method: FORM_GET_PAGE_OBJECTS
  // Description
  // Returns the list of all objects present in
  // a specific form page
  //
  // Parameters
  // $1 - Pointer to a Text array
  // $2 - Pointer to a Pointer array
  // $3 - Pointer to a Longint array
  // $4 - (Optional) Page number or current page if omitted
  // ----------------------------------------------------

C_POINTER($1;$object_atp)
C_POINTER($2;$variable_app)
C_POINTER($3;$page_alp)
C_LONGINT($4;$curPage_l)
C_LONGINT($foundat_l)

If (Count parameters>=3)
   $object_atp:=$1
   $variable_app:=$2
   $page_alp:=$3
   If (Count parameters>=4)
      $curPage_l:=$4
   Else
      $curPage_l:=FORM Get current page
   End if

   ARRAY TEXT(object_at;0)
   ARRAY POINTER(variable_ap;0)
   ARRAY LONGINT(page_al;0)
   FORM GET OBJECTS(object_at;variable_ap;page_al)

   Repeat
      $foundat_l:=$foundat_l+1
      $foundat_l:=Find in array(page_al;$curPage_l;$foundat_l)
      If ($foundat_l#-1)
         APPEND TO ARRAY($object_atp->;object_at{$foundat_l})
         APPEND TO ARRAY($variable_app->;variable_ap{$foundat_l})
         APPEND TO ARRAY($page_alp->;page_al{$foundat_l})
      End if
   Until ($foundat_l=-1)
End if