What’s new in 4D v19

This document is a compilation of all of the new features available in 4D v19. Note that each feature has a related blog post to walk you through concrete examples. These blog posts can be accessed by clicking the feature’s title.

Also, sections with the blank tag are related to all the new features released between 4D v18 R6 and 4D v19.

This document is divided into seven sections:

Native Silicon Support

Following Apple’s groundbreaking announcement (the new Silicon Macs), we released 4D v19 six months earlier than planned to provide you with a Silicon native version of 4D as soon as possible. In addition to the remarkable performance enhancements, here is what’s new:

 

As Silicon Macs are no more using an x86 processor architecture like Intel Macs and PCs, they can’t execute the same compiled code. As such, we had to enhance our compiler with a specific Silicon compilation (available only in project mode). You will now be able to compile your applications for Intel architectures (Windows and Intel Mac), Silicon architecture (Silicon Mac), or both architectures.

Plugins 

Plugins will also be slightly impacted. For a plugin to work on both Intel and Silicon Macs, you will need to compile it as a universal binary. And if you use third-party plugins, make sure to download Silicon-native or universal binary versions.

Need more time? 

Of course, 4D v19 will continue to work with Rosetta. If you need time to get your application working natively, it’s always possible to execute them on Rosetta.

Project mode features

Projects are a type of architecture that represents a giant step forward for 4D applications. They add the ability to leverage source control tools, collaborative programming, code sharing, modularity, and much, much more. At the time of writing this manual, thanks to the project architecture and the ability to share project application source code via a source control system, we’ve published more than 45 repositories to GitHub. This includes HDIs, components, and full example applications. 

4D v19 brings a whole new set of features that will greatly enhance your programming experience. 

Classes 

Thanks to project mode, we introduced classes. A class allows you to define the behavior of an object through properties and functions. Once a class is defined, you can instantiate objects of this class anywhere in your code. Each object is an instance of its class. Classes can extend other classes, and then inherit from their functions.

Two types of classes are available in 4D: built-in 4D classes (returned by the 4D command) and user classes (returned by the cs command).

To create an object as an instance of a class, use the cs command with the new member function. Another important term to know is the constructor. The constructor is used to create and instantiate an object with default attributes. It’s called automatically when an object is initialized. Creating a class is done from the “New” menu in the toolbar, or from the “Explorer” dialog. A class editor will be displayed where you can create the class constructor and functions. Read the documentation

Class Inheritance 

Inheritance allows a class to inherit the behavior of another class (the parent class). To derive a child class from a parent class, use the Class extends keyword. This automatically calls the constructor of the parent class (if you haven’t defined a specific constructor for the child class). You can also use the Super command to call the constructor of the parent class. Read the documentation

Naming parameters for methods and functions 

There’s no need to go through an intermediate variable, you can now name your parameters and results when declaring a:

  • project method,
  • trigger,
  • database method,
  • form method,
  • class constructor,
  • class function. Read the documentation

 

CSS preview in the form editor 

This feature was the highest voted feature request and the fastest to become a top-voted feature request in our feature request forum. It allows you to preview the final CSS rendering in the Form editor. A new icon in the toolbar allows you to view your form with or without CSS rendering, and even see how it would look like with specific CSS rendering on Mac or Windows.

As for overriding properties in CSS mode, a new shield type (similar to the shields for Object Method or Entry Order) is displayed in the Form editor. Now it’s easy to see which objects are impacted by CSS styling. Read the documentation

 

Server code development 

Developing and debugging server code in project applications becomes easier. In team development mode, it’s common for several developers to do single-user development and commit their changes to a version control system. The RELOAD PROJECT  command, in combination with commands like git pull, allows updating a running server with new code without needing to restart for testing, or even for production.

When a 4D Developer client connects to a 4D Server on the same computer, the .4DZ file is not transferred from the server to the client. The 4D Remote manages the project files (methods, forms, resources, etc.) as if it were a 4D single-user client. The project files are shared by 4D Server and 4D Remote. This way, you can modify your code and test it on the fly.

If you want the server to reload the modified files, switch to application mode from the development environment. Move the 4D Server to the foreground or select the “File / Save all” menu item in the 4D Remote (or use the new RELOAD PROJECT command).

Remember that running a method on the client-side automatically performs a “Save all” action, and as a result, reloads the modified files on the server-side. Read the documentation

 

Macros 

Macros are now available in the Form editor. With a form macro, you can:

  • Modify, delete or add a property to one or more form objects, such as changing the color or width of a button
  • Add or delete one or more form objects (including their associated object method)
  • Select or deselect form objects in the editor
  • Display a modal dialog to enter a parameter on the fly
  • Calculate the ideal position of form objects and move them
  • Create a CSS class from a form object to use as a template
  • Check that image paths in the form are valid
  • Open CSS files in your CSS editor instead of searching files on your disk
  • Check that XLIFF references have their correspondence in the XLIFF files
  • and so much more!

