Tech Tip: Programmatically set decimal tab alignment specifications
PRODUCT: 4D Write Pro | VERSION: 20.3 | PLATFORM: Mac & Win
Published On: June 3, 2024
When working with documents with other countries, you may find that your tab markers will not align correctly depending on whether the number contains a comma or a decimal as its separator. Since 4D v18 R5, 4D Write Pro has given the option to customize this alignment. The four options are as follows: the decimal, the comma, the first one found, and the separator defined in the operating system. By default, newly created Write Pro documents are set to the first one found, while migrated Write documents to Write Pro are set to whatever is defined in the system settings.
The code samples below showcase how to set up the tab alignment:
// align on decimal WP SET ATTRIBUTES(WParea; wk tab decimal separator; wk point) // align on comma WP SET ATTRIBUTES(WParea; wk tab decimal separator; wk comma) // align on first one found WP SET ATTRIBUTES(WParea; wk tab decimal separator; wk point or comma) // align on system settings WP SET ATTRIBUTES(WParea; wk tab decimal separator; wk system) |
Additionally, now in version 20.3 build 101286, 20R4 and 20R5, the decimal alignment it will now align on the implied decimal point of numbers, regardless of the additional characters afterwards. It will also keep the trailing spaces after any input. An example is shown below using a mix of whole numbers and decimal numbers, as well as the style for accounting, which encloses negative numbers with parentheses.