Tech Tip: Make Only Some Parts of 4D Write Pro Table Enterable
PRODUCT: 4D Write Pro | VERSION: 20 | PLATFORM: Mac & Win
Published On: January 20, 2025
A developer may be creating a system using 4D Write Pro that programmatically makes forms that users will be able to fill out within 4D Write Pro itself. It may be desirable that some parts of these forms are unable to be changed by the end user (only able to be changed programmatically by the developer). This is possible with the following code.
Given that the developer already has programmatically created a 4D Write Pro table, one can create a range of cells that they do not want editable. In this example the first row's first 2 columns are protected. First protection must be enabled for the document, then the document's elements must be unprotected, and then the developer may set which cells are protected and protect those with ranges.
WP SET ATTRIBUTES(WParea; wk protection enabled; wk true) WP SET ATTRIBUTES(WParea; wk protected; wk false) $cells:=WP Table get cells($table; 1; 1; 2; 1) WP SET ATTRIBUTES($cells; wk protected; wk true) |
If line 2 is left out, the entire document may be protected so that none of it is editable. The code would only be this in that case:
WP SET ATTRIBUTES(WParea; wk protection enabled; wk true) |