KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Retrieving a list of selected row in 4D View
PRODUCT: 4D View | VERSION: 6.8.4 | PLATFORM: Mac & Win
Published On: November 20, 2003

Version 6.8 and 2003

The following is a method that populates a longint array with the selected row position in a 4D View area. However, this method works only with a 4D View area that allows only a full row highlight and multiple row selections.

  ` Method: PV_GetSelectedRow
  ` Description: Populate an array with the selected row position
  ` $1 - Reference Number to a 4D View area
  ` $2 - Pointer to a longint array

C_LONGINT($1;$PVArea)
C_LONGINT($vlElem;$row)
C_POINTER($2;$pArray)
$PVArea:=$1
$pArray:=$2
If ((PV Get area property (pvArea;pv current cell highlight )=0) & (PV Get area property (pvArea;pv select mode )=3))
  ARRAY LONGINT($left;0)
  ARRAY LONGINT($top;0)
  ARRAY LONGINT($right;0)
  ARRAY LONGINT($bottom;0)
  PV GET SELECTED RANGES LIST ($PVArea;$left;$top;$right;$bottom)
  SORT ARRAY($top;>)
  SORT ARRAY($bottom;>)
  If (Size of array($top)>0)
    ARRAY LONGINT($pArray->;1)
    $pArray->{1}:=$top{1}
    If ($top{1}<$bottom{Size of array($bottom)})
        INSERT ELEMENT($pArray->;2)
        $pArray->{2}:=$bottom{Size of array($bottom)}
        For ($row;$pArray->{1}+1;$pArray->{2}-1)
            If (PV Is range selected (PVArea;1;$row;1;$row)=1)
                $vlElem:=Size of array($pArray->)+1
                INSERT ELEMENT($pArray->;$vlElem)
                $pArray->{$vlElem}:=$row
            End if
        End for
    End if
  End if

  SORT ARRAY($pArray->;>)
Else
  ALERT("This command works only if all cells in a row are selected.")
End if