What’s new in 4D 20 R5

4D Write Pro 

Wrap text around pictures and Text boxes.

With 4D 20 R5, pictures and text boxes now offer text wrapping capabilities, which provides flexibility in document layout design. With new anchor modes, users can wrap text around images and text boxes, creating visually appealing documents without constraints.

The 4D Write Pro interface has been improved to let you choose how you want pictures and text boxes displayed. New values for image/anchorLayout and textBox/anchorLayout standard action are available. You can also adjust these settings via programming using the new attributes: wk text wrap top bottomwk text wrap squarewk text wrap square leftwk text wrap square right, and wk text wrap square largest.  

As a bonus, this feature is taken into account when exporting to SVG, PDF, and HTML (based on embedded mode) and when importing and exporting to Word.

Handle Sections from the Interface

4D 20 R5 enables you to manage section breaks via the use interface.

The interface update introduces menus accessible through two buttons, enabling users to insert section breaks (as before) and access options for different pages. This allows for easy customization within sections, such as distinguishing the first page from the following ones or differentiating between right and left pages directly from the interface. Additionally, the new menu offers the convenience of removing headers and footers from sections and subsections.

Populate Tables with Unlimited rows and columns

4D 20 R5 removes the 1000-row limit.

This limit is no longer fixed and controlled by 4D Write Pro but is only limited by available memory. You can now associate data sources with tables, enabling automatic population without constraints.

wk page size for document sizing

4D 20 R5 introduces a new document attribute for 4D Write Pro: wk page size. This handy feature allows you to set both document width and height in a single step. Regardless of your current printer, you can choose from pre-defined printer formats, user-created custom formats, or even standard ISO formats (A0-C10, DL, Legal, etc.). This simplifies defining document sizes for various needs, saving you time and code!



Restrict data on entity selections

4D 20 R5 enhances data restriction on entity selections by streamlining the implementation of filters, ensuring more precise data retrieval tailored to specific criteria and user interactions, and securing data access through refined query and selection restrictions.

It enables 4D developers to apply business filters to the read data from designated data classes. Web developers can filter retrieved data based on user or other relevant information stored within web sessions. Qodly developers can filter the read data according to end users interacting with the application.


Improved 4D Client Licenses Usage

4D 20 R5 introduces a new feature for your REST APIs called Force Login. This mode ensures no one can access your data unless they’re properly authenticated by requiring a successful authentication before any data can be viewed or manipulated through the REST APIs. Also, this feature ensures that no 4D Client license is used until successful authentication. 

Programming-related features

Introducing Try-Catch Blocks

After implementing the throw() command and introducing the Try(Expression) keyword, 4D 20 R5 is shipped with the next evolution in 4D’s error handling system: the Try-Catch code blocks!

Developers can handle and localize errors with precision by encapsulating code within the Try, Catch, and End try keywords. If an error occurs, the Catch block executes to manage it appropriately.

Shared classes

4D 20 R5 introduces shared classes, which makes it easier to work with shared objects.

Shared classes simplify the process of creating and using shared objects by automatically handling the necessary setup. By adding the “shared” keyword to a class constructor or function, you indicate that it will create or modify shared objects.

4D Singleton

4D 20 R5 introduces an extremely useful feature: singletons which is an object that is accessible throughout your entire application. They offer a multitude of functionalities, serving as hosts for interprocess values and utility classes and even as foundational elements for design patterns such as the factory pattern.

They come into two types:

  • regular singletons, unique per process,
  • and shared singletons, which are unique to the whole application.

Defining them is simple. Add “singleton” to the class constructor. Then, you can easily access your singletons using the “me” attribute. 


Streamlined Property Declaration and Initialization

4D 20 R5 introduces a new feature that streamlines property declaration, allowing developers to initialize properties simultaneously with their declaration in a single line. This enhancement simplifies code readability and efficiency, reducing the need for separate initialization blocks. Developers can create cleaner, more maintainable codebases with options for inferred types or declared types and initialization.

New 4D remote session object with Client/Server connection

4D 20 R5 introduces an extended functionality to the Session command, covering Client/Server connections and stored procedures alongside existing Web and Mobile sessions in 4D applications. This update introduces a new class, ‘ClientServerSession’, specifically designed for 4D Remote sessions, offering the following properties: ID, info, storage, and userName.

Simplified package management

