With 4D v17 R5, we showed you how easy it is to manipulate an object to retrieve the attributes of a file or folder. Things have gotten even easier thanks to object notation! In this blog post, we’re providing you an HDI with a user interface to manage files and folders. This isn’t new in 4D since you could do it with classic 4D commands, but now you can do it easier and with fewer lines of code!
This tip shows you how easy it is to manipulate an object to retrieve a file’s or folder’s attributes. Even better, it shows the power you get by combining new features such as file and folder commands, object notation, and the new list box features. For example, to retrieve a collection of files and folders to display in a list box:
Form.docs:=Form.curfolder.folders().concat(Form.curfolder.files())
Try the example yourself and you’ll see it behaves just like any disk file browser. Now spend a minute to think about how you would write the code behind the list box to create this functionality. Finally, switch to the design mode and take a look at the code, you’ll be surprised by how little code is used. Doing the same without object notation and objects would require 10 times more coding. If haven’t try object notation yet, it’s time!