KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4D Write Pro Tabs
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: September 29, 2020

In 4D Write Pro tabs are managed as an attribute of sections or elements that can contain text. The attribute, wk tabs, contains a collection of objects. Each object in the collection represents a defined tab.

When converting from 4D Write to 4D Write Pro, there is not a one to one replacement for the commands WR ADD TAB and WR DELETE TAB, instead to replace these commands a method would be to get the collection of tabs at the target section, then add or delete the tab from the collection and then apply it back.

For example the following method can be used in place of WR DELETE TAB:

C_OBJECT($1;$wpTarget_o)
C_LONGINT($2;$tabNum_l)

C_COLLECTION($tabs_c)

If(Count parameters=2)

   $wpTarget_o:=$1
   $tabNum_l:=$2

   WP GET ATTRIBUTES($wpTarget_o;wk tabs;$tabs_c)

   $tabs_c.remove($tabNum_l-1)

   WP SET ATTRIBUTES($wpTarget_o;wk tabs;$tabs_c)

End if

The method functions similarly to WR DELETE TAB, however WR DELETE TAB would target the WR area, the sample method must target a text containing Write Pro target like a pragraph or a section like a header.

To add a tab a similar method can be created but instead of removing an element from the collection add in a tab object.