4D 20 R5 brings a feature that simplifies package management: Package Manager. You no longer need to store project components in a Components folder. Instead, this feature uses dependencies.json and environment4d.json, giving developers clearer insight into their application dependencies and the ability to customize their component paths.

Additionally, you can now access both 4D and project Components folder components via a new screen in the Design menu under Project Dependencies. Soon, you’ll also be able to add and manage dependencies directly from this interface, as well as other features for the Package Manager.


4D Project

Improved Catalog Management in Version Control Systems

Based on your feedback, We’ve significantly enhanced our 4D project setup.

Before, all project details, like colors and positions of tables, fields, and relations, were stored in catalog.4DCatalog. Now, we’ve split this info into a separate file called catalog_editor.json.

This makes managing changes and reviewing work easier, especially when multiple developers are involved. With this change, the catalog file stays untouched when someone adjusts a table or field.

This helps prevent conflicts and makes reviewing changes simpler. Plus, we’ve added an option to switch to this new setup for older projects. If you accidentally turn on this feature, don’t worry! You can easily undo it by reverting to the old setup.

4D View Pro

Enhancement of Custom Functions

4D 20 R5 enables custom calculations on column or row contents within a spreadsheet without prior knowledge of the number of cells involved. This is made possible by allowing the passing of multiple cell ranges or objects to custom formulas, resulting in the retrieval of a collection or object containing all cell content within a 4D method.

4D Netkit

Append an Email with Gmail

4D 20 R5 is bringing a new feature that allows you to create draft emails and save them directly to designated labels in your mailbox without sending them. This allows you to easily access and modify your templates whenever you need to send a similar email.

PKCE for OAuth 2.0

4D 20 R5 now includes PKCE (Proof Key for Code Exchange) in OAuth 2.0 authentication. By turning on the PKCEEnabled setting in the cs.NetKit.In the OAuth2Provider class, you increase security against interception and replay attacks. This feature adds extra protection by making sure each authorization code exchange is cryptographically secure. 

OAuth2.0 authentication using a certificate

In 4D 20 R5, Netkit now supports OAuth 2.0 certificate-based authentication for enhanced security.

Authentication becomes more robust by using certificates instead of client secrets, especially with servers like Microsoft Identity Platform.

User Interface

Customize App Appearance with New Windows Types

Two new window types allow you to design the window title bar yourself and add your own elements, such as buttons or a search box. This means complete freedom to tailor your application’s appearance to your specifications.

But that’s not all! We’ve also introduced several new commands designed to streamline your development process:

  • Reduce a window in the title bar on Windows or the dock on macOS, REDUCE RESTORE WINDOW
  • Know if the window is reduced in the title bar on Windows or the dock on macOS, Is Window Reduced
  • Know if the window is maximized, Is Window Maximized.

Improved Network Communication (QUIC)

IPv6 and Broadcast support

While QUIC (the future network system between 4D Remote and 4D Server) is still in development and not production-ready yet, 4D 20 R5 adds more functionalities; it’s time to start testing in your own network.

The broadcast feature allows users to easily identify and connect to 4D Servers running applications on their network, ensuring seamless integration. Additionally, the broadcast functionality has been refined to provide more accurate server listings, ensuring users only connect to relevant servers

Besides, IPv6 is also supported, which means you can use your 4D Server on an IPv6 network.

Visual Studio Code

Workspace Syntax Checking

With 4D 20 R5 and the 4D-Analyzer extension, Visual Studio Code now offers Workspace Syntax Checking. It helps reduce errors and streamline coding by checking the entire 4D project for mistakes. Errors and warnings are shown in a sidebar, making spotting and fixing issues easy. 

Automatic Tool4D Download

With version 0.2.0 of the 4D-Analyzer extension, rather than manually installing a 4D application and entering its path in the extension’s parameters, the extension automatically downloads a version of tool4d, stores it in a location on the system, and launches it in the background. This simplification aims to streamline the process of getting started and enhance development with VS Code for 4D.


GitHub Codepaces

GitHub’s Codespaces simplify remote development by enabling the editing of repositories from anywhere via Visual Studio Code or the Codespaces application.

With the integration of 4D projects, developers can enhance their coding experience with tools like 4D-Analyzer, which offers features such as code highlighting and auto-completion. As seen in the section above, 4D-Analyzer automatically downloads and updates the version of the tool4d application you have defined. 4D has released a dedicated version, tool4d, for GitHub to enable this in a Codespace environment.

Want to know more? Read all the blog posts about 4D 20 R5