4D Blog

Home Product Manage selections and the active cell in 4D View Pro

Manage selections and the active cell in 4D View Pro

May 20, 2019

Product

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:

  • VP Get active cell
  • VP Get selection
  • VP SET ACTIVE CELL
  • VP SET SELECTION
  • VP ADD SELECTION
  • VP RESET SELECTION

 

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

  • VP SHOW  CELL

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).

Discuss

Tags 4D View Pro, Spreadsheet, v17 R5, v18

Latest related posts

  • June 16, 2025

    Generate, share and use web sessions One-Time Passcodes (OTP)

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

Fabrice Mainguené
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.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy