Command PV SELECT RANGE

4D View

PV SELECT RANGE

version 2004.4 (Modified)


PV SELECT RANGE (area; left; top; right; bottom; action)

ParameterTypeDescription
areaLongint4D View area
leftLongintColumn number of left cell
topLongintRow number of top cell
rightLongintColumn number of right cell
bottomLongintRow number of bottom cell
actionIntegerSelect action

Description

The PV SELECT RANGE command selects the range of cells defined by left, top, right and bottom coordinates.

The action parameter allows defining the selection action that you want to execute when a selection of cells already exists: you can add the range to the selection, reduce the selection to the range or remove the range from the selection.

action is defined using the PV Selection action constants.

Examples

1. We want to select the range of cells E2, E3, F2, F3. The selection action will depend on the context (already selected cells):

      `Arrays defining the existing selection:
   ARRAY LONGINT($Left;0)  `Left-hand cell column numbers
   ARRAY LONGINT($Top;0)  `Top cell row numbers
   ARRAY LONGINT($Right;0)  `Right-hand cell column numbers
   ARRAY LONGINT($Bottom;0)  `Bottom cell row numbers

   PV GET SELECTED RANGES LIST (Area;$Left;$Top;$Right;$Bottom)  `Get selected ranges if any

   If (Size of array($Left)=0)  `No current selection 
      PV SELECT RANGE (Area;5;2;6;3;pv selection set )  `Set the range as current selection
   Else   
      PV SELECT RANGE (Area;5;2;6;3;pv selection add )  `Add the range to current selection
   End if 

2. This example can be used to select or the cell which has been Alt+clicked (Windows) or Option+clicked (Mac OS), depending on whether or not it already belongs to the selection.

      `Definition of the current selection range
   PV SELECT RANGE (area;1;5;2;9;pv selection set)

      `Call a method when the area is clicked
   PV ON EVENT(area;pv on clicked;"ExampleView")

      `ExampleView method
   C_LONGINT($1;$2;$3;$4;$5)
   If(($2=pv on clicked) & ($3=2048))  `Alt + click or Option + click
      If(PV Is cell selected (area;$4;$5)=1)
            `If the cell is part of the selection, it is removed from it
         PV SELECT RANGE (area;$4;$5;$4;$5;pv selection reduce )
      Else
            `If the cell is not part of the selection, it is added to it
         PV SELECT RANGE (area;$4;$5;$4;$5;pv selection add)
      End if
   End if

See Also

PV GET CURRENT CELL, PV Is range selected.

Constants

PV Selection action theme.