Form macros are available from the contextual menu. Host database macros are displayed first, followed by component macros. To execute a macro, simply click on the menu item. To create form macros, declare them in a formMacros.json file at the first level of the Sources folder in your project. Make sure to check out the macro examples we’ve made available on GitHub. You can integrate them into your applications as components to test them. Read the documentation

 

Method documentation

You can write your own documentation for database, trigger, project, and table form methods. Documentation is saved in a Markdown file with the same name as the method or form in a documentation folder. Markdown is a standard format for documentation and allows enhanced formatting styles. The format can be displayed in 4D Explorer, in GitHub, or other tools. The documentation can contain a description of an element, as well as any information necessary to understand how the element functions in the database. To create or edit the documentation file in a project database, from the Explorer click the “Create” button or select the “Edit Documentation” menu item. 4D creates the corresponding file and opens it in your default editor with a preset template. Read the documentation

4D provides three automatic font themes that respect the guidelines of each platform. 4D v19 allows you to override the size of these automatic themes and have more control over how your text is displayed. Read the documentation

 

4D for iOS 

 

The feature set of 4D for iOS has expanded with 4D v19:

 

Work offline blank

You now have the ability to work offline and interact with your 4D server in a very flexible way.

When no network is available, your tasks are put in a queue, waiting for the server to be available. This guarantees you a very smooth and efficient way of working, with apps that work without any delays. Read the documentation

 

Deep linking

Deep linking allows you to share a URL, for example in an email. Clicking on the URL will directly open a specific record in a 4D for iOS app. In combination with push notifications, you can inform salespeople about a new quote or insurance agents about a new case. A single click directly opens the app and displays the appropriate record. Read the documentation

 

Push notifications 

Push notifications are a perfect way to keep your iOS app users engaged and informed.

You can set up push notifications to trigger synchronization on iOS devices. This allows the user interface to be updated instantly, providing users with real-time data they can check upon receiving a notification. Read the documentation

 

New parameter formats: Signature and barcode

To help make your apps more interactive, new parameter formats to 4D for iOS had been added:

  • Signature format: sign with a fingertip and send signatures directly from your app to the server. This could be useful to collect customer signatures after a package delivery, for example.
  • Barcode format: associate any value with a barcode (EAN13, EAN8, QR Code, etc.) to be extracted by simply scanning it from an Action form. This is a very convenient way to add, for instance, an item reference by scanning a QR Code directly from your app. Read the documentation

 

You can access and publish One to Many relations from your Many to One relations in the Structure section. In short, this means that you can display Many to Many relations, which allows you to deliver iOS apps with better ergonomics than ever before. This comes with additional features such as adding interactions to a field by dropping a relationship onto it and displaying the corresponding record number from clicking on the One to Many relations. Read the documentation

 

Support of barcode scan

Searching is greatly enhanced thanks to the addition of barcode scan support. This makes it possible to have apps adapted to field situations (e.g., for warehouse inventory needs).

More technically, this feature allows:

  • Filtering a list form depending on the code’s value. If a record matches the barcode value, the record’s detail form will open automatically.
  • When combined with deep linking, displaying specific list and detail forms by simply scanning a barcode whose values are URL Schemes or Universal Links. Read the documentation

 

Sign In With QRCode blank

4D for iOS provides a new modern way to log in. The SignInWithQRCode login form template allows app users to log in by scanning QRCode, or access the app directly if they’ve already been authenticated. Read the documentation

 

Optimized data synchronization 

4D for iOS data synchronization process has been optimized, improving data sync speed up to 25 times faster. Read the documentation

 

Email Authentication 

4D for iOS allows you to determine the authenticity and legitimacy of the person trying to log in to your app. The process updates a user’s session status to give them access to the application:

  1. In the login form, when a user enters an email address and clicks on the Login button, the session status is updated to “pending” and an email with a validation link is sent to that email address.
  2. When the user clicks on the validation link, the session status changes from “pending” to “accepted”.
  3. The user can reopen the app. Because the session status is now “accepted”, access is granted.

The component that handles and makes the process easier is available, so you can adapt the authentication process to your own needs. Read the documentation

 

Build detail form templates

Since detail forms are scrollable, you can drop as many fields as you want onto your detail form templates. There are many ways to add fields to your detail forms:

  • Select a blank template and drop all your fields onto it
  • Drag and drop fields anywhere in the view to add and display them immediately after the last added field, or drop them in between fields
  • Double-click on a field to add it at the end of the list
  • Right-click on one of the available fields in the Fields table on the left. This will display a menu that lets you add any missing fields to your detail forms. Read the documentation

 

Ready to use templates

40+ ready-to-use templates are available in the project editor. The gallery is based on a dynamic list of up-to-date templates available on GitHub. To use a template, a “More” icon is available for both list and detail forms. Click it to display the entire list of templates from the Forms section. Select the template and 4D for iOS will handle the installation. You can then adapt it to your needs. Read the documentation

ORDA

4D v19 continues to bring enhancements to ORDA. Besides the diverse features available (see below), ORDA makes it possible to create high-level class functions above the data model. This allows you to write business-oriented code to hide complexity, reduce errors, and speed up the development process. Additionally, you can expose your project just like an API with a REST server.

