Manage selections and the active cell in 4D View Pro

Automatically translated from English

Typically, 4D View Pro requires that you identify the cell being worked with and where data will be entered (the active cell). You may also need to select some cells and then perform an action, such as formatting or entering values in them. 4D v17 R5 provides a new set of commands to help you manage both the active cell and cell selections. 

HDI: New commands to manage cells

To set and get the active cell or selection in your document:

 

To view a cell in specific position (e.g., bottom right) of your 4D View Pro area, you can use:

New commands in action

You can get the range corresponding to the active cell with this command line:

$activeCell:=VP Get active cell ("ViewProArea")

The same logic applies to retrieve a current selection:

$currentSelection:=VP Get selection ("ViewProArea")

Setting your active cell is just as easy, simply pass new cell coordinates as parameter:

$activeCell:=VP Cell ("ViewProArea";5;6)
VP SET ACTIVE CELL ($activeCell)

And to set a new selection, pass a range of cells (adjoining or detached) as parameter :

$currentSelection:=VP Combine ranges (VP Cells ("ViewProArea";3;2;1;4);VP Cells ("ViewProArea";5;7;1;4))
VP SET SELECTION ($currentSelection)

Manage the View position of your cell

To view a cell in the center of your 4D View Pro area, you can use the following line of code:

$displayCell:=VP Cell ("ViewProArea1";50;50)
VP SHOW CELL ($displayCell;vk position center;vk position center)

The location of the cell won’t change, but the view of the cell will be repositioned horizontally and vertically so that the cell will be displayed in the center (if possible).

Fabrice Mainguené

• Product Owner •

Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.

After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.