4D Blog

Home Product 4D Write Pro: a new way to set TABS!

4D Write Pro: a new way to set TABS!

May 23, 2019

Product

We’re thrilled to announce an exciting enhancement in 4D Write Pro! In addition to the features we’ve rolled out so far, 4D v17 R5 also includes a new feature for tabs.

Thanks to the horizontal ruler, setting tabs has become an easy task for the users. They can define the offsets, types, and even the leading character of each tab graphically, simply by using their mouse. But when the same task is performed by a developer via programming, it wasn’t as easy as expected. Three arrays had to be used, one for each kind of setting. Well, not anymore! Now things are much more simple: setting tabs can be done using a collection of strings, numeric values, or even a collection of objects! And that’s not all! If you only need to modify the default tab values, you can use an object with the new constants (added specially for this purpose).

HDI: 4D Write Pro – A new way to set tabs 

default tab settings

A tab is defined by three values: offset, type, and leading character. These three values have their own default values:

  • Offset default value = 1.25cm
  • Type default value = left
  • Leading char default value =  ” ” (none = empty string)

 

Therefore if you want to modify the default offset value, you can simply execute this single line of code:

WP SET ATTRIBUTES(WParea;wk tab default;2) // in this case, 2 is two of the current unit (e.g., cm)

or

// In this case, "1.5cm" is a CSS string that will be used (always a dot - not a comma - with no space)
WP SET ATTRIBUTES(WParea;wk tab default;"1.5cm") 

And if you also want to modify the type of the tab, then you can create an object with three attributes and send it to the same function.

$tab:=New object
$tab[wk type]:=wk left
$tab[wk offset]:="3cm"
$tab[wk leading]:="."
WP SET ATTRIBUTES($body;wk tab default;$tab)

Note: $tab.type is equivalent to $tab[wk type]. The difference is that you can use constants with bracket notation (not possible with dot notation), which helps avoid typos.

MORE tab settings

For compatibility reasons, using arrays is still possible, but it’s much easier to use collections. It’s your call!
Defining tabs is as easy as describing them: “I want three tabs. The first at 2 cm, the second at 8 cm, and the last at 13 cm. Ok, let’s do this:

WP SET ATTRIBUTES(WParea;wk tabs;New collection("2cm";"8cm";"13cm"))

Done!

Wait … why do I need to specify the “cm” if it’s my document’s unit ?
Well actually, you don’t! You can also use numerical values in your collection and the current unit will be used:

WP SET ATTRIBUTES(WParea;wk tabs;New collection(2;8;13)

How cool is that?

Now I want my last tab to be decimal and use a hash (aka pound sign, number sign) as the leading character.
In this case, you just need to create an object for your third tab:

$tab:=New object
$tab[wk offset]:=13
$tab[wk type]:=wk decimal
$tab[wk leading]:="#"
WP SET ATTRIBUTES(WParea;wk tabs;New collection("2cm";"8cm";$tab))

Check out the HDI to discover the new possibilities and for in-depth details, take a look at the 4D doc center. 

 

Discuss

Tags 4D Write Pro, v17 R5, v18, Word processor

Latest related posts

  • June 16, 2025

    Generate, share and use web sessions One-Time Passcodes (OTP)

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

Roland Lannuzel
Roland Lannuzel
• Product Owner & 4D Expert •After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy