View settings are used to define how a document should be displayed. Until 4D v17 R5, these settings could only be modified using the contextual menu or standard actions. Now they can also be set and get within an object using new commands, as we explained in this blog post. But you can do even more, because these settings can be saved and re-applied afterward! You’ll definitely appreciate having your settings saved!
When you’re working on a document, you may need settings such as spell check or visible rulers, perhaps using the embedded or draft mode rather than page mode, and so on. In other words, when you save an unfinished document and reopen it, it’d be nice to find the same settings as before! Even if you’ve shut down your computer.
As you may know, a 4D Write Pro document can save extra properties, including the view settings:
- Create a property (view_setting in the example below),
- Fill it with the view properties using the WP Get view properties command (returns an object with all the view properties),
- Save them within the document.
// Create a new property inside the document: view_setting
[INFO]WPsample.view_setting:=WP Get view properties(*;"WParea")
// Then save the record
When opening a document, re-apply the view settings (if any) with the WP SET VIEW PROPERTIES command.
WP SET VIEW PROPERTIES(*;"WParea";[INFO]WPsample.view_setting)
You can now resume your work, right from where you left it!