Configuring 4D View Pro Areas
The 4D View Pro area properties can be configured using the Property list. Spreadsheet properties are available through the language.
Form area properties
Using the area's property list, you can set 4D View Pro object properties such as Object Name, Variable or Expression, Appearance, Action, and Events.
Selecting a user interface
You can select the interface to use with your 4D View Pro form areas in the Property List, under Appearance:
You can also use the
userInterface
andwithFormulaBar
(only with the "toolbar" interface) JSON properties.
Interfaces allow for basic modifications and data manipulation. User-defined modifications are saved in the 4D View Pro object when the user saves the document.
Ribbon
Toolbar
Enabling the Toolbar interface displays the Show Formula Bar option. When selected, the formula bar is visible below the Toolbar interface.
With visible formula bar:
Features
Both the Ribbon and the Toolbar interfaces group related features into tabs:
Tab | Actions | Ribbon Interface | Toolbar Interface |
---|---|---|---|
File | File manipulation | X | |
Home | Text appearance | X | X |
Insert | Add items | X | X |
Formulas | Formula calculation and library | X | X |
Data | Data manipulation | X | X |
View | Visual presentation | X | X |
Settings | Sheet presentation reference | X |
Form Events
The following form events are available in the Property List for 4D View Pro areas.
Some of the events are standard form events (available to all active objects) and some are specific 4D View Pro form events. Some standard form events provide extended information in the object returned by the FORM Event
command when they are generated for 4D View Pro areas. The following table shows which events are standard and which are specific or provide additional information to 4D View Pro areas:
Standard 4D events | Specific and extended 4D View Pro events |
---|---|
On Load | On VP Ready |
On Getting Focus | On Clicked |
On Losing Focus | On Double Clicked |
On Unload | On Header Click |
On After Edit | |
On Selection Change | |
On Column Resize | |
On Row Resize | |
On VP Range Changed |
Sheet Options
The 4D View Pro sheet options object allows you to control various options of your 4D View Pro areas. This object is handled by the following commands:
Sheet appearance
Property | Type | Description | |
---|---|---|---|
allowCellOverflow | boolean | Specifies whether data can overflow into adjacent empty cells. | |
sheetTabColor | string | A color string used to represent the sheet tab color, such as "red", "#FFFF00", "rgb(255,0,0)", "Accent 5", and so on. | |
frozenlineColor | string | A color string used to represent the frozen line color, such as "red", "#FFFF00", "rgb(255,0,0)", "Accent 5", and so on. | |
clipBoardOptions | longint | The clipboard option. Available values: vk clipboard paste options all , vk clipboard paste options formatting , vk clipboard paste options formulas , vk clipboard paste options formulas and formatting , vk clipboard paste options values , vk clipboard paste options values and formatting | |
gridline | object | The grid line's options. | |
color | string | A color string used to represent the grid line color, such as "red", "#FFFF00", "rgb(255,0,0)", "Accent 5", and so on. | |
showVerticalGridline | boolean | Specifies whether to show the vertical grid line. | |
showHorizontalGridline | boolean | Specifies whether to show the horizontal grid line. | |
rowHeaderVisible | boolean | Specifies whether the row header is visible. | |
colHeaderVisible | boolean | Specifies whether the column header is visible. | |
rowHeaderAutoText | longint | Specifies whether the row header displays letters or numbers or is blank. Available values: vk header auto text blank , vk header auto text letters , vk header auto text numbers | |
colHeaderAutoText | longint | Specifies whether the column header displays letters or numbers or is blank. Available values: vk header auto text blank , vk header auto text letters , vk header auto text numbers | |
selectionBackColor | string | The selection's background color for the sheet. (preferred RGBA format) | |
selectionBorderColor | string | The selection's border color for the sheet. | |
sheetAreaOffset | object | The sheetAreaOffset's options. | |
left | longint | The offset left of sheet from host. | |
top | longint | The offset top of sheet from host. |
All properties are optional.
Sheet protection
To lock the whole sheet, you only need to set the isProtected property to true. You can then unlock cells individually by setting the locked cell style property.
Property | Type | Description | |
---|---|---|---|
isProtected | boolean | Specifies whether cells on this sheet that are marked as protected cannot be edited. | |
protectionOptions | object | A value that indicates the elements that you want users to be able to change. If null : the protectionOptions parameter is reset. | |
allowSelectLockedCells | boolean | Specifies whether the user can select locked cells, optional. True by default. | |
allowSelectUnlockedCells | boolean | Specifies whether the user can select unlocked cells, optional. True by default. | |
allowSort | boolean | Specifies whether the user can sort ranges, optional. False by default. | |
allowFilter | boolean | Specifies whether the user can filter ranges, optional. False by default. | |
allowEditObjects | boolean | Specifies whether the user can edit floating objects, optional. False by default. | |
allowResizeRows | boolean | Specifies whether the user can resize rows, optional. False by default. | |
allowResizeColumns | boolean | Specifies whether the user can resize columns, optional. False by default. | |
allowDragInsertRows | boolean | Specifies whether the user can perform the drag operation to insert rows, optional. False by default. | |
allowDragInsertColumns | boolean | Specifies whether the user can perform the drag operation to insert columns, optional. False by default. | |
allowInsertRows | boolean | Specifies whether the user can insert rows, optional. False by default. | |
allowInsertColumns | boolean | Specifies whether the user can insert columns, optional. False by default. | |
allowDeleteRows | boolean | Specifies whether the user can delete rows, optional. False by default. | |
allowDeleteColumns | boolean | Specifies whether the user can delete columns, optional. False by default. |
All properties are optional.
Cell Format
Defining a format pattern ensures that the content of your 4D View Pro documents is displayed the way you intended. Formats can be set using the selected 4D View Pro interface, or using the VP SET VALUE or VP SET NUM VALUE methods.
4D View Pro has built-in formats for numbers, dates, times, and text, but you can also create your own patterns to format the contents of cells using special characters and codes.
For example, when using the VP SET VALUE or VP SET NUM VALUE methods to enter amounts in an invoice, you may want the currency symbols ($, €, ¥, etc.) to be aligned regardless of the space required by the number (i.e., whether the amount is $5.00 or $5,000.00). You could use formatting characters and spectify the pattern ($* #,##0.00) which would display amounts as shown:
Note that when creating your own format patterns, only the display of the data is modified. The value of the data remains unchanged.
Number and text formats
Number formats apply to all number types (e.g., positive, negative, and zeros).
Character | Description | Example |
---|---|---|
0 | Placeholder that displays zeros. | #.00 will display 1.1 as 1.10 |
. | Displays a decimal point | 0.00 will display 1999 as 1999.00 |
, | Displays the thousands separator in a number. Thousands are separated by commas if the format contains a comma enclosed by number signs "#" or by zeros. A comma following a digit placeholder scales the number by 1,000. | #,0 will display 12200000 as 12,200,000 |
_ | Skips the width of the next character. | Usually used in combination with parentheses to add left and right indents, _( and _) respectively. |
@ | Formatter for text. Applies the format to all text in the cell | "[Red]@" applies the red font color for text values. |
* | Repeats the next character to fill the column width. | 0*- will include enough dashes after a number to fill the cell, whereas *0 before any format will include leading zeros. |
" " | Displays the text within the quotes without interpreting it. | "8%" will display as: 8% |
% | Displays numbers as a percentage of 100. | 8% will be displayed as .08 |
# | Digit placeholder that does not display extra zeros. If a number has more digits to the right of the decimal than there are placeholders, the number is rounded up. | #.# will display 1.54 as 1.5 |
? | Digit placeholder that leaves space for extra zeros, but does not display them. Typically used to align numbers by decimal point. | $?? displays a maximum of 2 decimals and causes dollar signs to line up for varying amounts. |
\ | Displays the character following it. | #.00? will display 123 as 123.00? |
/ | When used with numbers, displays them as fractions. When used with text, date or time codes, displayed "as-is". | #/# will display .75 as 3/4 |
[ ] | Creates conditional formats. | [>100][GREEN]#,##0;[<=-100 ][YELLOW]#,##0;[BLUE]#,##0 |
E | Scientific notation format. | #E+# - will display 1,500,500 as 2E+6 |
[color] | Formats the text or number in the color specified | [Green]###.##[Red]-###.### |
Example
//Set the cell value as $125,571.35
VP SET VALUE(VP Cell("ViewProArea";3;2);New object("value";125571.35;"format";"_($* #,##0.00_)")
Date and time formats
4D View Pro provides the following constants for ISO 8601 date and time patterns:
Constant | Value | Comment |
---|---|---|
vk pattern full date time | "fullDateTimePattern" | ISO 8601 format for the full date and time in current localization.USA default pattern: "dddd, dd MMMM yyyy HH:mm:ss" |
vk pattern long date | "longDatePattern" | ISO 8601 format for the full date in current localization.USA default pattern: "dddd, dd MMMM yyyy" |
vk pattern long time | "longTimePattern" | ISO 8601 format for the time in current localization.USA default pattern: "HH:mm:ss" |
vk pattern month day | "monthDayPattern" | ISO 8601 format for the month and day in current localization.USA default pattern: "MMMM dd" |
vk pattern short date | "shortDatePattern" | Abbreviated ISO 8601 format for the date in current localization.USA default pattern: "MM/dd/yyyy" |
vk pattern short time | "shortTimePattern" | Abbreviated ISO 8601 format for the time in current localization.USA default pattern: "HH:mm" |
vk pattern sortable date time | "sortableDateTimePattern" | ISO 8601 format for the date and time in current localization which can be sorted.USA default pattern: "yyyy'-'MM'-'dd'T'HH':'mm':'ss" |
vk pattern universal sortable date time | "universalSortableDateTimePattern" | ISO 8601 format for the date and time in current localization using UTC which can be sorted.USA default pattern: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'" |
vk pattern year month | "yearMonthPattern" | ISO 8601 format for the month and year in current localization.USA default pattern: "yyyy MMMM" |
Example
//Set the cell value as specific date and time
VP SET VALUE(VP Cell("ViewProArea";3;9);New object("value";!2024-12-18!);"time";?14:30:10?;"format";vk pattern full date time))
Custom date and time formats
To create your own date and time patterns, in your current localization, you can use combinations of the following codes:
Code (not case-sensitive) | Description | Example | |
---|---|---|---|
Date | (January 1, 2019) | ||
m | Month number without leading zero | 1 | |
mm | Month number with leading zero | 01 | |
mmm | Month name, short | Jan | |
mmmm | Month name, long | January | |
d | Day number without leading zero | 1 | |
dd | Day number with leading zero | 01 | |
ddd | Day of week, short | Tue | |
dddd | Day of week, long | Tuesday | |
yy | Year, short | 19 | |
yyyy | Year, long | 2019 | |
Time | (2:03:05 PM) | ||
h | Hour without leading zero. 0-23 | 2 | |
hh | Hour with leading zero. 00-23 | 02 | |
m | Minutes without leading zero. 0-59 | 3 | |
mm | Minutes with leading zero. 00-59 | 03 | |
s | Seconds without leading zero. 0-59 | 5 | |
ss | Seconds with leading zero. 00-59 | 05 | |
[h] | Elapsed time in hours | 14 (can exceed 24) | |
[mm] | Elapsed time in minutes | 843 | |
[ss] | Elapsed time in seconds | 50585 | |
AM/PM | Periods of day. 24 hour fomat used if omitted. | PM |
The code 'm' is interpreted depending on its position in the pattern. If it's immediately after 'h' or 'hh' or immediately before 's' or 'ss', it will be interpreted as minutes, otherwise it will be interpreted as months.
Additional symbols
In addition to the special characters and codes described in the previous sections, there are additional characters and symbols that can be used in your format patterns. These additional characters and symbols do not require a \ or "" and do not impact the interpretation of the format pattern. They appear "as-is" within the pattern.
Character | Description | Example |
---|---|---|
+ and - | Plus and minus signs | ### + ### = ###,### |
( ) | Left and right parenthesis | (-###.##) |
: | Colon | hh:mm:ss |
^ | Caret | #^# |
' | Apostrophe | '###### |
{ } | Curly brackets | {###,###,###} |
< > | Less-than and greater than signs | ## >## |
= | Equal sign | #+#=## |
/ | Forward slash. When used with numbers, displays them as fractions. | mm/dd/yyyy |
! | Exclamation point | $###.00! |
& | Ampersand | "Hello" & "Welcome" |
~ | Tilde | ~## |
Space character | ||
€ | Euro | €###.00 |
£ | British Pound | £###.00 |
¥ | Japanese Yen | ¥###.00 |
$ | Dollar sign | $###.00 |
¢ | Cent sign | .00¢ |
Print Attributes
4D View Pro print attributes allow you to control all aspects of printing 4D View Pro areas. These attributes are handled by the following commands: