KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Navigation Between Form Pages using Tab Control Object
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: December 11, 2024

A developer may want a page to have multiple tabs with different information. The Tab Control object can be used for this.

The first step is to make a form and add pages to it. Then add a Tab Control object to page 0



Within the form method make an array of the tab names (There are others ways to do this, including using lists.):

Case of
   : (Form event code=On Load)
   ARRAY TEXT(pageArr; 3)
   pageArr{1}:="Tab1"
   pageArr{2}:="Tab2"
   pageArr{3}:="Tab3"
End case

In order to get the Tab Control Object working the following attributes should be changed in the Tab Control Object: Variable or Expression should be pageArr or whatever the developer names the array of tab titles, Expression type should be array text, Standard Action should be set to gotoPage, and the only event needed checked off is On Load.

There is a way to navigate programmatically rather than using the standard action as well.
Have nothing inside the standard action and clear the form method as well. This is an example that goes inside the object method of the Tab Control. Ensure the Tab Control object has the events On Load, On Clicked, and On Unload.

Case of
   : (Form event code=On Load)
   ARRAY TEXT(pageArr; 3)
   pageArr{1}:="Tab1"
   pageArr{2}:="Tab2"
   pageArr{3}:="Tab3"
   : (Form event code=On Clicked)
   FORM GOTO PAGE(pageArr)
   : (Form event code=On Unload)
   CLEAR VARIABLE(pageArr)
End case