Purpose
Tabs can be created and designed in Visual Studio .NET and used on SAP GUI screens.
(with GuiXT it is not possible to create SAP GUI tabs, only existing tabs can be modified)

Many SAP GUI screens use tabs for easier handling. Nevertheless, there are often many areas left over, such as in transaction IW23, where you have to scroll down to find certain fields and data.

In this example we add more tabs and only one area of the notification data is displayed for each selected tab.

Solution
- Create a new windows forms application with a tabcontrol
- add an eventhandler for the tabcontrol to update guixt variables
- compile as classlibrary and embed into a SAP GUI screen
- create a guixt script that updates the screen

At the beginning we create a new application with Visual Studio. NET which we will later convert into a class library. There we add a tabcontrol to a form and adapt it to our needs.

Hint: The tabcontrol is a standard-control that is shipped with the .net client framework. That means no additional files need to be installed on the client pcs. 

Then we can embed the windows form application with the tabcontrol:

GuiXT Script:

if G[Reference object]
 
Control (2.9,-0.5) (5,67.6) progID="Shell.Explorer" _
 
name="tabcontrol" initFlag="tabcontrolinit" 
endif
 

if not G[Reference objec]
 
closecontrol name="tabcontrol"
 
return
endif

// embed control
if
V[tabcontrolinit]
 
CallVB ui_elements.tabcontrol_e.embed "&V[tabcontrol]"
endif

The method "embed" in VB. NET:

' embed into SAP GUI window
    Public Sub embed(ByVal w As Object)

        Dim iconList = New ImageList
        iconList.TransparentColor = Color.Blue

        iconList.ColorDepth = ColorDepth.Depth32Bit
        iconList.ImageSize = New Size(16, 16)
        iconList.Images.Add(Image.FromFile("C:\Images\icon1.gif"))
        iconList.Images.Add(Image.FromFile("C:\Images\icon2.gif"))
        iconList.Images.Add(Image.FromFile("C:\Images\icon3.gif"))
        iconList.Images.Add(Image.FromFile("C:\Images\icon4.gif"))
        iconList.Images.Add(Image.FromFile("C:\Images\icon5.gif"))

        Me.TabControl1.ImageList = iconList
        Me.TabPage1.ImageIndex = 0
        Me.TabPage2.ImageIndex = 1
        Me.TabPage3.ImageIndex = 2
        Me.TabPage4.ImageIndex = 3
        Me.TabPage5.ImageIndex = 4



        ' create guixt object for communication with GuiXT
        myguixt = New guixt
        'myguixt.SetVariable("selectedindex", "0")
        guixt.EmbedForm(Me, w)

    End Sub

To ensure that the tabcontrol reacts to user actions, we set up a GuiXT variable in its event handler and then rebuild the mask. The GuiXT script can then show or hide certain areas of the mask according to the set variable.

Private Sub TabControl1_SelectedIndexChanged(sender As Object, 
   As EventArgs) Handles TabControl1.SelectedIndexChanged

  Dim myTabControl As System.Windows.Forms.TabControl = sender
  myguixt.SetVariable("selectedindex", _ 
   myTabControl.SelectedIndex.ToString)
  myguixt.Input("OK:/0,process=tabcontrol_update.txt")

 End Sub

The specified InputScript can remain empty, but should be present.

When GuiXT rebuilds the screen the second part of the GuiXT script becomes active:

if V[selectedindex=0]

  pos G[Reference object] (6,1)  
 
del G[Responsibilities]
 
del G[Subject]
 
del G[Malfunction data]
 
del G[Item]

endif

 if V[selectedindex=1]

  pos G[Responsibilities] (6,1)  
 
del G[Reference object]
 
del G[Subject]
 
del G[Malfunction data]
 
del G[Item]

endif

Result:
The area "Responsibilities" is visible, the other areas are hidden by GuiXT

Please also have a look at this short video explaining the main workflow:  

Components
InputAssistant + Controls