Tips & Tricks for your 4D Apps – August Edition

by Add Komoncharoensiri, Director of Technical Services at 4D Inc


Here we go with another set of tips and tricks.

As you know, 4D Knowledge Base is a library of information about the 4D technology where weekly tech tips and monthly technotes are actively published. If you missed the last tips on the KB, that’s fine; here is a compilation from the past few weeks.

This blog post covers 16 tips:

Product blank

Form and subform communication made easy!

Starting with 4D v19 R5, the ability to associate a variable with a subform has enriched the possibilities of interfaces and communication between forms and subforms. The means of communication are now simplified by two new commands: Say hello to OBJECT Get subform container value and OBJECT SET SUBFORM CONTAINER VALUE.

Guest Post blank

List box typeahead: Intuitive list searching

by guest author Chris Belanger, a 4D developer from Canada

List box typeahead (a method for progressively searching) is not a native feature of list boxes. However, you can easily implement this feature with some creative coding. In this blog post, I’ll demonstrate the technique along with a database example and an exhaustive document explaining the details step by step.

The final result is summarized in the GIF below, It illustrates two “searches”. One for E-L-L-I-O-T, then another (after a column sort) for H-A-N-N-A-H:


On resize… On resize… On resize…

Wondering how to create a nice and dynamic user interface? Typically when a form is resized, the form objects whose horizontal sizing or vertical sizing properties are set to move or grow, are automatically resized. In some cases  (e.g., finer user interface management), developers choose to manage form object size and position by programming. To do so, they check the “on resized” event which is triggered within the form method. But what happens when the form contains one or more subforms? On many levels? This blog post gives you the answers!

Product blank

Passing data back and forth between forms

Wouldn’t it be great if you could just open a form and pass it some parameters to initialize your form objects? What about being able to also get the data back to process, after it’s been modified by the user? 4D v16 R5 makes your coding so much easier by greatly simplifying communications with forms.

Until now, when you wanted to display data (not coming from the database itself, but computed or external) to multiple users, you had two options: either write complex code to handle data display in multiple processes, or create as many forms as necessary with a bunch of global variables. But you know that global variables are not an optimized way of coding, from a memory point of view.

So get rid of your complex code and global variables! With 4D v16 R5 you can just bind an object to your form and use it internally with the new Form command. Painless…and powerful!