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

• Product Marketing Manager •

Intissar joined 4D in 2017 as a Product Marketing Manager. She works closely with the product, marketing, engineering, and technical support teams to highlight the ‘why’, the ‘how’, and the ‘what’ of new and updated features to different audiences. This close proximity allows her to craft messaging frameworks, and write in-depth content and code samples for the 4D blog and website.

After graduating with an engineer's degree in Computer Science from VINCI university, Intissar worked in several startups as a software engineer. Her hands-on experience includes software specification, design, and development, user training and support, and team management.