ORDA classes to handle the data model 

ORDA’s structure (datastore, dataclass, entity, entity selection) is made up of strongly-typed objects linked to specific ORDA classes. This means that you can write functions that hide the complexity of your data’s physical implementation. 

4D automatically creates the following:

  • Entity class: For implementing functions related to an entity (for example to calculate shipping costs for the current quote. Code assigned to a given record).
  • EntitySelection class: For implementing functions related to an entity selection (for example to run a statistic on the selected records. Code assigned to a selection)
  • DataClass class: For implementing functions related to the dataclass (to run code related to a table, but independent of a specific record or selection. For example to create a new record based on provided parameters)
  • DataStore: For implementing functions related to the datastore (to run code not related to a table or record, similar to a generic project method). Read the documentation 

 

ORDA data model classes and REST 

You can call class functions defined for the ORDA data model through REST requests in order to benefit from the exposed API of the targeted 4D application project. Expose your business logic with a controlled API (through your classes) for other tools, such as web frameworks like Angular or React. Read the documentation 

 

Scope and execution context for functions 

By default, in client/server mode, ORDA class functions are executed on the server. With the new local keyword, you can choose to execute some functions on the client. You can also choose which functions to publish (or not) as APIs for REST clients with the new exposed keyword. Read the documentation

 

Looping with a new 4D tag blank

A new 4D tag is now available: the 4DEACH tag. It can be used as a 4D tag in SHTML pages as well as with the PROCESS 4D TAGS command, making it simpler to use ORDA or object in PROCESS 4D TAGS or SHTML. Read the documentation

 

Model update

When working with 4D in standalone mode, you no longer need to restart your database in order to have an up-to-date datastore when the structure is updated.

If you work in client/server mode, this works fine for code running on the 4D Server. For remote clients, you simply need to restart the client requiring the structure’s update. Read the documentation

 

Shareable entity selections 

Sometimes you may want to share an entity selection with another process or make it available to all processes. For example, imagine you’re performing a complex query to find all overdue invoices, allow end-users to select some (or all) of them, and send a payment reminder via email. Sending emails is best done in another process to avoid blocking the user.

Instead of building a list of primary keys to pass to the other process, a shared entity selection can be directly passed to another process. Shared entity selections can even be attached to the Storage object to be shared with all processes.

In a nutshell, an entity selection can be shareable or non-shareable:

  • A shareable entity selection can be stored in a shared object or a shared collection and can be shared between several processes or workers. It does not allow the addition of new entities. Trying to add an entity to a shareable entity selection will trigger an error.
  • A non-shareable entity selection cannot be shared between processes, nor can it be stored in a shared object or collection. Trying to store a non-shareable entity selection in a shared object or collection will trigger an error. However, a non-shareable entity selection accepts the addition of new entities. Read the documentation

 

Entity selection new methods

New member methods are at your disposal:

  • extract(): to extract data from an entity selection. This allows you to build a fully customized collection with your entity selection data. You can specify the dataclass attributes you want to extract and their names in the resulting collection.
  • refresh(): invalidates the entity selection data in the ORDA cache. It triggers an update from the server the next time you use the data. By default the ORDA cache expires after 30 seconds, so use this member method in case you need up-to-date data immediately. Read the documentation

 

4D language & other programming features

Dark Mode support on macOS blank

4D has added Dark Mode support, which gets applied automatically if Dark Mode is turned on at the macOS level. This is just the beginning and more will be released in future versions, such as support in all components (e.g. the 4D Write Pro widget), and Design Mode. Read the documentation

 

Multiple themes for the code editor blank

4D offers you basic themes that you can enrich and adapt to your own taste:

  • “default light theme” (based on the classic color editor)
  • “default dark theme” (new color)

If you prefer the colors in your colleague’s theme or if you find a theme more to your taste on GitHub for example, you can import them by adding the JSON theme file in:

  • “<diskName>/Users/<userName>/Application Support/4D/4DEditorTheme” on macOS
  • “<diskName>:\Users\userName>\AppData\Roaming\4D\4DEditorTheme” on Windows. Read the documentation
 
Launch a compilation by programming blank

In continuous integration systems, every time code is submitted, or on an hourly basis, a compilation of the source code is automatically launched. This approach allows you to check merges on the code management server. Starting from 4D v19, the new Compile Project command allows you to launch code compilation, so you can set up this type of system. Read the documentation

 
Manage your Application’s Information blank

To build your application, you use the BUILD APPLICATION command with a set of XML keys that allow you to configure the built application. After the build process, it’s possible to add information such as company, copyright, or version for the application. Starting with 4D v19, you can read, add or modify them on Windows or macOS platforms with no need to master the XML language and the info.plist file’s structure.

For that, we’ve added two new functions to the File class to allow reading and writing application information:

  • To add the information to a .exe (Windows) or .plist (macOS) file, you can pass an object with the attributes you want to set to the setAppInfo function.
  • To read the information from a .exe or .plist file, simply use getAppInfo, and you get all the attributes in one object. Read the documentation

 

 

