List boxes are the most versatile and customizable form objects. Automatic row heights were already possible for array-based list boxes. With the arrival of 4D v19 R8, this possibility is now extended to list boxes based on collections… and entity selections!
When you use collections with a member method that needs a callback method, many of you have asked us for a more straightforward way.
You asked; we delivered!
Starting with 4D v19 R6, 4D allows you to use a formula to define a callback in the collection member functions, the EXECUTE METHOD IN SUBFORM, CALL FORM, and CALL WORKER commands. If you can reduce your code to a simple expression, you can pass it directly into the formula without using a method.
Collections are increasingly used in 4D programming. Starting with 4D v19, you can use them to define the content of some interface objects, including through the Form function. This is very useful for generic interface management.
We’ve also added improvements to how lists are used. Let’s see this in detail!
You have probably already used a For each…End for each loop to work with ORDA entity selections or with collections. Its use is simple and straight forward. Would like to use it as a 4D tag in your SHTML pages? Or perhaps with the PROCESS 4D TAGS command?
As of 4D v19, you can! Keep reading to learn more.
We know that sometimes you want to change the properties of multiple methods without having to open the property dialog for each method.
For example, you want to set all methods to “Can be run in preemptive mode” status, then compile your database. So with compilation errors, you get an overview of the methods to modify to be preemptive.
Using the METHOD GET NAMES command to retrieve the list of methods from your database, and then using the METHOD SET ATTRIBUTES command to modify the attributes, lets you modify them all at the same time!
Starting with 4D v17, the content of a multilevel collection can easily be displayed in different list boxes. Meaning that you can bind several list boxes to display nested details … without a single line of code! This can be achieved by simply using an object or a collection as the data source for another list box!
With the new list box collection type, the “Current item” and “Selected items” properties have been added. Keep in mind that the “Current item” property allows you to get an object, while the “Selected item” property returns a collection.
Like many other programming languages, 4D provides the ability to iterate over numbers with a For(…) / End for statement, or over a condition thanks to the While(…)/End while and Repeat/Until(…) keywords. These iterations (or loops) are very useful, but not the most appropriate way to iterate over advanced data types such as collections and entity selections. That’s why the new For each(…)/End for each iterator has been created, to help ease your coding!
Recently, 4D introduced of a new type of variable: collections, as well as a large set of methods to manipulate them. With 4D v17, the possibilities of collections is becoming larger by being able to easily display the content of a collection. How? List boxes of collection type!
As a developer, you often need to know whether a specified item already exists in a collection, or to find all the items corresponding to particular criteria. 4D collection methods offer many different ways to look up specific items.