• user warning: Unknown column 'u.signature_format' in 'field list' query: SELECT c.cid as cid,, c.nid, c.subject, c.comment, c.format, c.timestamp,, c.mail, c.homepage, u.uid, AS registered_name, u.signature, u.signature_format, u.picture,, c.thread, c.status FROM comments c INNER JOIN users u ON c.uid = u.uid WHERE c.nid = 19556 AND c.status = 0 ORDER BY c.cid LIMIT 0, 50 in /var/www/ on line 991.
  • warning: file_get_contents( [function.file-get-contents]: failed to open stream: HTTP request failed! in /var/www/ : eval()'d code on line 4.

A brief history of ListBoxes

by Thibaud Arguillère

After the other day's country stroll in the Method Editor, let’s spend a few minutes on the ListBoxes. Because among other new major (1) features of 4D v12, ListBox improvements are definitely major-major (1 too).

Let’s start with a short reminder, kind of A ListBox History.


The first generation of ListBoxes was born with 4D 2004. Using a ListBox is very easy: The developer drags and drops a ListBox object in the form, and binds it with arrays. That’s all. 4D does the rest. Although it does not rest (2): Lots of automatic behaviors dramatically facilitate (read "speed up") development. For example, the automatic sort when the user clicks the header (first click: ascending order, next click: descending order, and so on). Or the fact that the user can move columns or rows, which automatically modify the arrays. All this with no need to write code.


This first implementation of ListBoxes in 4D also lets you:

  • format columns and lines
  • format the ListBox itself (alternate colors, use vertical and horizontal lines, etc.)
  • dynamically – via the language – change the columns (the arrays) and the headers (which are in fact nothing else than 4D buttons)
  • do a lot of other things that made this first release of ListBoxes in 4D a must-use. It is a fact that ListBoxes were huge success: A lot of developers immediately used them. Well, at least the developers who moved to 2004 when it was released!


The second generation of ListBoxes came with 4D v11 SQL. One could then link a selection to a ListBox. Current selection, or named selection (and, obviously, arrays were still handled). This upgrade was a major step forward for the ListBoxes. In client/server mode especially, it made life easier for developers, because network access is optimized, data is automatically paginated, etc. The “Named Selection ListBoxes,” they permit – among other good ideas – to display several selections of the same table in the same form. This was possible with versions of 4D before v11 – anyone recall Scrollable areas? – at the cost of some complexity of development.


On the automations side for the Current Selection ListBoxes, 4D handles the related fields (depending on the state of relations) but also the data entry: The end user can modify the data directly in the ListBox, 4D saves the record(s). If the record is locked, data entry is not allowed. If you think about it, v11 ListBoxes should kill the usage of MODIFY/DISPLAY SELECTION. And let me state my opinion: This is good news, because those two commands don’t let us easily build a modern interface (which likes this scrollbar on the right, including header and footer).


For those two versions of ListBoxes, it is possible to fine tune user interaction. We can write specific code when a row, a cell, or header is clicked (single or double). Or we can handle editing, play with column visibility, etc.


This was a quick historical reminder. Not all has been covered, and it was not an exhaustive trip. (Hey, I didn’t mention the checkbox to modify Booleans; nor did I talked about the popup displayed if a field has a list. So much features!) Let’s move to now.


Now, we have 4D v12 and the third generation of ListBoxes. And for this third album, we’ve been spoiled! Two main features have been added to the ListBoxes. Randomly (3), let’s start with… (brrrrrrrrrrrr – that's supposed to be a drum roll) …hierarchy! Hierarchy is the ability to display a ListBox-With-Arrays using, hmm, well, a hierarchy. As I’m aware this is a bit confusing, here is a quick movie demonstrating how it works. This will be more efficient:



Cool, isn’t it? I hope you noticed the hierarchy can also be handle with the language: it contains all the necessary commands (create/remove hierarchy, expand/collapse, etc.). After this wonderful movie, I can drive you to the How Do I demo application on hierarchical listboxes.


Beside hierarchy, 4D v12 allows ListBoxes to be printed. This is done using the new Print object command (several blobs, TechTips, TechNotes, and training sessions could focus on this single command!). Indeed, using Print object and LISTBOX GET PRINT INFORMATION, not only can you print your ListBox with a full control of the printout (“How many lines printed?” “What is the last printed line?”), but you also can print 2, 3, or 10 ListBoxes wherever you want on the same page. All different or n times the same if you like. And – ta-dah! – you can fill your ListBox with Multistyle text columns (whatever the source of the ListBox: arrays or selection). With 4D v12, I can print 1-n ListBoxes so professional and good looking that I can pretend to be serious in front of customers.


I have no doubt: next major version of 4D will come with a fourth generation of ListBoxes. I have dozens of good ideas about this topic. What about you?


(1) See previous blogs
(2) Yes, I know. It’s funnier in French

(3) I promise

RSS 0 comment(s) to this post