Simplify the creation of the 4D Archive Client blank

Starting with macOS Big Sur, unsigned applications cannot be run. In the past, we have released a workaround to build client-server applications running on a Windows server and accepting connections from Mac clients. With the release of 4D v19, we have updated the application building in 4D to handle this scenario. 

 

Evolution of 4D log format blank

We recently reviewed our log formats to improve readability and compliance with automated analysis. We made these improvements in response to real-life situations we experienced, directly addressing the issues that were limiting our ability to use 4D logs. Read the documentation.

 

Use collections and lists within forms objects blank

Starting with 4D v19, you can use collections to define the content of some interface objects, including using the Form function. This is very useful for generic interface management. We’ve also added improvements to how lists are used.

List usage has been improved on:
Hierarchical lists
Tab controls (first use case)

Collections can now be used as references with the following objects:
– Drop-down lists (Also known as “pop-up lists”)
Combo boxes
– Tab controls (second use case). Read the documentation

New declaration syntax

A new syntax to declare your variables is now available. It uses the var keyword, the name of the variable, and its type. This new syntax allows you to greatly enhance autocompletion when declaring your variables. You can declare variables using both the classic and the new syntax in the same database. Read the documentation

Display of the prototype and short description

To simplify and facilitate the writing of code in the editor, the prototype of a function and a short description are displayed in the code editor.

The suggestion list displays intelligent code completion (with a short description) and prototype so that you can write code more quickly and correctly. And while you’re writing your function, 4D displays the function’s prototype and a short description of the function. It also highlights the parameter that you’re currently completing. Read the documentation

 

Emails 

OAuth 2.0 support

OAuth 2.0 is an authentication and authorization standard that protects user data by providing access to the data without revealing the user’s identity or credentials. Lately, email servers have started to move to this standard to increase security. Office365 and Gmail recommend using OAuth 2.0 to handle emails.

Starting with 4D v19, we’re providing a way to set up OAuth 2.0. IMAP, SMTP, and POP3 transporters now natively support the OAuth 2.0 protocol. Read the documentation

 

Manage IMAP flags

The IMAP protocol allows you to associate a list of flags with a message in order to manage additional information. We’ve added a set of functions to the IMAP transporter object to add or remove IMAP flags.

With the IMAP protocol you can manage five flags :

  • \Seen: Message has been read.
  • \Answered: Message has been answered.
  • \Flagged: Message is marked as “flagged” for urgent/special attention.
  • \Deleted: Message is marked as “to be deleted”. The removal takes effect when the expunge() function is called, switch mailboxes, or close the connection. This flag is already added by the delete() function
  • \Draft: Message has not completed composition (marked as a draft). Read the documentation 

 

Create, delete, and rename mailboxes with IMAP blank

Functions are available to help you manage your mailboxes by programming. That includes creating, renaming, and deleting mailboxes. A mailbox is displayed as a folder in email clients such as Microsoft Outlook or Apple Mail. Read the documentation

 

Save emails in a specific mailbox

When sending an email from 4D, if your customers are expecting to get a copy in the “Sent” mailbox displayed by Outlook or Apple Mail, you can save a copy of it after sending it:

  1. Create two transporters: an SMTP transporter to send the email to your client, and an IMAP transporter to upload your email to your mail server.
  2. After sending your email with SMTP, use the append() function of the IMAP transporter. Read the documentation

 

Search and download emails

The searchMails method allows retrieving a list of messages based on criteria such as all unread emails or all emails from a specific person within the last 4 weeks. The command returns a collection of mail IDs, which can be used directly by the new getMails method (to download them, for example).  Read the documentation

 

Copy, move and delete emails

Three new functions have been added to the IMAP transporter: copy()move(), and delete(). Read the documentation

 

Receive emails using POP3

You can locally download your emails and remove them from your email server via POP3 thanks to the new POP3 New transporter command. The Post Office Protocol (POP) is an internet standard protocol used to retrieve email from a mail server. This standard is useful for actions such as connecting to a POP3 server, retrieving messages to process them automatically (to store them in your local database), and deleting them from the server. Additionally, several methods have been added to enhance email handling:

  • getMailInfoList(): Returns information about all of the messages in your mailbox.
  • getMailInfo(): Returns information about a single message.
  • getMail(): This lets you download specific messages by passing a message number returned by getMailInfoList() as a parameter.
  • delete(): Flags specified messages to be deleted during the session closure.
  • getBoxInfo(): Returns the number of emails in your mailbox and the size of the mailbox. Read the documentation

 

Receive emails using IMAP

As for SMTP and POP3, the new IMAP New transporter command handles the IMAP protocol. We’ve added commands that enable choosing a mailbox and downloading an email. Read the documentation

 

Download emails in MIME format

4D v19 provides a command to let you store emails in their original, unconverted, received format. Using the POP3_transporter.getMIMEAsBlob( ) method, you can obtain a BLOB containing the MIME content for a specific message, which can be saved in your database or somewhere else. Read the documentation

 

