4D View v16

PV SELECT RANGE

Home

 
4D View v16
PV SELECT RANGE

PV SELECT RANGE 


 

PV SELECT RANGE ( area ; left ; top ; right ; bottom ; action ) 
Parameter Type   Description
area  Longint in 4D View area
left  Longint in Column number of left cell
top  Longint in Row number of top cell
right  Longint in Column number of right cell
bottom  Longint in Row number of bottom cell
action  Integer in Select action

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:

Constant Type Value Comment
pv selection add Longint 1 The new selection is added to the existing selection.
pv selection reduce Longint 2 The selection is removed from the existing selection.
pv selection set Longint 0 The new selection replaces the existing selection.

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

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

 
PROPERTIES 

Product: 4D View
Theme: PV Selection
Number: 15945

 
HISTORY 

Modified: 4D View 2004.4

 
ARTICLE USAGE

4D View Language ( 4D View v16)