KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to programmatically compare forms in 4D v13
PRODUCT: 4D | VERSION: 13.0 | PLATFORM: Mac & Win
Published On: August 24, 2012

4D v13 introduces two new commands that can be quit useful for comparing forms:

The FORM SCREENSHOT command can be used to generate a "screenshot" of any form in the database.

The Equal pictures command can be used to compare two pictures. Not only does it test the pictures for equality, It creates a "mask" of the difference between the two pictures.

Combining these two commands makes it possible to compare any form in the database and, more prticularly, can be useful to programatically, and therefore automatically, compare forms between different releases of 4D, for example, to test for changes in the way forms look.

Here is a simple example:



The obvious difference in the two forms is the text label has been changed from "1" to "2" but notice also there is a difference in the "Close" button. In fact the button in Form 2 is 1 pixel shorter. These kinds of differences can be detected both visually as well as programatically because the Equal pictures command returns False in this case.

Note: Equal pictures requires that two pictures be the same size. Thus this technique is mainly useful when comparing forms of the same overall size and, more particularly, different versions of the same form.