Encrypt your own data with the 4D algorithm blank

4D offers you a simple, yet powerful way to encrypt your data. Now, it also allows you to use the same algorithm as the one used for data encryption (AES-256) for your own needs. So now you can encrypt and decrypt any information you want with a set of new commands: Encrypt data BLOB and Decrypt data BLOB. Read the documentation

 

New CryptoKey class 

The new CryptoKey class provides a set of methods for performing common cryptographic operations (such as signature and verification, encryption, and decryption). It provides a way to ensure:

  • Confidentiality (protecting data from unauthorized access)
  • Integrity (ensuring data is complete and correct)
  • Authenticity (validating the authenticity of a message or a sender/recipient) Read the documentation

 

Web 

Scalable web sessions

The 4D Web Server now supports scalable web sessions, a new type of web session that will greatly improve the performance of your web applications.

Scalable web sessions can handle several processes in preemptive mode. This means that they can handle several user agent requests at the same time, and they can also share data between these processes. Read the documentation

 

SameSite and Secure attributes for cookies blank

Cookies have evolved over the years but they’ve left some legacy issues. To handle this and enable a secure-by-default model for cookies, browsers (including Safari, Chrome, Firefox, and Edge) are changing their behavior regarding the SameSite and Secure attributes. For that reason, 4D v19 is bringing some enhancements. Read the documentation

 

Support for Cross-origin resource sharing(CORS)

The CORS protocol prevents a web page from making requests to domains other than its own. However, if you need to allow other sites to make HTTP requests to your server in order to get or send some data, now it’s possible via:

  • programming: thanks to the WEB SET OPTION and WEB Server commands. They take in domain parameters to allow specific actions (GET, POST, HEAD, PUT) 
  • database settings: thanks to options available on the Settings Web > Options (II) window. Read the documentation

 

Data Explorer (Preview)

4D v19 offers a preview version of 4D Data Explorer. 4D developers and administrators can now easily explore their application data in a web browser with no need for a Web Server license. Check out this video to see the product in action.

 

Customized 4D cache folder for merged 4D Server 

If your machine hosts a merged server application built with different 4D versions, you may encounter issues due to the shared 4D structure folder. To avoid sharing this system folder between merged server applications built with different 4D versions, you can now define the folder name during the build application process with the new buildApp key to set your own structure folder. Read the documentation

 

Customized 4D cache folder for merged 4D Clients 

Connecting your remote application to several servers can sometimes result in obtaining a large local resources folder in the system, which can consume a lot of time, volume, and bandwidth. The new buildApp key makes it possible to share the same local resource folder between all identical servers. Read the documentation

 

Improved journal integration 

When running a 4D Server in production, everything should be fully automatic and work without the intervention of an administrator. This is especially important with Auto Update and when operating in Headless mode. After a power loss or crash, minor errors in the journal might stop a 4D Server from restarting automatically. A new option now allows suppressing non-critical error messages (but still reporting them in a log), reducing system downtime. Read the documentation

 

Dynamically grant user permissions 

Following the ability to use your own end-user management system and the SET USER ALIAS command, we’ve added the ability to manage end-user permissions. The new SET GROUP ACCESS command lets you dynamically set group memberships. Read the documentation

 

Store user aliases in the journal

The behavior of the SET USER ALIAS command has been extended in 4D v19 to let you know who did what. Now when an alias is set, it’s also stored in the journal. This lets you retrieve the correct user, even if several users share the same computer and/or system account. The user’s name is displayed in:

  • the MSC’s Activity analysis and Rollback tabs
  • the dialog displayed with the CHECK LOG FILE command
  • the JSON file generated by LOG FILE TO JSON Read the documentation

 

Monitor  slow operations 

To discover which operations are slowing down a server, you can use the new START MONITORING ACTIVITY command. It records operations exceeding a specified duration in memory.

Based on the specifications set by this command, you can also get all of the recorded activities with the Get Monitored Activity() command. Once you decide to stop recording your 4D application’s activity or empty the activity list, call the STOP MONITORING ACTIVITY command. Read the documentation

 

Listbox

Manage clicks in edited cells 

The on clicked

form event is triggered whether a cell is being edited or not, giving you increased control and improving the interface. This can be useful if you want to display the possible values for a cell when it’s being edited, by using a contextual menu for example. Once the row is selected, you can offer a color choice for that particular row or cell.

To ensure compatibility, if you already have code that runs during the on clicked event, you may want to stop the execution of that code when a click occurs inside an edited cell. In this case, simply test the state of the cell with the is editing text function beforehand. Read the documentation

Times columns and footer calculations blank

While the new list boxes using collections or entity selections offer more possibilities, they did not allow time display and automatic calculations in the footer, unlike list boxes displaying arrays or records.

Now all types of list boxes can display time in their columns and calculations in the footer. Read the documentation 

Improved type ahead

Normally, a list box can only receive keystroke events in edit mode. This prevented automatic list filtering or entry selection when a user was using the keyboard or non-enterable list boxes.

