4D Write Pro: Save the view properties

Automatically translated from English

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.

Example

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
SAVE RECORD([INFO])

When opening a document, re-apply the view settings (if any) with the WP SET VIEW PROPERTIES command. 

If ([INFO]WPsample.view_setting#Null)
WP SET VIEW PROPERTIES(*;"WParea";[INFO]WPsample.view_setting)
End if

You can now resume your work, right from where you left it! 

Avatar

A front-end developer with a sprinkle of Design Thinking.
Currently Product Marketing @4D