Now, the On before Keystroke event is generated as soon as the list box has focus, and a key is typed even if data isn’t being entered into a cell. This allows 4D to know which keys have been pressed and makes it possible (by programming) to make decisions such as starting a new search or changing the current selection.

The new Is editing text command has been added to help determine if there is an ongoing input when the On before keystroke event is generated. For example, it allows a list box to be editable – and still supports type-ahead features. The On before keystroke and On after keystroke events now support system help dialogs to select diacritics such as éä, or Asian characters. The event is delayed until the end-user selects the final characters. There’s no need to handle this yourself. Read the documentation

 

Pro Listbox features for free

You no longer need a 4D View Pro license to use these advanced features. You can take full advantage of list boxes to:

  • automatically adapt the height of each row to its content so that the full text or picture gets displayed
  • use object arrays in columns to enable entering and displaying various types of values in the rows of a single list box column. 

 

Set up movable rows by code

In Design mode, when using array-based list boxes, you can define if end users can move rows (e.g., to reorder or group rows, etc.). The LISTBOX SET PROPERTY and LISTBOX Get property commands have been updated to support to support the new lk movable rows property. Read the documentation 

Listbox row selecting

The new LISTBOX SELECT ROWS command facilitates the selection of rows in an entity selection. It takes an entity selection as a parameter, and rows matching the entity selection can be selected intuitively (including rows added or removed from the selection). For collection list boxes, you can pass a collection containing the object references you want to select. Read the documentation

 

Take control over the work area 

Graphic system elements such as the macOS dock or the Windows taskbar are taken into account so you can use the entire available work area. A new optional parameter has been added to the SCREEN COORDINATES command: Screen work area. This way, you can be sure that your application’s windows are in a viewable area (especially in SDI mode on Windows). Read the documentation

 

XML: Enhanced XPath support

Beginning in 4D v19, XPath implementation is more compliant and simplifies your searches by allowing the support of expressions such as //, @, *, and last(). For compatibility reasons, the previous, non-standard implementation is maintained by default in converted databases. To take advantage of the extended features in your converted databases, select the Use standard XPath compatibility option on the Compatibility page. Read the documentation

 

Object and collection enhancement

The OB Copy() command and the collection.copy() member method have been enhanced. They now give you the ability to add a standard object in a shared object or collection, making it simpler to copy this standard object’s content to the shared object or collection. In addition to this, new commands for handling objects as hash maps are now available:

  • OB Keys: returns an object’s property names as a collection
  • OB Values:  returns an object’s property values as a collection
  • OB Entries:  returns a collection of objects with key properties (property name) and values (property value). Read the documentation

 

Create an offscreen web area

4D v19 lets you use a web area in offscreen mode with the WA Run offscreen area command. It creates a web area in memory and takes as parameters all the relevant pieces of information for the web area, such as:

  • the URL to load
  • the area’s name
  • the formula called when an event is thrown by the web area

To simplify the debugging offscreen web areas, the new  WA OPEN WEB INSPECTOR command has been added. It opens the web inspector and allows you to verify if the page is correctly loaded or if your JavaScript code throws errors. Read the documentation

 

Access form object values by programming

Two new commands are available to help you access the values of form objects, regardless of their variable or expression: OBJECT Get value and OBJECT SET VALUE.

  • To get the value of a form object, use the OBJECT Get value command and pass the name of your form object as a parameter.
  • To set the value of a form object, use the OBJECT SET VALUE command and pass the name and the new value as parameters. Read the documentation

 

String comparison improvements

4D provides versatile tools for searching and comparing strings. They can be adapted to different contexts and situations.

With 4D v19, updates have been made to the Position command and the new Compare strings command has been added:

  • Position: this command now has more comparison abilities such as “case sensitive” or “accent sensitive”, and the following search options are now available: 
    • Japanese language (Hiragana/Katagana)
    • character width
    • “whole word”
  • Compare strings: this new command allows you to compare strings with the same options as the ones added to the Position command. This command is based on the language defined in the database settings. This can be useful to allow specific sorts for example. Read the documentation

4D debugger enhancements

4D v19 includes new options and additional information that will make it easier to trace and analyze your code.

    • Parameters: Knowing the input and output parameters of a method or function, as well as their type, is essential for debugging code. The declaration line is displayed at the top-left of the debugger window. In the call chain pane, you can choose to display or hide the parameter’s type.
    • Comments: To help explain a method or function, a common practice is to include comments at the beginning of code blocks. These comments are now visible in the debugger. Read the documentation

 

Remote debugger

This feature lets you decide where you want to debug your server code (on the client-side or server-side). Client-side debugging is especially useful if you run your server in headless mode or as a Windows service.

Two new menu items have been added on both sides to manage the debugger attachment:

  • Attach / Detach debugger: Instantly attach or detach the debugger to your client or server.
  • Attach debugger at startup: Attach the debugger when you start your client or server. 

Keep in mind that the debugger can only be attached to a single instance of 4D at a time. For example, if you try to attach the debugger to your server without detaching it from the client, you’ll get an error message with information on the debugger’s owner.

To help you differentiate if the debugger or the error windows are from the server or the client, we’ve changed the look of these windows. Read the documentation

4D Write Pro

 

Convert your Word documents to 4D Write Pro format blank

You can now import .docx documents into 4D Write Pro. To do so, use the new wk docx constant with the existing  WP Import document command. Please note that 4D Write Pro will import most of the content of the MS Word document, except for what is not supported in 4D Write Pro (as detailed in the documentation chapter: Importing and exporting in .docx format).  Also, during the import process, an import log is generated and integrated inside the 4D Write Pro document itself. You’ll be able to consult it to see if any potential differences between the original and the converted document. Read the documentation

 

Direct export to PDF

Without installing any print drivers or additional software, 4D Write Pro documents can be exported directly to PDF format. A direct export is not only faster and more reliable than a print driver, but it also gives you more control over the result. It supports hyperlinks, allows image size optimization, and more. The WP EXPORT DOCUMENT command has been updated to accept a new constant: wk pdf. Read the documentation

 

Find and replace blank

Finding and replacing text inside a 4D Write Pro document is already possible with basic commands like WP Get text and WP Set text. The new WP Find all command makes this process faster than ever. Read the documentation

 

Locate all the breaks blank

4D Write Pro documents support five types of breaks:

  • line breaks
  • paragraph breaks
  • page breaks
  • section breaks
  • column breaks

Sometimes, you need to locate a certain type of break to replace it with another, or simply delete all its occurrences in the document. To make this possible, we developed a new function: WP Get breaks. Read the documentation

 

Formulas: manage carriage return behavior

The new document property wk break paragraphs in formulas defines how a carriage return should be treated is available. It has two possible values:

  • wk true: Interpreted as paragraph breaks.
  • wk false: (default value) Interpreted as line breaks. Read the documentation

 

UI enhancements

A new tab is available in the 4D Write Pro interface widget. It allows you to import and export documents in different formats. We’ve also added improvements to the toolbar and the sidebar. Now you can:

  • increment or decrement text
  • copy and paste the ruler
  • change the background color of a paragraph
  • change the style of a word (uppercase, lowercase, etc.). Read the documentation

 

Select widget pages to show

4D displays only the pages mentioned in the collection, in the order of the collection. This allows reducing the feature set to make it simpler for the end-user. If only style options are needed, it’s better not to display the other functionalities. Now, the 4D Write Pro widget provides the ability to select which pages to display with the new WP ShowTabPages component method. Simply pass the widget name and a collection of pages to display when you call the method. Read the documentation

Select character for decimal tabs

If you have documents from various sources, the numbers may not be correctly formatted for your needs. Now, 4D Write Pro lets you specify this setting for each document. You can choose to align numbers either to:

  • the point
  • the comma
  • the first separator found (point or comma)
  • the separator defined in the operating system

In order to maximize compatibility (with MS Word in particular) option #3 is used by default when creating new documents. When migrating 4D Write documents to 4D Write Pro, the system-defined separator is used by default. Read the documentation

 

Manage soft hyphens

The insertion of soft-hyphens has been simplified by providing new standard actions, as well as new buttons in the 4D Write Pro Interface widgets.

Two new standard actions are available:

  • insertSoftHyphen
  • removeSoftHyphens

The functionality has also been added to the 4D Write Pro Interface widgets in both the toolbar widget and the sidebar widget. Read the documentation

New standard actions for tables and their elements

4D v19 adds new standard actions to 4D Write Pro, targeting tables, rows, and cells. They allow you to define the border type of a table, the background color of a cell, the vertical alignment of the text in a row, the alignment of the table itself within the document, the margins, the padding, and 40+ other options. Consequently, the interface of 4D Write Pro has been enhanced in terms of table processing capabilities. Four new buttons have been added to change the appearance of tables, rows, columns, and cells. Read the documentation

Support of protected attribute

In 4D v19, designated parts of 4D Write Pro documents (or all parts) can be “non-editable”. Two levels of protection are available. First, define which part of the documents will be protected (by default, all parts are protected). Then, activate the document protection flag so that the settings you have made are taken into account. For this,you can use two new attributes with the  WP SET ATTRIBUTES command:

  • wk protected (can be set to almost any type of target belonging to a document)
  • wk protection enabled (enables or disables the global document protection). Read the documentation

Manage formulas inside documents

4D v19 includes a set of commands that can help you manage formulas inside your 4D Write Pro documents:

  • WP Get formulas: Retrieves all of the formulas within a specific target (the full document itself, and also more specific parts of a document such as the body, the second section, the left header, etc.),
  • WP Insert formula: Inserts an expression as a formula object within any given range,
  • WP Compute formulas and WP Freeze formulas: Can be used in a very similar way (i.e., using a target). Re-evaluate all of a document’s expressions or simply freeze only expressions belonging to the footers. Read the documentation

Delete pictures

Deleting inline or anchored pictures can now be done with the new WP DELETE PICTURE command. Simply retrieve the picture you want to delete by its ID (using WP Get element by ID) or by its position (using WP Get elements), then call the command. Read the documentation

 

 4D View Pro

 

Enhancements with SpreadJS v14 blank

4D v19 comes with a new 4D View Pro ribbon. Besides the fresh look, we have added new features to support the new functionalities of SpreadJS v14.

This new toolbar brings new functionalities such as:

  • Accessibility Support:  Provides adequate accessibility support for users with disabilities who utilize assistive technologies such as screen readers. For more information, refer to Accessibility support
  • Comment Indicator Customization: Users can now change the color and size of the indicator.
  • Copy Images from Excel: Supports copying images from Excel and pasting them into sheets. The pasted image will have the same size, border, and background as it did in Excel.
  • Fill Effects and Patterns: Enhance cell appearance in a spreadsheet by applying pattern or gradient effects to the cells. For more information, refer to Pattern Fill and Gradient Fill

 

Support of six languages

In addition to English, we’ve added support for French, German, Spanish, Japanese, and Portuguese! If you’re a 4D v19 and above user with an operating system matching the supported languages, you’ll notice that all of the 4D View Pro elements are now translated (Ribbon, toolbar, contextual menu, error messages, etc.).

 

End of document loading

Two new events are available to enable you to know when your calculations have completed:  On VP Range Changed and on Timer event.

This can be useful, for instance, when you load a large 4D View Pro document with a lot of formulas, and the calculations can take some time to complete, or when you use an offscreen area and you want to export the document to PDF or Excel format. In such cases, you need to wait for calculations to end before proceeding. Read the documentation

 

Find and replace 

There are times when you initialize a 4D View Pro document, and you need to find some values or tags and replace them with data issued from 4D. Now it’s a breeze with the VP Find command. Thanks to this command, you can find data, formulas, or tags and replace them in the entire sheet or only a specific part of it. Read the documentation

 

4D formulas in spreadsheets 

The VP SET CUSTOM FUNCTIONS command lets you create custom functions in 4D View Pro to execute a 4D formula. It’s not necessary to create a method to use a simple variable in 4D View Pro, just pass it as a parameter to your Formula. Additionally, the command simplifies type-ahead for the end-user by providing help text and parameter names. In large structures, using this command is much faster than using the generic SET FIELD TITLES command. Read the documentation 

Offscreen area 

The new VP Run offscreen area command allows you to manipulate 4D View Pro commands and functions in an offscreen area. To use it, simply pass the area’s information as a parameter (e.g., the area name and the method called when an event is thrown by the 4D View Pro area). Read the documentation

 

Merge and unmerge cells

A new set of commands is at your disposal to help you merge and unmerge a group of cells by programming:

  • To create a merged cell, define a range with all of the cells you want to combine, then pass it in parameter to the new VP  ADD SPAN command which combines the cells into a single span of cells.
  • To retrieve all of the merged cells, use the VP Get spans command.
  • To remove the spanned cells in your document, use the VP REMOVE SPAN command. Read the documentation

 

Formulas: recalculate, suspend, and resume

Three new commands allow you to trigger the calculations of the formulas whenever you wish:

  • Use VP RECOMPUTE FORMULAS to recalculate formulas when data changes.
  • Use VP SUSPEND COMPUTING and VP RESUME COMPUTING to respectively suspend and resume calculations. Read the documentation

 

More options to customize worksheets

The new VP SET SHEET OPTIONS allows you to define various sheet options of a 4D View Pro area. For example, this command lets you:

  • protect a worksheet by preventing the cells within it from being edited
  • customize the colors of your worksheet’s tabs, frozen lines, gridlines, or a selection’s background and border
  • manage the visibility of a worksheet’s gridlines, and row/column headers. Read the documentation

 

Manage rows and columns

4D v19 includes new commands for managing columns and rows. These commands allow you to better adapt your documents to your needs. Columns and rows can be added and removed, or have their size, visibility, and header labels defined with the following commands:

  • VP INSERT ROWS or VP INSERT COLUMNS: Add rows or columns by passing a range containing the first column or row as a parameter and the number of rows or columns to add.
  • VP SET COLUMN COUNT and VP SET ROW COUNT: Define the number of columns and rows displayed. By default, a 4D View Pro sheet contains 100 columns and 1,000 rows. 
  • VP DELETE ROWS or VP DELETE COLUMNS: Remove specific rows or columns. 
  • VP SET COLUMN ATTRIBUTES and VP SET ROW ATTRIBUTES: Specify column width or row height; add a page break for printing; hide or show columns or rows; enable or prohibit resizing columns or rows by users; change column or row header labels. Read the documentation

 

Lock rows and/or columns

The new VP SET FROZEN PANES command helps you create panes. If you have a large table of data, it can be useful to keep an area of a worksheet visible while you scroll to another area. With this command, you can create up to 4 panes in your area: one on the left, one above, one on the right, and one below. Read the documentation

 

 R-releases in depth